ipmon

ipmon

IPMON monitors when traffic was last logged on this system plus it can check
for events such as program failures and network problems.

It watches the Item Log, log/ALL, and displays those events specified in its
parameter table - generally tables/sys/MONITOR.

The syntax of the parameter file MONITOR is :
    ; comment
    ; For any embedded spaces, pls remember to use \s
    sbanner:--Delay\tService\tFile\n
    snothing:** Nothing in the Log **

    from:iproute    string:AP   ignore:PAP  time:15 log:
    from:iproute    string:REUTER   time:5:BEEP
    from:iproute    string:EXTEL    time:10:tracemsg days:1-6 hours:9.00-21:30
    ; do not check timeouts on INFO ...
    from:iproute    string:INFO show:"\QD  for \SN"
    from:iproute    string:AFP  title:"Agence France Press"

    spacer: (blank line)
    spacer:<hr>

    fbanner:--Flag\tMessage\n
    fnothing:Nothing in the Log

    flag:x:Error
    flag:s:Stop/Start

    ; create a file every time this is run and send it to destination statusMON
    ; this destination MUST be in the sys/USERS parameter file
    file:statusMON

    extra-fiphdr: (optional) FipHeader information for the output file.

    ; run a script every cycle
    script: (name of script in FipSeq)

    ; name of output file - if there is NO -N input switch
    newname: (FipSeq)

    ; run a script every time you get an error or a certain flag
    ; there can be 10 flags tracked
    allerrors: (scriptname)
    allforflag: (flag) : (scriptname)
        allforflag:u:/fip/local/zippyoff

    ; Run a specfic script every cycle if timed out
    ; (default is on transition only - ie when times out and when recovers)
    everytime:

    email-address:  (one or more addresses separated by a comma)    default: none
    email-queue:    under spool                 default: 2smtp
    email-extra:    (optional fipseq string to add to the FipHdr)   default: none
    email-top:  (optional fipseq string to add before any data) default: none
    email-tail: (optional fipseq string to add after any data)  default: none
    email-data: (yes/no)                    default: no

    error-message; (FipSeq)
    no-traffic-message: (FipSeq)
        replacement text for the log message if a service errors.
        FipHdrs ET - holds the title or searchname
            ES - number of seconds since the last item
            EM - number of mins since the last item
        eg  error-message:Service \ET has failed (\EM mins since the last one)
            no-traffic-message:No Traffic has arrived on Service \ET today

In this example, we first set up the banners for scans (sbanner) and flags
(fbanner), then setup default warning messages if nothing is found for that
scan or flag (snothing and fnothing).

For scans we look for items that program 'iproute' wrote. A search string,
ususally the agency but it could be any valid string is specified. Optionally a
timeout value in minutes can be applied. An optional 'ignore' string can be
specified to ignore certain lines.

Some strings like 'AP' appear as part words in keywords etc. So to be sure you
get only the AP service use :
    service:"AP    "
where a tab is after the AP and all enclosed in double quotes

If this time is exceeded, the line is flagged so. The program can optionally
beep or run a script ie :
        time:20:BEEP
    or  time:20:script
    which tries to run a script with parameters :
        script srchstring minutes-since itemtext
    or  script srchstring -1 NothingMessage

This timeout can be restricted to days of the week and/or hours of the day :
For days, either specify each day with a comma between or a dash for a range
(no embedded spaces pls). The day numbers are 1=sunday, 2=monday etc.
    days:1,2,3  for Sun, Mon and Tue
or  days:2-6    for weekdays

For Hours of the day :
    hours:(from)-(to)   where from and to are 24hour clock
    hours:12:20-22:00

To log the problems in the Fip Item Log, use the 'log:' subparameter.

