Posts

Showing posts from April, 2012

Custom Perl Script for Email Notification when Host is Down.

I have found the Perl script for ping in Cacti. I have modified that script to restart quagga service, save the date-time in a file and send email notification whenever a host is down. Here it is: [root@busy-bee2 ~]cat ping.pl #!/usr/bin/perl # take care for tcp:hostname or TCP:ip@ $host = $ARGV[0]; $host =~ s/tcp:/$1/gis; open(PROCESS, "ping -c 1 $host | grep icmp_seq | grep time |"); $ping = <PROCESS>; close(PROCESS); $ping =~ m/(.*time=)(.*) (ms|usec)/; if ($2 == "") { print "U"; # avoid cacti errors, but do not fake rrdtool stats $comand = "/etc/init.d/ospfd restart; date >> /root/quagga_restarted; echo quaggaRestarted | mail -s quaggaRestartedFly user\@domain.tld"; system("$comand"); } elsif ($3 eq "usec") { print $2/1000; # re-calculate in units of "ms" }else{ print $2; }   One can use a...

Quagga OSPF Simulation in CentOS 6

Image
Scenario This article is actually a modified version of a previous article IP Details All the Routers in the diagram are actually CentOS Machines. Router Alpha: eth0: 192.168.10.254/24 eth1: 10.0.0.2/30 Router Beta: eth0: 192.168.20.254/24 eth1: 10.0.0.1/30 eth2: 10.0.0.5/30 Router Gamma: eth0: 192.168.30.254/24 eth1: 10.0.0.6/30 Objective We would be configuring the Linux boxes with dynamic routing protocol OSPF for total connectivity. This would be done with the help of Quagga. Router Alpha Configuration root@alpha:~# yum install quagga W e would be configuring the interface parameters. Keep in mind, there are example configuration files stored in /usr/share/doc/quagga/ root@alpha:~# cd /etc/quagga root@alpha:/etc/quagga# cat zebra.conf .sample > zebra.conf root@alpha:/etc/quagga# vim zebra.conf  hostname AplhaRouter password zebra enable password zebra ! ! Interface's description....