Monday, August 26, 2013

Nagios - Hosts Disappear

Well I had configured my nagios setup and everything seemed to be fine, then i noticed something strange! The hosts keep disappearing time to time. They do come up at an odd time but not always. Well lot of time was spent on configurations analyzing what went wrong and what ! no LUCK!! :(

So to all those who has this problem, here's something that you might want to check for. Such an issue arises due to more number of nagios PIDs, ie the shutdown of previous nagios was not proper and that PID is messing up with the new one. So to troubleshoot stop nagios, check for orphaned PIDs.. kill it and start nagios again. Voila the hosts started appearing with no issues again!! :)

[root@server ~]#    ps -ef | grep -i  nagios
nagios   23581     1  0 Aug22 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   24686     1  0 Aug19 ?        00:00:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     29749 27976  0 07:14 pts/0    00:00:00 grep -i nagios

[root@server ~]#    /etc/init.d/nagios stop

[root@server ~]#     ps -ef | grep -i  nagios
nagios   24686     1  0 Aug19 ?        00:00:01 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     29760 27976  0 07:14 pts/0    00:00:00 grep -i nagios

[root@server ~]#     kill -9 24686

[root@server ~]#     ps -ef | grep -i  nagios
root     29762 27976  0 07:14 pts/0    00:00:00 grep -i nagios

[root@server ~]#     /etc/init.d/nagios start
Starting nagios: done.

[root@server ~]#     ps -ef | grep -i  nagios
nagios   29791     1  0 07:14 ?        00:00:00 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     29795 27976  0 07:14 pts/0    00:00:00 grep -i nagios

Thursday, June 6, 2013

Hard Disk Cloning - Data Recovery

Okay, you can use various Linux commands that can be used to clone the hard drive. This can be helpful while recovering data.

 dd

The simplest program to clone.

Usage:

dd if=/dev/sda/ of=/dev/sdb

It will copy partition table and boot loader and all partitions within this disk

Here "if" option specifies your input and "of" specifies your output.
Make sure that both hard disks are of the same size.

How to get the status of disk cloning. Open a new terminal and issue the following commands.

# pgrep -l dd
56452 dd

# kill -USR1 56452 

Here the first command will out put the process id of the dd command and the second command will make dd throw the output in the same shell where its running.

Hope it helps.