RRDtool is a great facility which aims to replace MRTG and was written by Tobias Oetiker. RRDtool provides powerful features for collecting and visualizing various system metrics like network traffic, MySQL counters or whatever you want. It’s always good idea to know what is going on under the hood of your server. Managing servers we…
All posts in linux
Getting list of available for update packages in Fedora and Debian
If you need to get list of available packages for update in Fedora you can use next command: yum clean all && yum check-update And the same for Debian: apt-get clean all && apt-get -qqs dist-upgrade -qq options stand for quite output and -s stands for simulation with no action. Didn’t find the answer to…
Adding SSH keys for password-less login with non standard SSH port
As you may know you can login to your SSH server with use of DSA/RSA keys without entering password. The simplest way to add key to the remote server is ssh-copy-id script. Here is an example of how you can add key if you use non standard SSH port: ssh-copy-id -i /home/myuser/.ssh/id_dsa.pub “myuser@example.com -p 2222″…
Cleaning ‘Failed actions’ message in Pacemaker/Corosync cluster setup
Sometimes when using Pacemaker/Corosync-based cluster you can see warning message in crm_mon output: Failed actions: drbd_mysql:0_promote_0 (node=node2.cluster.org, call=11, rc=-2, status=Timed Out): unknown exec error To clean it up you can use command crm_resource which checks health of resources: [root@node1 ~]# crm_resource -P Waiting for 1 replies from the CRMd. OK [root@node1 ~]# To check cluster’s…
Automatic GeoIP database update
Free binary GeoLite Country database by MaxMind is being updated every month. To update it automatically you can put this script to cron at the beginning of a month. #!/bin/sh cd /usr/share/GeoIP wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz gzip -d -f GeoIP.dat.gz [root@playground ~]# sh -x /usr/local/sbin/geoip-update.sh + cd /usr/share/GeoIP + wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz + gzip -d -f…
RPM: building proctitle for PHP
Sometimes it’s convenient to change PHP script name, it allows to check if it’s running by typing just pstree. You can perform that with use of proctitle. Unfortunately there is no rpm for this package for Fedora 15. So to use it you need to build it. Firstly you need to download source package to…
RPM: how to build Redis library package for PHP
At Supportex we use Redis a lot. It’s extremely fast and doesn’t consume a lot of resources. Besides it’s easy to use for developers (especially for those who worked with Memcache). Unlike Python which has only one mature client, PHP has various of them. For instance, Predis, phpredis, Rediska, etc. We prefer phpredis. It’s written…
Bash: check if a zip or a rar file has password-protection
If you need to check if zip or rar file has password protection you can do it this way. For zip fip: crypted=$( 7z l -slt — $file | grep -i -c “Encrypted = +” ) if [ “$crypted” -eq “1” ]; then protected=1 fi And for rar: unrar x -p- -y -o+ “$file” 1>…
Python: sorting dict by value
Probably one of the most often task while working with dictionaries in Python is sorting by value. That is how it can be done: >>> d = {‘Canada’: 513, ‘Sao Tome and Principe’: 3, ‘Fiji’: 1, ‘Montenegro’: 12, ‘Lithuania’: 47} >>> sorted_list = sorted(d, key=d.get, reverse=True) >>> for i in sorted_list: … print i, d[i]…
Troubleshooting: Cannot open TUN/TAP dev /dev/net/tun
If you are getting error ‘Cannot open TUN/TAP dev /dev/net/tun‘ while starting OpenVPN server, it means that you should load ‘tun’ module which features TUN/TAP device driver: OpenVPN 2.1.1 i386-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Jan 26 2010 NOTE: the current –script-security setting may allow this configuration to call user-defined scripts LZO compression initialized…