# Configuration file for sysmon. # # Comments are lines beginning with pound signs like this one. Comments # can't start in the middle of a line. # # This file uses a format somewhat borrowed from BIND 8's named.conf # format. The file consists of multiple sections; each section begins with # a keyword followed by an opening brace and ends with a closing brace. # Within each section, directives look like this: # directive [param [param...]]; # Whitespace is ignored before and after separators (semicolons, braces, # etc). Any kind of whitespace has the same meaning (so you could put # everything in this file on one line, if you really wanted to). # # All directives and parameters are case-insensitive, though in the case of # names and strings, case will be preserved. ########################################################################### # # Built-in functions. # # These functions return information about various things, and are # typically used in output directives. Functions return strings or # integers as indicated. # # string strftime("") # Return the current time on the current system according to # the given format string, just like strftime(3). # # int connectstatus() # Returns the connection status of the current action: 0 for # failure, 1 for success. # # int connectdelay() # Returns the time in milliseconds between when a connection # was initiated and when it was closed (successfully or # unsuccessfully). # # int getstate([]) # Returns the state of the given action, or the current # action if none is given. # # string getmessage() # Returns the message from the given action. # # int scrwidth() # Return the width of the screen. # # int scrheight() # Return the height of the screen. # # int winwidth([]) # Return the usable width of the window with the given name, # or the current window if no window name is given. # # int winheight([]) # Return the usable height of the window with the given name, # or the current window if no window name is given. # # # int active() # Return 1 if there is a connection established to the given # server, else 0. # # int uptime() # Return the uptime for the given server in seconds. # # string uptime_s([, {days | hhmm | mins}]) # Return the uptime for the given server. With a second # parameter, returns one of the following strings: # days {%d day[s], |} # Returns the empty string if uptime < 1 day. # hhmm %2d:%02d # mins {%2d:%02d|%2d min} # Returns the latter string if # (uptime % 86400) < 60 minutes. # Without a parameter, returns the "days" string followed by # the "mins" string. # # int load(, ) # Return the 1-, 5-, or 15-minute load average for the given # server, multiplied by 100. # # string load_s(, ) # Return the 1-, 5-, or 15-minute load average for the given # server in "%.2f" format. # # int nusers() # Return the number of users currently on the server, or -1 # if the number cannot be retrieved from the server. # # string nusers_s() # Return the number of users currently on the server, or "???" # if the number cannot be retrieved from the server. # # int nprocs() # Return the number of processes currently on the server. # # int memory(, ) # Return information on system memory in kilobytes, according # to : # memtotal Total amount of physical RAM. # memfree Amount of available RAM. # memused Amount of RAM used (memtotal-memfree). # shared Amount of shared RAM in use. # buffers Amount of RAM used by I/O buffers. # cached Amount of RAM used by disk caches. # realfree Amount of potentially free RAM; i.e. # (memfree+buffers+cached). # realused (memtotal-realfree) # swaptotal Total amount of swap memory. # swapfree Amount of available swap memory. # swapused Amount of swap used (swaptotal-swapfree). # # int disk(, , ) # Return information on filesystems on the server, according # to : # blocks Total number of blocks in the # filesystem, expressed in kilobytes. # bused Number of blocks used by files. # bfree Number of blocks available (blocks-bfree). # breserved Number of blocks reserved for the # superuser (or other special user). # userblocks Number of blocks in the filesystem # available to normal users. Equal # to the larger of (blocks-userblocks) # and (bused). # userbfree Number of free blocks in the filesystem # available to normal users. # inodes Total number of inodes on the # filesystem (i.e. maximum number of # files that can be created). # iused, Like the equivalent bXXX, but for # ifree, inodes. # ireserved, # userinodes, # userifree # ########################################################################### # # Expressions. # # Wherever a value is required, an expression can be used. Expressions are # constructed much like C expressions, using any of the following operators # (grouped by precedence, with higher precedence to the left): # # *,/,% +,- <<,>> ~ & ^ | ==,!=,<,<=,>,>= ! && || # # Within a precedence group, operators are evaluated from left to right. # Relational and logical operators evaluate to 1 for true and 0 for false. # # As an example, the expression "load(serverA,1) / 100" would compute the # integer portion of the one-minute load average on serverA. # # Certain operations can also be performed on strings. The six relational # operators function like the C strcmp() call; the logical AND, OR, and NOT # operators test whether the string is empty; and addition of strings is # really concatenation. Integers and strings can also be "added"; the # integer is first converted to a string, and the strings are then # concatenated. (However, integers and strings cannot be likewise # compared.) # ########################################################################### # # Conditional statements. # # Any directive in this file can be set to apply only conditionally using # C-like "if" clauses. Just like in C, the condition is an expression # should evaluate to either zero (false) or nonzero (true). If the result # of the expression is a string, then the expression is true if and only if # the string is nonempty. Braces are required on all if/else blocks, even # if there is only one directive inside # # As an example, making the color red if the one-minute load average on # serverA is at least 10.00 and white otherwise (see the "window" block # description for documentation on the "color" directive): # # if (load(serverA, 1) >= 1000) { # color red; # } else { # color white; # } # ########################################################################### ########################################################################### # # main: Basic controls for sysmon. # # This section controls sysmon's basic operation, and includes the list of # systems to monitor, among others. # # server [:], , [nickname] # Connect to the specified server. You cannot specify the # same server twice with different ports. The nickname, if # given, can be used later to refer to this server; the name # given as the parameter will always refer to this # server even if another nickname with the same name is # later defined. You MUST list here any server you plan to # get information from! # # email {from | to | subject}, "" # Set the defaults for E-mail from address, to address, and # subject. If not set here and not set in an "email" # directive later (see the "action" block), these will be # blank. main { server Bahamut, xxxxxxxxxxxxx; server palantir, xxxxxxxxxxxxx; email from, "sysmon@dragonfire.net"; email to, "achurch@dragonfire.net"; } ########################################################################### # # action: Define background actions to perform. # # The action block allows you to tell sysmon to do certain things at # certain times. Typically, these will be checks for existence of # processes, accessibility of services, etc. I hate writing documentation, # so read the directive descriptions and figure out the rest yourself. # # Directives: # # name # Assign a name to the action. This allows the action's # state (see below) to be used in other functions, such as # for display in windows. If not given, the action cannot be # externally referenced. # # check # Set the length of time between running the action. # # timeout # Set the length of time before a connection attempt times # out and returns failure. # # setstate # Sets the state of the action to the given number; this can # later be retrieved using the getstate() function. The # default state of an action before this directive is used is # zero. # # setmessage # Associates a string with the action; this can later be # retrieved using the getmessage() function. The default # string is the empty string. # # connect , [, , [, ]] # Attempt to connect to the given host and port. If only two # parameters are given, close the socket again immediately # and set the connection status (as returned by the # connectstatus() function) to 0 for failure or 1 for # success. If a third and fourth parameter are given, send # the string given as the third parameter and read as many # bytes as the length of the fourth parameter. If the read # data compares equal to the fourth parameter, set the # connection status to 1, else set it to 0. If a fifth # parameter is given and nonzero, continue to read data from # the socket until it closes before returning 1. action { name http_www; check 300000; timeout 30000; connect "206.161.150.2", 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else setstate -1; } action { name http_cgi; check 300000; timeout 30000; connect cgi.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual1; check 300000; timeout 30000; connect aganazza.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual2; check 300000; timeout 30000; connect achurch.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual3; check 300000; timeout 30000; connect fantasy.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual4; check 300000; timeout 30000; connect npc.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual5; check 300000; timeout 30000; connect ebola.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name http_virtual6; check 300000; timeout 30000; connect cogsdevl.dragonfire.net, 80, "GET /xyz HTTP/1.0\r\n\r\n", "HTTP/"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } ########################################################################### action { name ftp_Bahamut; check 300000; timeout 90000; connect Bahamut.dragonfire.net, 21, "quit\r\n", "220"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name ftp_palantir; check 300000; timeout 45000; connect palantir.dragonfire.net, 21, "quit\r\n", "220"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name smtp; check 300000; timeout 30000; connect mail.dragonfire.net, 25, "quit\r\n", "220"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } action { name pop3; check 300000; timeout 30000; connect mail.dragonfire.net, 110, "quit\r\n", "+OK"; if (connectstatus()) setstate connectdelay(); else if (getstate() >= 0) setstate -1; else setstate getstate()-1; } ########################################################################### # # window: Define a text window for interactive monitoring. # # When you use sysmon in interactive mode on a text console, this allows # you to define windows for viewing information and their contents. # # Definition directives: # # name # Assign a name to the window. This allows the window to be # later referenced by this name. If not given, the window # cannot be referenced by name. # # position , # Define the position of the window. The coordinates are in # characters, with (0,0) being the top-left corner of the # screen. Normally, these set the position of the top-left # corner of the window, but if they are negative, they will # set the bottom-right corner's position instead (where -0,-0 # is the bottom-right corner of the screen). The default is # to place the window's top-left corner at the leftmost free # column on the topmost available line with the greatest # width. # # size [], (REQUIRED) # Define the size of the window in characters. At least a # height must be given; the width defaults to the full screen # (or as much of it as is available) if not given. # # border {on | off} # Set whether the window has a border around it. If a border # is included, the usable window size will decrease by two # characters in each direction. The default is on. # # title "" # Define a title to place at the center of the top line of # the window. If not defined, no title is printed. If the # window is borderless (see the "border" directive), this # will remove one line from the effective height of the # window. # # wrap {on | off} # Set the action to take when text output reaches the right # edge of the window. If set to on, the text will wrap to # the next line; if set to off, any text past the right edge # will be discarded. The default is on. # # scroll {on | off} # Set the action to take when text output reaches the bottom # edge of the window. If set to on, the window will scroll # up to accomodate the new text; if set to off, any text past # the bottom edge will be discarded. The default is off. # # update # Set the frequency, in milliseconds, at which the window's # contents are refreshed. If zero, the window is not # refreshed except on user command. At each refresh, the # full list of output directives is re-executed in order. # # Output directives: # # clear # Clear the window. # # cursor , # Set the cursor position for the next output directive. The # coordinates are relative to the top-left drawable position # in the window (if the window has a border, this will be # indented one row and column from the real top-left corner), # which is (0,0). # # color [, ] # Set the foreground and optionally background colors for # drawing text. The color can be any of the following: # black, blue, green, cyan, red, magenta, # yellow, gray, grey, white # "gray" and "grey" are aliases for each other. The colors # default to white on black. If the background color is not # given, it remains unchanged. # # printf "" [, param...] # Outputs information, just like C's printf(). Parameters # can be literal strings or integers, or built-in functions. # # beep # Make the display beep in whatever way it does that. # # Miscellaneous directives: # # setstate , # Sets the status value for an action. (This lets the status # values for actions function more or less like global # variables.) Note that there is no locking between window # routines and actions setting the status value. window { name title; size ,1; border off; wrap off; scroll off; # Try to keep the clock display running smoothly update 25; cursor 0,0; printf "%s", strftime("%d %B %Y"); cursor (winwidth()-13)/2,0; printf "System Status"; cursor winwidth()-8,0; printf "%s", strftime("%H:%M:%S"); } window { name keys; size ,1; position 0,-1; border off; wrap off; scroll off; update 0; cursor 0,0; color white, black; printf "R"; color grey, black; printf ") Reboot server "; color white, black; printf "^R"; color grey, black; printf ") Hard-reboot server"; cursor winwidth()-7,7; color white, black; printf "q"; color grey, black; printf ") Quit"; } ########################################################################### window { name Bahamut; title "Bahamut"; position 0,1; size 40,6; border on; wrap off; scroll off; update 10000; clear; if (active(Bahamut) && uptime(Bahamut) > 0 && memory(Bahamut,memtotal) > 0) { bordercolor cyan, black; if (memory(Bahamut,realfree) < 8192 || memory(Bahamut,swapfree) < 8192 || load(Bahamut,1) >= 1600) titlecolor red, black; else if (memory(Bahamut,realfree) < 16384 || memory(Bahamut,swapfree) < 16384 || load(Bahamut,1) >= 800) titlecolor yellow, black; else titlecolor green, black; color white, black; cursor 0,0; printf "Up %s%s", uptime_s(Bahamut,days), uptime_s(Bahamut,hhmm); cursor winwidth()-18,0; if (memory(Bahamut,realfree) < 8192) color red; else if (memory(Bahamut,realfree) < 16384) color yellow; printf "Mem: %6d/%6d", memory(Bahamut,realused), memory(Bahamut,memtotal); color white; cursor 0,1; printf "Users: %s", nusers_s(Bahamut); cursor winwidth()-19,1; if (memory(Bahamut,swapfree) < 8192) color red; else if (memory(Bahamut,swapfree) < 16384) color yellow; printf "Swap: %6d/%6d", memory(Bahamut,swapused), memory(Bahamut,swaptotal); color white; cursor 0,2; printf "Procs: %d", nprocs(Bahamut); cursor 0,3; printf "Loads:"; if (load(Bahamut,1) >= 1600) color red; else if (load(Bahamut,1) >= 800) color yellow; printf " %5s", load_s(Bahamut,1); color white; if (load(Bahamut,5) >= 1600) color red; else if (load(Bahamut,5) >= 800) color yellow; printf " %5s", load_s(Bahamut,5); color white; if (load(Bahamut,15) >= 1600) color red; else if (load(Bahamut,15) >= 800) color yellow; printf " %5s", load_s(Bahamut,15); color white; } else { bordercolor grey, black; titlecolor grey, black; } } ########################################################################### window { name palantir; title "palantir"; position 40,1; size 40,6; border on; wrap off; scroll off; update 10000; clear; if (active(palantir) && uptime(palantir) > 0 && memory(palantir,memtotal) > 0) { bordercolor cyan, black; if (memory(palantir,realfree) < 8192 || memory(palantir,swapfree) < 8192 || load(palantir,1) >= 500) titlecolor red, black; else if (memory(palantir,realfree) < 16384 || memory(palantir,swapfree) < 16384 || load(palantir,1) >= 200) titlecolor yellow, black; else titlecolor green, black; color white, black; cursor 0,0; printf "Up %s%s", uptime_s(palantir,days), uptime_s(palantir,hhmm); cursor winwidth()-18,0; if (memory(palantir,realfree) < 8192) color red; else if (memory(palantir,realfree) < 16384) color yellow; printf "Mem: %6d/%6d", memory(palantir,realused), memory(palantir,memtotal); color white; cursor 0,1; printf "Users: %s", nusers_s(palantir); cursor winwidth()-19,1; if (memory(palantir,swapfree) < 8192) color red; else if (memory(palantir,swapfree) < 16384) color yellow; printf "Swap: %6d/%6d", memory(palantir,swapused), memory(palantir,swaptotal); color white; cursor 0,2; printf "Procs: %d", nprocs(palantir); cursor 0,3; printf "Loads:"; if (load(palantir,1) >= 500) color red; else if (load(palantir,1) >= 200) color yellow; printf " %5s", load_s(palantir,1); color white; if (load(palantir,5) >= 500) color red; else if (load(palantir,5) >= 200) color yellow; printf " %5s", load_s(palantir,5); color white; if (load(palantir,15) >= 500) color red; else if (load(palantir,15) >= 200) color yellow; printf " %5s", load_s(palantir,15); color white; } else { bordercolor grey, black; titlecolor grey, black; } } ########################################################################### window { name diskstat; title "Filesystem Status"; position 0,7; size 80,8; border on; wrap off; scroll off; update 10000; bordercolor cyan, black; titlecolor cyan, black; clear; cursor 0,0; if (active(Bahamut) && disk(Bahamut,"/",blocks) > 0) { if (disk(Bahamut,"/",bfreepct) <= 10 || disk(Bahamut,"/",ifreepct) <= 20) color red; else if (disk(Bahamut,"/",bfreepct) <= 20 || disk(Bahamut,"/",ifreepct) <= 35) color yellow; else color green; printf "Bahamut:/ "; if (disk(Bahamut,"/",bfreepct) <= 10) color red; else if (disk(Bahamut,"/",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(Bahamut,"/",bused), disk(Bahamut,"/",blocks), 100-disk(Bahamut,"/",bfreepct); if (disk(Bahamut,"/",ifreepct) <= 10) color red; else if (disk(Bahamut,"/",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(Bahamut,"/",iused), disk(Bahamut,"/",inodes), 100-disk(Bahamut,"/",ifreepct); } else { color grey; printf "Bahamut:/ Server down"; } cursor 0,1; if (active(palantir) && disk(palantir,"/",blocks) > 0) { if (disk(palantir,"/",bfreepct) <= 10 || disk(palantir,"/",ifreepct) <= 20) color red; else if (disk(palantir,"/",bfreepct) <= 20 || disk(palantir,"/",ifreepct) <= 35) color yellow; else color green; printf "palantir:/ "; if (disk(palantir,"/",bfreepct) <= 10) color red; else if (disk(palantir,"/",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(palantir,"/",bused), disk(palantir,"/",blocks), 100-disk(palantir,"/",bfreepct); if (disk(palantir,"/",ifreepct) <= 10) color red; else if (disk(palantir,"/",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(palantir,"/",iused), disk(palantir,"/",inodes), 100-disk(palantir,"/",ifreepct); } else { color grey; printf "palantir:/ Server down"; } cursor 0,2; if (active(palantir) && disk(palantir,"/home1",blocks) > 0) { if (disk(palantir,"/home1",bfreepct) <= 10 || disk(palantir,"/home1",ifreepct) <= 20) color red; else if (disk(palantir,"/home1",bfreepct) <= 20 || disk(palantir,"/home1",ifreepct) <= 35) color yellow; else color green; printf "/home1 "; if (disk(palantir,"/home1",bfreepct) <= 10) color red; else if (disk(palantir,"/home1",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(palantir,"/home1",bused), disk(palantir,"/home1",blocks), 100-disk(palantir,"/home1",bfreepct); if (disk(palantir,"/home1",ifreepct) <= 10) color red; else if (disk(palantir,"/home1",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(palantir,"/home1",iused), disk(palantir,"/home1",inodes), 100-disk(Bahamut,"/home1",ifreepct); } else { color grey; printf "/home1 Server down (Bahamut)"; } cursor 0,3; if (active(Bahamut) && disk(Bahamut,"/home2",blocks) > 0) { if (disk(Bahamut,"/home2",bfreepct) <= 10 || disk(Bahamut,"/home2",ifreepct) <= 20) color red; else if (disk(Bahamut,"/home2",bfreepct) <= 20 || disk(Bahamut,"/home2",ifreepct) <= 35) color yellow; else color green; printf "/home2 "; if (disk(Bahamut,"/home2",bfreepct) <= 10) color red; else if (disk(Bahamut,"/home2",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(Bahamut,"/home2",bused), disk(Bahamut,"/home2",blocks), 100-disk(Bahamut,"/home2",bfreepct); if (disk(Bahamut,"/home2",ifreepct) <= 10) color red; else if (disk(Bahamut,"/home2",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(Bahamut,"/home2",iused), disk(Bahamut,"/home2",inodes), 100-disk(Bahamut,"/home2",ifreepct); } else { color grey; printf "/home2 Server down (Bahamut)"; } cursor 0,4; if (active(Bahamut) && disk(Bahamut,"/home3",blocks) > 0) { if (disk(Bahamut,"/home3",bfreepct) <= 10 || disk(Bahamut,"/home3",ifreepct) <= 20) color red; else if (disk(Bahamut,"/home3",bfreepct) <= 20 || disk(Bahamut,"/home3",ifreepct) <= 35) color yellow; else color green; printf "/home3 "; if (disk(Bahamut,"/home3",bfreepct) <= 10) color red; else if (disk(Bahamut,"/home3",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(Bahamut,"/home3",bused), disk(Bahamut,"/home3",blocks), 100-disk(Bahamut,"/home3",bfreepct); if (disk(Bahamut,"/home3",ifreepct) <= 10) color red; else if (disk(Bahamut,"/home3",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(Bahamut,"/home3",iused), disk(Bahamut,"/home3",inodes), 100-disk(Bahamut,"/home3",ifreepct); } else { color grey; printf "/home3 Server down (Bahamut)"; } cursor 0,5; if (active(Bahamut) && disk(Bahamut,"/home4",blocks) > 0) { if (disk(Bahamut,"/home4",bfreepct) <= 10 || disk(Bahamut,"/home4",ifreepct) <= 20) color red; else if (disk(Bahamut,"/home4",bfreepct) <= 20 || disk(Bahamut,"/home4",ifreepct) <= 35) color yellow; else color green; printf "/home4 "; if (disk(Bahamut,"/home4",bfreepct) <= 10) color red; else if (disk(Bahamut,"/home4",bfreepct) <= 20) color yellow; else color white; printf "%8d/%8d blocks (%d%%) ", disk(Bahamut,"/home4",bused), disk(Bahamut,"/home4",blocks), 100-disk(Bahamut,"/home4",bfreepct); if (disk(Bahamut,"/home4",ifreepct) <= 10) color red; else if (disk(Bahamut,"/home4",ifreepct) <= 20) color yellow; else color white; printf "%6d/%6d inodes (%d%%) ", disk(Bahamut,"/home4",iused), disk(Bahamut,"/home4",inodes), 100-disk(Bahamut,"/home4",ifreepct); } else { color grey; printf "/home4 Server down (Bahamut)"; } } ########################################################################### window { name wwwstat; title "HTTP Server Status"; position 0,15; size 45,7; border on; wrap off; scroll off; update 500; clear; bordercolor cyan, black; titlecolor cyan, black; cursor 0,0; if (getstate(http_www) > 0) { color green; printf " Up "; if (getstate(http_www) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_www)/1000, (getstate(http_www)/10) % 100; } else if (getstate(http_www) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "www"; cursor 0,1; if (getstate(http_cgi) > 0) { color green; printf " Up "; if (getstate(http_cgi) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_cgi)/1000, (getstate(http_cgi)/10) % 100; } else if (getstate(http_cgi) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "cgi"; cursor 22,0; if (getstate(http_virtual1) > 0) { color green; printf " Up "; if (getstate(http_virtual1) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual1)/1000, (getstate(http_virtual1)/10) % 100; } else if (getstate(http_virtual1) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual1"; cursor 22,1; if (getstate(http_virtual2) > 0) { color green; printf " Up "; if (getstate(http_virtual2) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual2)/1000, (getstate(http_virtual2)/10) % 100; } else if (getstate(http_virtual2) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual2"; cursor 22,2; if (getstate(http_virtual3) > 0) { color green; printf " Up "; if (getstate(http_virtual3) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual3)/1000, (getstate(http_virtual3)/10) % 100; } else if (getstate(http_virtual3) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual3"; cursor 22,3; if (getstate(http_virtual4) > 0) { color green; printf " Up "; if (getstate(http_virtual4) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual4)/1000, (getstate(http_virtual4)/10) % 100; } else if (getstate(http_virtual4) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual4"; cursor 22,4; if (getstate(http_virtual5) > 0) { color green; printf " Up "; if (getstate(http_virtual5) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual5)/1000, (getstate(http_virtual5)/10) % 100; } else if (getstate(http_virtual5) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual5"; cursor 0,4; if (getstate(http_virtual6) > 0) { color green; printf " Up "; if (getstate(http_virtual6) >= 5000) color yellow; else color white; printf "%2d.%02ds ", getstate(http_virtual6)/1000, (getstate(http_virtual6)/10) % 100; } else if (getstate(http_virtual6) == 0) { color grey; printf " ??? ----- "; } else { color red; printf "DOWN ----- "; } color white; printf "virtual6"; } ########################################################################### window { name otherstat; title "Other Server Status"; position 45,15; size 35,7; border on; wrap off; scroll off; update 500; clear; bordercolor cyan, black; titlecolor cyan, black; cursor 0,0; if (getstate(ftp_Bahamut) > 0) { color green; printf " Up "; } else if (getstate(ftp_Bahamut) == 0) { color grey; printf " ??? "; } else { color red; printf "DOWN "; } color white; printf "FTP (Bahamut)"; cursor 0,1; if (getstate(ftp_palantir) > 0) { color green; printf " Up "; } else if (getstate(ftp_palantir) == 0) { color grey; printf " ??? "; } else { color red; printf "DOWN "; } color white; printf "FTP (palantir)"; cursor 0,2; if (getstate(smtp) > 0) { color green; printf " Up "; } else if (getstate(smtp) == 0) { color grey; printf " ??? "; } else { color red; printf "DOWN "; } color white; printf "SMTP"; cursor 0,3; if (getstate(pop3) > 0) { color green; printf " Up "; } else if (getstate(pop3) == 0) { color grey; printf " ??? "; } else { color red; printf "DOWN "; } color white; printf "POP3"; } ########################################################################### window { name "messages"; title "Messages"; position 0,22; size 80,15; border on; wrap on; scroll on; update 1000; bordercolor cyan, black; titlecolor cyan, black; if (getstate(http_www) < 0 && getstate(http_www) / -3 * -3 == getstate(http_www)) { setstate http_www, getstate(http_www)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "www"; color grey; printf " down\n"; beep; } if (getstate(http_cgi) < 0 && getstate(http_cgi) / -3 * -3 == getstate(http_cgi)) { setstate http_cgi, getstate(http_cgi)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "cgi"; color grey; printf " down\n"; beep; } if (getstate(http_virtual1) < 0 && getstate(http_virtual1) / -3 * -3 == getstate(http_virtual1)) { setstate http_virtual1, getstate(http_virtual1)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual1"; color grey; printf " down\n"; beep; } if (getstate(http_virtual2) < 0 && getstate(http_virtual2) / -3 * -3 == getstate(http_virtual2)) { setstate http_virtual2, getstate(http_virtual2)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual2"; color grey; printf " down\n"; beep; } if (getstate(http_virtual3) < 0 && getstate(http_virtual3) / -3 * -3 == getstate(http_virtual3)) { setstate http_virtual3, getstate(http_virtual3)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual3"; color grey; printf " down\n"; beep; } if (getstate(http_virtual4) < 0 && getstate(http_virtual4) / -3 * -3 == getstate(http_virtual4)) { setstate http_virtual4, getstate(http_virtual4)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual4"; color grey; printf " down\n"; beep; } if (getstate(http_virtual5) < 0 && getstate(http_virtual5) / -3 * -3 == getstate(http_virtual5)) { setstate http_virtual5, getstate(http_virtual5)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual5"; color grey; printf " down\n"; beep; } if (getstate(http_virtual6) < 0 && getstate(http_virtual6) / -3 * -3 == getstate(http_virtual6)) { setstate http_virtual6, getstate(http_virtual6)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); color grey; printf "HTTP server "; color red; printf "virtual5"; color grey; printf " down\n"; beep; } if (getstate(ftp_Bahamut) < 0 && getstate(ftp_Bahamut) / -3 * -3 == getstate(ftp_Bahamut)) { setstate ftp_Bahamut, getstate(ftp_Bahamut)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); printf "Bahamut FTP"; color grey; printf " server down\n"; beep; } if (getstate(ftp_palantir) < 0 && getstate(ftp_palantir) / -3 * -3 == getstate(ftp_palantir)) { setstate ftp_palantir, getstate(ftp_palantir)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); printf "palantir FTP"; color grey; printf " server down\n"; beep; } if (getstate(smtp) < 0 && getstate(smtp) / -3 * -3 == getstate(smtp)) { setstate smtp, getstate(smtp)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); printf "SMTP"; color grey; printf " server down\n"; beep; } if (getstate(pop3) < 0 && getstate(pop3) / -3 * -3 == getstate(pop3)) { setstate pop3, getstate(pop3)-1; color red; printf strftime("%d %b %H:%M:%S %Y "); printf "POP3"; color grey; printf " server down\n"; beep; } }