This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen *:80; | |
server_name www.icinga2.com; | |
root /usr/share/icingaweb2/public; #Path of icinga2 web directory | |
index index.php; | |
access_log /var/log/nginx/access.log; | |
error_log /var/log/nginx/error.log; | |
location = /favicon.ico { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyroute2 import IPDB, IPRoute | |
import os | |
def create_veth_path(fd): | |
ip = IPDB() | |
# create interface pair | |
ip.create(ifname='pycoz0', kind='veth', peer='pycoz1').commit() | |
ip.release() | |
setup_ip('pycoz0', '10.0.0.1/24') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
groups_types = {'cpu': '/sys/fs/cgroup/cpu/system.slice/', | |
'memory': '/sys/fs/cgroup/memory/system.slice/'} | |
def create_cgroups(name): | |
for group, path in groups_types.items(): | |
if os.path.exists(path): | |
target = os.path.join(path, name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# goo.gl/bRsdYQ | |
import ctypes | |
import os | |
from multiprocessing import Process | |
CLONE_NEWUSER = 0x10000000 | |
CLONE_NEWPID = 0x20000000 |