Heard about Shinken when searching for issues related with Nagios and decided to give it a try on my Ubuntu 10.10 (32bit) a try by following this script. Everything went well except then I try to start thruk (the http admin ui) I got the following error
ERROR: this is the wrong precompiled version, your archname is: i686-linux-gnu-thread-multi
BEGIN failed–compilation aborted at /opt/thruk/script/thruk_server.pl line 18.
By looking into the code, the perl script is expecting
but instead I got
So the fix can’t be simpler, simply do
cd /opt/thruk/local-lib/lib/perl5 ln -s i486-linux-gnu-thread-multi i686-linux-gnu-thread-multi
% is a special character in crontab and it has to be escaped with
another ‘%’ a ‘\’. I just found out through a fail-to-run crontab task:
1 5 * * * /bin/bash /path/to/myscript.sh `date +%Y%m%d -d '5 days ago'`
When a crontab fails it will drop an email to user’s mailbox. So here are the relavant lines I found in the mailbox (via command mail):
/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
With those error messages I googled a bit and changed the crontab to the following
1 5 * * * /bin/bash /path/to/myscript.sh `date +%%Y%%m%%d -d ‘5 days ago’`
1 5 * * * /bin/bash /path/to/myscript.sh `date +\%Y\%m\%d -d '5 days ago'`
Here’s my test result with transferring a 1.8GB text file to a remote server:
scp data user@remote_server:/path/to
2 minutes 48 seconds
scp -C data user@remote_server:/path/to
2 minutes 14 seconds
rsync -z data user@remote_server:/path/to
1 minute 46 seconds
Method 1) doesn’t use compression at all.
Method 2) enables compression through scp’s -C option.
Method 3) uses rsync with -z (compression) and clearly this method provides the best performance.
I happened to need to compare two huge data files (plain texts), each of which is near 2GBs in size. When I use the good old diff program on a Centos with 2GB of Ram and 512MB of SWAP, pretty quickly I got stuck with this error: diff: memory exhausted.
A little googling pointed me to the following solution
1) Chop first 1 line from a file
sed -i '1d' filename
[ if need to chop more, simply change 1 to the number of lines to be removed ]
2) Chop last line from a file
sed -i '$d' filename
3) Chop first and last line together from a file
sed -i -e '1d' -e '$d' filename
Found the commands at http://systembash.com/content/how-to-turn-off-your-monitor-via-command-line-in-ubuntu/:
To turn off monitor:
xset dpms force off
To turn on, simply press a key, or move mouse/mousepad.
Found a pretty neat solution at http://www.genlinux.org/2009/04/remote-diff-in-linux.html for comparing remote and local files. For example, if I want to compare the file
remote_ip:~/myscript.sh with the local version, I no longer have to copy the remote file to a temporary location and do a local diff, instead, with the solution provided in the link above, I can simply do
ssh user@remote_ip 'cat ~/myscript.sh' | diff - path/to/local/myscript.sh