Systems Up Macro
The systems_up_alarms_macros.cfg is a script macro for reporting when down systems revive (come back up).
systems_up(SYS) init status =piktstatus level =piktlevel task "Report revived down systems" input proc "(SYS)" dat $host 1 #ifdef debug rule output $host #endifdef rule // initialize up message set $upmsg = "$host is (back) up" rule // initialize the state set $state = "+" rule // ping the host // do the initial poll quickly if =pingfail($host, 1, 1) // if the first ping failed, try again with more // retries and longer timeouts if =pingfail($host, 3, 5) set $state = "-" fi fi rule if $state eq "+" output mail $upmsg fi
You might invoke the =systems_up() macro in your alarms.cfg file thusly:
#if piktmaster SysUp =systems_up(=piktc -L +H down) #endif
where 'down' is a host group of known down systems (specified in down_systems.cfg).
You might invoke the SysUp script in, for example, a PiktAdminInfo alarm group (specified in alerts.cfg) as a periodic reminder to remove revived systems from the down_systems.cfg #include file.
Output from this script might look like, for example:
INFO: SysUp Report revived down systems budapest is (back) up kiev is (back) up hotspare is (back) up
For more examples, see Samples.