Create XEN LXC DomU

DOMAIN_NAME=lxc
DOMAIN_MAC=00:00:00:ef:11:cc
DOMAIN_RAM=2Gb
DOMAIN_HDD=128Gb

xen-create-image \
--hostname=${DOMAIN_NAME} \
--dist=xenial \
--lvm=vg1 \
--fs=ext4 \
--dhcp \
--pygrub \
--mac=${DOMAIN_MAC} \
--mirror=http://archive.ubuntu.com/ubuntu \
--size=${DOMAIN_HDD} \
--memory=${DOMAIN_RAM} \
--swap=${DOMAIN_RAM} \
--genpass=0 \
--password=t00r \
--vcpus $(cat /proc/cpuinfo | grep processor | wc -l)

mv /etc/xen/${DOMAIN_NAME}.cfg /etc/xen/${DOMAIN_NAME}
ln -s /etc/xen/${DOMAIN_NAME} /etc/xen/auto/12_lxc

mou

Json / jq

# processing Icinga warning Json list
PASSWORD=pass1234
URL="http://monitoring.example.com/cgi-bin/icinga/status.cgi?servicestatustypes=20&noheader=1&servicestatustypes=29&sorttype=2&sortoption=3&scroll=963&jsonoutput"

wget -q --user=${USER} --password=${PASSWORD} "${URL}" -O - | jq --raw-output ' .status.service_status[] | select(.host_name | contains("integration")) | select(.status_information | contains("Apache", "Java")) | .host_name'

jq 'select(.geo != null)' all.json

LTSP update kernel module

# on client: download driver
# Intel ixgbe (10G NIC)
wget https://downloadmirror.intel.com/14687/eng/ixgbe-4.4.6.tar.gz -qP /tmp

# Intel e1000e (1G NIC)
wget https://downloadmirror.intel.com/15817/eng/e1000e-3.3.4.tar.gz -qP /tmp
tar xzf /tmp/e1000e-3.3.4.tar.gz -C /tmp/

# install required packages
apt-get install build-essential linux-headers-$(uname -r)

# on client: compile
cd /tmp/e1000e-3.3.4/src/
make

# copy /tmp/e1000e-3.3.4/src/e1000e.ko to LTSP server

# debug on server
# make install
# rmmod e1000e
# modprobe e1000e
# update-initramfs -u

# backup original

Install SonarQube

<?php
$URL="https://raw.githubusercontent.com/panticz/installit/master/install.sonarqube.sh";
echo "wget $URL -O - | bash -";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

WebGUI
http://172.29.14.185:9000/

Logfile
tail -f /opt/sonar/logs/sonar.log

Links
http://sonar-pkg.sourceforge.net/
http://docs.sonarqube.org/display/SONAR/Requirements
https://github.com/Godin/sonar-native-packages
https://gist.github.com/micheleorsi/bd20912b2489f3432558

Install SSH VPN server

export CONTAINER=vpn

# create container
# TODO: configure MAC on create container
wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/create.jessie.sh -O - | bash -s -- -f

# configure container MAC address
sed -i 's|lxc.network.hwaddr = .*|lxc.network.hwaddr = 00:11:22:33:44:5e|' /var/lib/lxc/${CONTAINER}/config

# enable autostart
echo "lxc.start.auto = 1" | tee -a /var/lib/lxc/${CONTAINER}/config

# configure container
##echo "lxc.hook.autodev=/var/lib/lxc/vpn/autodev" >> /var/lib/lxc/${CONTAINER}/config

Jenkins CLI

# command overview
http://jenkins.example.com:8080/cli/

# add public key for user
http://jenkins.example.com:8080/me/configure

# authentificate by user / pass
java -jar jenkins-cli.jar -s http://jenkins.example.com:8080/ list-jobs --username --password

# install plugin by name
java -jar jenkins-cli.jar -s http://jenkins.example.com:8080/ install-plugin findbugs

# install plugin from URL?
java -jar jenkins-cli.jar -s http://jenkins.example.com:8080/ install-plugin http://updates.jenkins-ci.org/download/plugins/AdaptivePlugin/0.1/AdaptivePlugin.hpi

LXC: create Ubuntu Trusty container

<?php
$URL="https://raw.githubusercontent.com/panticz/lxc/master/create.trusty.sh";
echo "wget -q --no-check-certificate $URL -O - | bash -s";
echo "

";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
echo htmlspecialchars(curl_exec($c));
curl_close($c);
echo "

";
?>

Allow root SSH login with password
sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sed -i 's|PasswordAuthentication no|PasswordAuthentication yes|' /etc/ssh/sshd_config
service ssh restart

Debian: Install Cacti

# create container
export CONTAINER=cacti
wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/lxc/master/create.jessie.sh -O - | bash -s -- -f
sudo lxc-attach -n ${CONTAINER} -- sed -i 's|PermitRootLogin without-password|PermitRootLogin yes|' /etc/ssh/sshd_config
sudo lxc-attach -n ${CONTAINER} -- service ssh restart

# fix dns
echo nameserver 8.8.8.8 > /var/lib/lxc/${CONTAINER}/rootfs/etc/resolv.conf

# install applications
lxc-attach -n ${CONTAINER} --
LANG=en_US.UTF-8

apt-get update

# server
debconf-set-selections <<\EOF