Wednesday 29 April 2009

nagios directory update plugin

nagios plugin for checking a directory is updated. You need to give two argument first for directory and second for minutes.

PROGNAME=`basename $0`
PROGPATH=`echo $0 sed -e 's,[\\/][^\\/][^\\/]*$,,'`
. $PROGPATH/utils.sh

SEARCH=$1
MIN=$2
COUNT=$(find $1 -mmin -$2 wc -l sed -e 's/ //g' )


if [[ $COUNT -eq 0 ]]
then
echo "NOK " $SEARCH $COUNT "" $SEARCH"COUNT="$COUNT";;;; "
exit $STATE_CRITICAL
else
echo "OK " $SEARCH $COUNT "" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_OK
fi

nagios file count plugin

nagios plugin for checking a directory for count of file. You need to give two argument first for directory and second for file count.

PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
. $PROGPATH/utils.sh

SEARCH=$1
MAX=$2
COUNT=$(find $1 | wc -l| sed -e 's/ //g')


if [[ $COUNT -gt $MAX ]]
then
echo "NOK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_CRITICAL
else
echo "OK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_OK
fi

Friday 24 April 2009

Nagios Installation CentOS 5.2

Change your repository
http://tlepsh.blogspot.com/2009/03/yum-ftp-only-repository.html
Add dag repository to your configuration

[dag]
name=CentOS-5 - Plus
baseurl=ftp://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/x86_64/dag/
enabled=0
gpgcheck=0

Install nagios
#yum --disablerepo=\* --enablerepo=dag,alteredbase install nagios

Start nagios
#/etc/init.d/nagios start

Restart web service
#/etc/init.d/httpd restart

Create a password for nagiosadmin user
#htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

Install nagios plugins and perl module that you will need
#yum --disablerepo=\* --enablerepo=alteredbase,dag install nagios-plugins.x86_64
#yum --disablerepo=\* --enablerepo=alteredbase,dag install perl-DBI perl-DBD-ODBC,perl-Convert-BER.noarch

device not accepting address , error -71

I had issues with usb hd. I got error like below
usb 6-7: new high speed USB device using address 2
usb 6-7: device not accepting address 2, error -71

run the command below
modprobe -r ehci_hcd

Wednesday 1 April 2009

Move server RSA fingerprint to new server

I am using ssh auto login for transfering files between servers. I move RSA fingerprint to new server for preventing these warnings : REMOTE HOST IDENTIFICATION HAS CHANGED or confirming RSA key fingerprint Are you sure you want to continue connecting (yes/no).
Copy files under /etc/ssh directory to new server.
scp youroldserver:/etc/ssh/ssh_host_* /etc/ssh
You should move your ipadress to old server. If not you will get confirmation again.Or you can duplicate related entries in known_hosts file and change old ip adresses or hostname.