Fresh Files Macro

The fresh_files_alarms_macros.cfg is a script macro to report fresh, or updated, files.

fresh_files(DIR, FILTYP, TYP, EXT, DAYS, BYPASS1, BYPASS2)
 
        init
                status =piktstatus
                level =piktlevel
                task "Report any recently updated (FILTYP) files"
                // currently, only show files d days old or less;
                // for finer granularity, with precision to hours or minutes,
                // we would have to code a much more complex script
                input proc "=find (DIR) (TYP) -name \\*.(EXT) -mtime -(DAYS)
                                               -exec ls -ld {} \\; 2>/dev/null"
        rule
                if $inline =~~ "(BYPASS1)"
                        next
                endif

        rule
                if $inline !~~ "(BYPASS2)"
                        output mail $inlin
                endif

        end
                quit

You might invoke the =fresh_files() macro in your alarms.cfg file thusly:

ACMEDATFreshFiles
        =fresh_files(=acmedatdir, ACME DAT, -type f, dat, 1,
                     ocs\.dat|iss\.dat|mss\.dat|kic\.dat, =nonesuch)

Output from the ACMEDATFreshFiles script might look like, for example:

NOTICE:
    ACMEDATFreshFiles
        Report any recently updated ACME DAT files

        -rw-r--r-- 1 acme coders  30115 Sep 12 08:44 /usr/local/acme/data/vps.dat
        -rw-r--r-- 1 acme coders 381048 Sep 12 02:18 /usr/local/acme/data/mss.dat

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
See how to
monitor
SNMP devices