Normally the rest of the line is printed but there may be a case where you want
to extract information from the line and only use one or two bits of it. This
is especially true when the complete FIP filename is provided eg :
Wed Feb 16 15:53:55 ipspool !i :
#ZI#SC:PSC#SU:PSC#FBIN#SN:MER2#DU:mono#SA:PUB03
To run this script every cycle if timed out rather than (default) on transition
only - ie when times out and when recovers - use the 'everytime:' parameter;
    everytime:

Use show to extract the information you require . If spaces are to be embedded,
use double quotes before and after the string.
        show:"\DU for \SN"
give        mono for MER2

Normally the second column is the search string but this can be replaced by the
Title keyword.

For flags (meaning the Item Log flags such as !x for failures, !i for incomings
etc) we specify just the first letter plus a description field.

For 'allerrors',  the script will be presented with four parameters :
If the error was :
    Sat Oct 11 17:52:16 ipbdcast (9911)  !x : Recv Error   131

    parameter1  date/time   Sat Oct 11 17:52:16
    parameter2  program     ipbdcast
    parameter3  system/port (9991)
    parameter4  message     Recv Error   131
Note that 'allerrors' works for all NEW traffic only. So if 'ipmon' is stopped
and restarted, any intermediate errors are ignored. This can be reversed by the
-A input switch to flag ALL errors in the log file, not just the new ones.

'allforflag' works exactly the same except there are 6 parameters
    parameter 1 'ERROR'
    parameter 2 the flag
    parameter 3 date/time as above etc etc

Input Options are (all optional) :
    -1 : single run then stop               default: continuous running
        (see also -N for output filename)
or
    -A : run the 'allerrors' script for all "!x" on restart. default: only new
ones
    -b : do NOT beep if timed out
        default: beep if the BEEP parameter has been specified.
    -d : daemon/service flag. Run in background to    default: no
        generate show files for IPSVCE.
        If there is no -N input switch, this leaves the file in x/MON.(name of
parameter file) forced uppercase.
        All screen formatting is ignored
    -h : output in HTML             default: daemon in HTML else plain
    -H : output in plain text           default: daemon in HTML else plain
    -L : Log file in /fip/log           default: /fip/log/ALL
        Use this for testing or looking at Syndication logs etc
    -N : output file name in FipSeq         default: name of parameter file
    -o : output folder
        default: /fip/x for -d daemon/service flag
        default: /fip/spool/2go for file:destination
            Note this is only used if there is a 'file' parameter
        default: none for normal running as the file is displayed and not saved
    -O : Start scan on this number of seconds off the minute. default:23
    -R : do NOT resolve hostnames              default: do
        This will resolve any hostnames in the DEST_REDUN file (if there is one)
    -t : sleep time in seconds between scans        default: 60 secs
    -z : use a different parameter file in tables/sys   default: MONITOR
        -f and -z are the same
    -v : print version number and exit

If 'ipmon' is being started by 'local/rc.fip' on reboot there is every chance
there will be no shell and no environment set - and in particular, no PATH. So
the full pathname of the script must be specified in the parameter file.

Version Control
;15t16  12oct97 added allerrors
    ;a 28apr98 WINNT inputs now work
    ;c 04nov99 added days and hours
    ;d 20nov99 added -A
    ;e/f/g 27nov00 added -L
    ;h-i 12apr02 added log
    ;j 05mar04 no of scans from 200 to 300
    ;k add extraFipheader
    ;l-n 06apr06 added -o for output folder
    ;o 01may07 allowed hours to go over midnight
    ;p-s 21may07 added script for flag: and allforflag:
    ;t1 added -1 single ;2 day bug - was mday ;3 bugette with allerrors ;4-5
21may12 -O added
    ;6 15jul13 allow script names with _ and - in program
    ;7 16aug16 when checking new log, do NOT zap old
    ;8-9 15nov16 added newname -N and no-fiphdr
    ;10 added send_email ;11-12 able to handle paths for program names
    ;13-14 sol10 and primary
    ;15 18aug23 added spacer:

(copyright) 2024 and previous years FingerPost Ltd.