Conducting a Test
Now it's time to push the envelope just a little bit. Visit alarms.cfg and review the DiskFullCritical script:
/////////////////////////////////////////////////////////////////////////// DiskFullCritical init status active level critical task "Report if disks are full" input proc "=dfk | =behead(1)" dat #cap $-1 dat $mount $ rule if #cap >= 100% output mail "Filesystem $mount is $text(100*#cap,0)% full" endif ///////////////////////////////////////////////////////////////////////////The macro =dfk is something you might have to adjust. PIKT macros are defined in macros.cfg or one of its #include files. You will find the =dfk definition in macros/unixcmds_macros.cfg:
dfk /usr/bin/df -kOn a Solaris system, this command will output a df display with the percent Capacity utilization figure in the second-from-the-last field as in
/dev/dsk/c0t0d0s3 492422 10616 432564 2% /varYou should substitute whatever command path is more appropriate for your OS (for example, /bin/bdf) as well as the command options that will yield the desired results (for example, omit the -k).
The =behead() macro, defined in the top-level macros.cfg, invokes the Unix sed command to chop off the first N lines of input, in this case 1.
You could just uncomment the line
// DiskFullCriticalin the Critical alerts stanza, but let's try something different. At the end of the starter alerts.cfg file you will find the Test alert. DiskFullCritical is already listed, and uncommented. Try reinstalling all of the alerts but this time with the +D test option:
/pikt/bin/piktc -iv +D test +A all +H mysystem processing mysystem... installing file(s)... Test.alt installed Debug.alt installed Critical.alt installedUnlike before, because by +D test you in effect set the test define to TRUE, the lines between the #ifdef test ... #endifdef were not bypassed, so piktc detected and installed Debug.alt, along with the other two.
Try running the Debug alerts at the command line:
/pikt/bin/pikt +A Test Filesystem /pub/comp_disk_23 is 100% fullOn our test system, PIKT has detected a full disk! More likely than not, on your system no disk is 100% full, and your pikt command yielded no output. Let's force the issue.
Edit the /pikt/lib/alerts/Test.alt file, changing the threshold from 100% to some lower figure, say 25%:
if #cap >= 25%Then rerun '/pikt/bin/pikt +A Test'. Did you get output this time? If you didn't, perhaps it's because you need to edit a command path in macros.cfg. Inspect the Test.log file:
cat /pikt/var/log/Test.log ... sh: line 1: /usr/bin/df: No such file or directory ...Ah, that's the problem! If so, fix the df command path in Test.alt (also in macros.cfg) and rerun the Test alert.
You could have changed the threshold in the alarms.cfg file, then reinstalled the Test alert, but sometimes it's easier to change the target .alt file directly. If you make a worthwhile change in your .alt file, be sure to reflect that change in the source .cfg file, otherwise you will clobber your change/fix the next time you reinstall.
When you are finished testing the DiskFullCritical script, delete the Test script and any of its auxiliary files with:
/pikt/bin/piktc -tv +D test +A Test +H mysystem processing mysystem... disabling alert(s)... Test disabled deleting file(s)... Test.alt deleted deleting file(s)... Test.hst deleted deleting file(s)... Test.log deletedIf you changed the threshold in the alarms.cfg file, remember to change it back to 100% now. Uncomment the line in the Critical alarms list
DiskFullCriticalThen reinstall all alerts with
/pikt/bin/piktc -iv +A all +H mysystem processing mysystem... installing file(s)... Debug.alt installed Critical.alt installedAs before, since test defaults to FALSE in defines.cfg and you have not overridden that with a +D test at the command line, the Test alert in alerts.cfg enclosed within the #ifdef test ... #endifdef is ignored.
prev page | 1st page | next page |