Skip to content

Instantly share code, notes, and snippets.

View ruzickap's full-sized avatar

Petr Ruzicka ruzickap

View GitHub Profile
@ruzickap
ruzickap / openwrt_watchcat.sh
Created April 6, 2014 15:22
OpenWrt Watchcat
opkg install luci-app-watchcat
/etc/uci-defaults/50-watchcat
uci set system.@watchcat[0].period=1h
/etc/init.d/watchcat enable
@ruzickap
ruzickap / openwrt_rainbow.sh
Created April 11, 2014 18:22
OpenWrt Rainbow - set led colors
uci set rainbow.wifi=led
uci set rainbow.@led[-1].color=blue
uci set rainbow.@led[-1].status=auto
uci set rainbow.pwr=led
uci set rainbow.@led[-1].color=red
uci set rainbow.@led[-1].status=auto
uci set rainbow.lan=led
uci set rainbow.@led[-1].color=green
@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 / 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 / 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-pgpool01_installation.sh
Created October 25, 2014 10:15
cz01-pgpool01 primary pgpool server installation
sed \
-e "s/^wd_hostname =.*/wd_hostname = 'cz01-pgpool01.example.com'/" \
-e "s/^heartbeat_destination0 =.*/heartbeat_destination0 = 'cz01-pgpool02.example.com'/" \
-e "s/^#other_pgpool_hostname0 =.*/other_pgpool_hostname0 = 'cz01-pgpool02.example.com'/" \
-i /etc/pgpool-II-93/pgpool.conf
service pgpool-II-93 start
@ruzickap
ruzickap / cz01-pgpool0{1,2}_installation.sh
Created October 25, 2014 10:13
cz01-pgpool0{1,2} pgpool servers installation
#pgpool 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 pgpool-II-93 postgresql93
scp -r cz01-psql01.example.com:/root/{.ssh,.pgpass} /root/
scp cz01-psql01.example.com:/root/.pgpass /root/
cp /etc/pgpool-II-93/pcp.conf.sample /etc/pgpool-II-93/pcp.conf
echo "admin:`pg_md5 password123`" >> /etc/pgpool-II-93/pcp.conf
@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/
@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'/" \