Skip to content

Instantly share code, notes, and snippets.

View ruzickap's full-sized avatar

Petr Ruzicka ruzickap

View GitHub Profile
@ruzickap
ruzickap / openwrt_turris_thetmometer.sh
Last active August 29, 2015 14:00
OpenWrt - Graph internal Turris thermometers (CPU, Board)
mkdir -p /data/temperature_sensors /www3/temperature_sensors
#The graphs can be accessed: http://192.168.1.1/myadmin/temperature_sensors
ln -s /www3/temperature_sensors /www3/myadmin/temperature_sensors
#Create RRDtool database to store the values every 10 minutes (600 seconds) for 10 years (525600 * 600 seconds)
rrdtool create /data/temperature_sensors/temperature_sensors.rrd --step 600 \
DS:temp0:GAUGE:1000:-273:5000 DS:temp1:GAUGE:1000:-273:5000 RRA:AVERAGE:0.5:1:525600 \
RRA:MIN:0.5:1:525600 RRA:MAX:0.5:1:525600
#Add cron entry to put the temperatures into the database
@ruzickap
ruzickap / openwrt_external_thermometers.sh
Created April 20, 2014 06:09
OpenWrt - External USB Thermometers
mkdir -p /data/mydigitemp /www3/mydigitemp
#The graphs can be accessed: http://192.168.1.1/myadmin/mydigitemp
ln -s /www3/mydigitemp /www3/myadmin/mydigitemp
#Create RRDtool database to store the values every 10 minutes (600 seconds) for 10 years (525600 * 600 seconds)
rrdtool create /data/mydigitemp/mydigitemp.rrd --step 600 \
DS:temp0:GAUGE:1000:-273:5000 DS:temp1:GAUGE:1000:-273:5000 RRA:AVERAGE:0.5:1:525600 \
RRA:MIN:0.5:1:525600 RRA:MAX:0.5:1:525600
#Script getting the data from termometers
@ruzickap
ruzickap / openwrt_guest_wifi.sh
Created May 2, 2014 09:52
OpenWrt - Guest WiFi configuration
uci set network.wifi_open=interface
uci set network.wifi_open.type=bridge
uci set network.wifi_open.proto=static
uci set network.wifi_open.ipaddr=10.0.0.1
uci set network.wifi_open.netmask=255.255.255.0
uci add wireless wifi-iface
uci set wireless.@wifi-iface[-1].device=radio0
uci set wireless.@wifi-iface[-1].mode=ap
uci set wireless.@wifi-iface[-1].ssid=medlanky.xvx.cz
@ruzickap
ruzickap / openwrt_nodogsplash.sh
Last active October 10, 2015 20:48
OpenWrt - Nodogsplash configuration
#Download the nodosplash compiled for Turris router (mpc85xx) [if it's not already in the "main repository"]
curl -L --insecure "https://github.com/ruzickap/linux.xvx.cz/raw/gh-pages/files/turris_configured/root/nodogsplash_0.9_beta9.9.8-2_mpc85xx.ipk" -O /tmp/nodogsplash_0.9_beta9.9.8-2_mpc85xx.ipk
#Install the package (try first: opkg install nodogsplash)
opkg install /tmp/nodogsplash_0.9_beta9.9.8-2_mpc85xx.ipk
#Backup the original config file
mv /etc/nodogsplash/nodogsplash.conf /etc/nodogsplash/nodogsplash.conf-orig
#Create main config file
@ruzickap
ruzickap / cacti_installation.sh
Created September 3, 2014 18:01
Cacti non-interactive installation
yum install -y cacti mysql-server
# MySQL configuration
service mysqld start
chkconfig mysqld on
mysqladmin -u root password admin123
mysql --password=admin123 --user=root << EOF
#Taken from /usr/bin/mysql_secure_installation
@ruzickap
ruzickap / create_graphs.sh
Created September 3, 2014 18:10
OpenStack's create_graphs script installation
#modify the script to work with othe VMs (not just KVM based) + small bugfix
wget https://git.openstack.org/cgit/openstack-infra/config/plain/modules/openstack_project/files/cacti/create_graphs.sh -O - | sed 's/All Hosts/Default Tree/;s/add_device.php --description/add_device.php --ping_method=icmp --description/;s/grep "Known"/grep -E "Known|Device IO"/;s@xvd\[a\-z\]\$@-E "\(sd\|xvd\)\[a-z\]\$"@' > /root/create_graphs.sh
chmod a+x /root/create_graphs.sh
wget https://git.openstack.org/cgit/openstack-infra/config/plain/modules/openstack_project/files/cacti/linux_host.xml -P /var/lib/cacti/
/usr/bin/php -q /usr/share/cacti/cli/import_template.php --filename=/var/lib/cacti/linux_host.xml --with-template-rras
wget https://git.openstack.org/cgit/openstack-infra/config/plain/modules/openstack_project/files/cacti/net-snmp_devio.xml -P /usr/local/share/cacti/resource/snmp_queries/
@ruzickap
ruzickap / ovftool_installation.sh
Created September 27, 2014 13:37
OVFTool installation on ESXi
#Download OVF tools
wget -q ftp://ftp.example.com/software/vmware/installation_scripts/vmware-ovftool.tar.gz -O /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz
# Extract ovftool content to /vmfs/volumes/My_Datastore
tar -xzf /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz -C /vmfs/volumes/My_Datastore/
rm /vmfs/volumes/My_Datastore/vmware-ovftool.tar.gz
# Modify the ovftool script to work on ESXi
sed -i 's@^#!/bin/bash@#!/bin/sh@' /vmfs/volumes/My_Datastore/vmware-ovftool/ovftool
@ruzickap
ruzickap / vCenter_install_configure.sh
Last active August 29, 2015 14:06
VMware vCenter Server 5.x Appliance installtion and configuration
# Deploy OVF from remote HTTP source
/vmfs/volumes/My_Datastore/vmware-ovftool/ovftool --diskMode=thin --datastore=My_Datastore --noSSLVerify --acceptAllEulas --skipManifestCheck "--net:Network 1=VMware Management Network" --prop:vami.ip0.VMware_vCenter_Server_Appliance=10.29.49.99 --prop:vami.netmask0.VMware_vCenter_Server_Appliance=255.255.255.128 --prop:vami.gateway.VMware_vCenter_Server_Appliance=10.29.49.1 --prop:vami.DNS.VMware_vCenter_Server_Appliance=10.1.1.44 --prop:vami.hostname=vcenter.example.com "ftp://ftp.example.com/software/vmware/VMware-vCenter-Server-Appliance-5.5.0.10000-1624811_OVF10.ova" "vi://root:mypassword@127.0.0.1"
echo "Accepting EULA ..."
/usr/sbin/vpxd_servicecfg eula accept
echo "Configuring Embedded DB ..."
/usr/sbin/vpxd_servicecfg db write embedded
echo "Configuring SSO..."
/usr/sbin/vpxd_servicecfg sso write embedded
echo "Starting VCSA ..."
@ruzickap
ruzickap / cz01-psql01_installation.sh
Created October 25, 2014 07:43
cz01-psql01 PostgreSQL database installation
#PostgreSQL installation
yum localinstall -y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
yum install -y postgresql93-server repmgr
yum install -y --enablerepo=centos-base postgresql93-contrib
service postgresql-9.3 initdb
chkconfig postgresql-9.3 on
sed -i.orig \
-e "s/^#listen_addresses = 'localhost'/listen_addresses = '*'/" \
-e "s/^#shared_preload_libraries = ''/shared_preload_libraries = 'repmgr_funcs'/" \
@ruzickap
ruzickap / cz01-psql02_installation.sh
Created October 25, 2014 07:47
cz01-psql02 PostgreSQL database installation
#PostgreSQL installation
yum localinstall -y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
yum install -y postgresql93-server repmgr
yum install -y --enablerepo=centos-base postgresql93-contrib
chkconfig postgresql-9.3 on
echo 'PATH=/usr/pgsql-9.3/bin:$PATH' >> /var/lib/pgsql/.bash_profile
scp -r cz01-psql01.example.com:/root/{.pgpass,.ssh} /root/
cp -r /root/{.pgpass,.ssh} /var/lib/pgsql/