System and Network Downages

In this sample example, we monitor and report system and network downages.

The SysDown script might send an alert message like the following:

                                PIKT ALERT
                         Thu Oct 25 23:54:44 2002
                                  vienna

URGENT:
    SysDown
        Report systems down or off the network

        paris6 is down, or off the network

The script follows.

#if piktmaster

SysDown

        init
                status =piktstatus
                level =piktlevel
                task "Report systems down or off the network"
                input proc "=piktc -L +H all"
                dat $host 1

        begin
                set $timeout = "30"     // yes, string var here

        rule    // report if system doesn't respond to ping
#  if linux
                if $command("=ping -c 1 $host | =tail -2 | =head -1") =~
                            " 0% packet loss"
#  elif solaris
                if $command("=ping $host $timeout") =~ "is alive"
#  endif
                        // do nothing
                else
                        output mail "$host is down, or off the network"
                endif

#endif  // piktmaster

For a more generalized script macro version of this system downage script, and one written in a more "modern" PIKT style (versions 1.19.0 and later), see Systems Down Macro.

This is just one program example.  You could add rules, or write new scripts, for example to:  report down system revivals, report system reboots, remove /var/crash files, log uptime data, etc.

For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
iptables firewall
script config file