mon-commit Mailing List for mon (Page 4)
Brought to you by:
trockij
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(36) |
Jul
(21) |
Aug
(9) |
Sep
(1) |
Oct
(2) |
Nov
(12) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(4) |
Feb
(10) |
Mar
(5) |
Apr
(22) |
May
(17) |
Jun
(3) |
Jul
(4) |
Aug
(10) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(2) |
2006 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
(6) |
Oct
|
Nov
|
Dec
(2) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(22) |
Jun
(19) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
2008 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
|
Oct
(7) |
Nov
(1) |
Dec
|
2009 |
Jan
(2) |
Feb
(9) |
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2010 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(65) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jim T. <tr...@us...> - 2010-05-22 00:05:51
|
Update of /cvsroot/mon/mon-contrib/monitors/dnsbl In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv31207/dnsbl Log Message: Directory /cvsroot/mon/mon-contrib/monitors/dnsbl added to the repository |
From: Jim T. <tr...@us...> - 2010-02-25 00:04:35
|
Update of /cvsroot/mon/mon In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1776 Modified Files: Tag: mon-1-2-branch CHANGES Log Message: Index: CHANGES =================================================================== RCS file: /cvsroot/mon/mon/CHANGES,v retrieving revision 1.3.2.14 retrieving revision 1.3.2.15 diff -C2 -d -r1.3.2.14 -r1.3.2.15 *** CHANGES 6 Jan 2010 20:47:53 -0000 1.3.2.14 --- CHANGES 25 Feb 2010 00:04:24 -0000 1.3.2.15 *************** *** 1,4 **** --- 1,8 ---- $Id$ + Wed Feb 24 19:04:02 EST 2010 trockij + ---------------------------------------------- + + Wed Jan 6 15:46:15 EST 2010 trockij ---------------------------------------------- |
From: Jim T. <tr...@us...> - 2010-01-06 20:48:02
|
Update of /cvsroot/mon/mon In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30519 Modified Files: Tag: mon-1-2-branch CHANGES Log Message: updated doc to include all env vars passed to monitor and alert programs Index: CHANGES =================================================================== RCS file: /cvsroot/mon/mon/CHANGES,v retrieving revision 1.3.2.13 retrieving revision 1.3.2.14 diff -C2 -d -r1.3.2.13 -r1.3.2.14 *** CHANGES 28 Dec 2009 21:11:45 -0000 1.3.2.13 --- CHANGES 6 Jan 2010 20:47:53 -0000 1.3.2.14 *************** *** 1,4 **** --- 1,10 ---- $Id$ + Wed Jan 6 15:46:15 EST 2010 trockij + ---------------------------------------------- + + -updated list of environment variables passed to alerts and monitors + + Mon Dec 28 16:05:02 EST 2009 trockij ---------------------------------------------- |
From: Jim T. <tr...@us...> - 2010-01-06 20:48:01
|
Update of /cvsroot/mon/mon/doc In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30519/doc Modified Files: Tag: mon-1-2-branch mon.8 Log Message: updated doc to include all env vars passed to monitor and alert programs Index: mon.8 =================================================================== RCS file: /cvsroot/mon/mon/doc/mon.8,v retrieving revision 1.6.2.4 retrieving revision 1.6.2.5 diff -C2 -d -r1.6.2.4 -r1.6.2.5 *** mon.8 28 Dec 2009 21:11:46 -0000 1.6.2.4 --- mon.8 6 Jan 2010 20:47:53 -0000 1.6.2.5 *************** *** 302,306 **** an alert. - .TP .B MON_LAST_FAILURE --- 302,305 ---- *************** *** 316,319 **** --- 315,323 ---- .TP + .B MON_FIRST_SUCCESS + The time(2) of the first time this service check completed and found + no failures. + + .TP .B MON_DESCRIPTION The description of this service, as defined in the *************** *** 323,326 **** --- 327,338 ---- .TP + .B MON_GROUP + The hostgroup name. + + .TP + .B MON_SERVICE + The service name. + + .TP .B MON_DEPEND_STATUS The depend status, "o" if dependency failure, "1" otherwise. *************** *** 485,488 **** --- 497,505 ---- .TP + .B MON_FIRST_SUCCESS + The time(2) of the first time this service check completed and found + no failures. + + .TP .B MON_LAST_SUCCESS The time(2) of the last time this service passed. *************** *** 513,516 **** --- 530,538 ---- .TP + .B MON_ACK + If the alert has been acknowledged, this contains the textual comment + submitted. + + .TP .B MON_ALERTTYPE Has one of the following values: "failure", "up", "startup", |
From: Jim T. <tr...@us...> - 2009-12-28 21:11:57
|
Update of /cvsroot/mon/mon/clients In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29441/clients Modified Files: Tag: mon-1-2-branch monshow Log Message: see CHANGES for details Index: monshow =================================================================== RCS file: /cvsroot/mon/mon/clients/monshow,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** monshow 17 Apr 2005 07:42:26 -0000 1.3 --- monshow 28 Dec 2009 21:11:46 -0000 1.3.2.1 *************** *** 79,83 **** GetOptions (\%opt, "showall", "auth", "help", "full", "disabled", "rcfile=s", "login=s", "server=s", "port=i", "prot=s", ! "detail=s", "watch=s", "view=s") || usage; my $CGI; --- 79,83 ---- GetOptions (\%opt, "showall", "auth", "help", "full", "disabled", "rcfile=s", "login=s", "server=s", "port=i", "prot=s", ! "detail=s", "watch=s", "view=s", "fhist", "ahist") || usage; my $CGI; *************** *** 120,123 **** --- 120,125 ---- "full" => 0, "show-disabled" => 0, + "fhist" => 0, + "ahist" => 0, "bg" => "d5d5d5", "bg-ok" => "a0d0a0", *************** *** 150,153 **** --- 152,157 ---- $CF->{"full"} = 1 if ($opt{"full"}); $CF->{"detail"} = $opt{"detail"} if ($opt{"detail"} ne ""); + $CF->{"fhist"} = 1 if ($opt{"fhist"}); + $CF->{"ahist"} = 1 if ($opt{"ahist"}); $CF->{"host"} = $opt{"server"} if ($opt{"server"}); $CF->{"port"} = $opt{"port"} if ($opt{"port"}); *************** *** 174,181 **** } # # retrieve client status # ! my ($e, $st) = get_client_status ($what); if ($e ne "") --- 178,187 ---- } + my ($e, $st, $rows); + # # retrieve client status # ! ($e, $st) = get_client_status ($what); if ($e ne "") |
From: Jim T. <tr...@us...> - 2009-12-28 21:11:57
|
Update of /cvsroot/mon/mon/alert.d In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29441/alert.d Modified Files: Tag: mon-1-2-branch irc.alert Log Message: see CHANGES for details Index: irc.alert =================================================================== RCS file: /cvsroot/mon/mon/alert.d/irc.alert,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** irc.alert 17 Apr 2005 07:42:26 -0000 1.2 --- irc.alert 28 Dec 2009 21:11:46 -0000 1.2.2.1 *************** *** 23,26 **** --- 23,28 ---- # -p secs when showing detail, pause secs between # sending each line. secs may be fractional. + # -P port + # -e encrypt (ie use ssl) # # Jim Trocki, tr...@ar... *************** *** 46,54 **** use strict; use IO::Socket::INET; use Getopt::Std; use English; my %opt; ! getopts ("s:g:h:t:uTOjc:S:U:n:dN:p:", \%opt); my $CHAN = $opt{"c"} || "mon"; --- 48,57 ---- use strict; use IO::Socket::INET; + use IO::Socket::SSL; use Getopt::Std; use English; my %opt; ! getopts ("s:g:h:t:uTOjc:S:U:n:dN:p:P:e", \%opt); my $CHAN = $opt{"c"} || "mon"; *************** *** 59,62 **** --- 62,66 ---- my $PAUSE = $opt{"p"} || 0; my $TIMEOUT = 10; + my $PORT = $opt{"P"} || 6667; # *************** *** 83,91 **** # make the connection # ! my $s = new IO::Socket::INET ( ! "PeerAddr" => "$SERVER:6667", ! "Proto" => "tcp", ! "Timeout" => 10, ! ); die if (!defined $s); --- 87,104 ---- # make the connection # ! my $s; ! if ( $opt{"e"} ) { ! $s = new IO::Socket::SSL ( ! "PeerAddr" => "$SERVER:$PORT", ! "Proto" => "tcp", ! "Timeout" => 10, ! ); ! } else { ! $s = new IO::Socket::INET ( ! "PeerAddr" => "$SERVER:$PORT", ! "Proto" => "tcp", ! "Timeout" => 10, ! ); ! } die if (!defined $s); |
From: Jim T. <tr...@us...> - 2009-12-28 21:11:55
|
Update of /cvsroot/mon/mon/mon.d In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29441/mon.d Modified Files: Tag: mon-1-2-branch fping.monitor snmpvar.monitor Log Message: see CHANGES for details Index: fping.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/fping.monitor,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** fping.monitor 11 May 2007 01:00:26 -0000 1.3.2.1 --- fping.monitor 28 Dec 2009 21:11:46 -0000 1.3.2.2 *************** *** 119,122 **** --- 119,127 ---- } + elsif (/^\S+ error while sending ping: Network is unreachable/) + { + # nothing, this should have a corresponding "\S+ is unreachable" + } + else { Index: snmpvar.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/snmpvar.monitor,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** snmpvar.monitor 15 Nov 2004 14:45:19 -0000 1.2 --- snmpvar.monitor 28 Dec 2009 21:11:46 -0000 1.2.2.1 *************** *** 403,407 **** $VARLIST{$curhost}{$curvar}{'IDX'} = $1 if $param =~ /Index\s+(.+)$/i; $VARLIST{$curhost}{$curvar}{'GROUP'} = $VARDEF{$curvar}{'DEFGRP'}; ! $VARLIST{$curhost}{$curvar}{'GROUP'} = $1 if $param =~ /Group\s+(.+)$/i; } } # while(<CF>) --- 403,407 ---- $VARLIST{$curhost}{$curvar}{'IDX'} = $1 if $param =~ /Index\s+(.+)$/i; $VARLIST{$curhost}{$curvar}{'GROUP'} = $VARDEF{$curvar}{'DEFGRP'}; ! $VARLIST{$curhost}{$curvar}{'GROUP'} = $1 if $param =~ /Group\s+(\S+)/i; } } # while(<CF>) |
From: Jim T. <tr...@us...> - 2009-12-28 21:11:54
|
Update of /cvsroot/mon/mon/doc In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29441/doc Modified Files: Tag: mon-1-2-branch mon.8 moncmd.1 Added Files: Tag: mon-1-2-branch README.site-customization monfailures.1 skymon.1 Log Message: see CHANGES for details --- NEW FILE: README.site-customization --- mon.cgi has always been "customizable," in that the source was available and you were encouraged to substitute your own parameters (e.g., mon host, mon port, company logo, etc.). But this meant that with each new version, you had to go back and re-edit the source code. Not a big deal, but still something of a pain. As of v1.49, mon.cgi includes some features which are meant to facilitate these changes and make site-specific customizations easier to perform, especially as mon and mon.cgi continue to evolve. Creating Your Own Config File ----------------------------- Previous to v.1.49 of mon.cgi, you could customize the look of the page, but all customizations had to be done in the source itself. This has numerous disadvantages, so 1.49 introduces an *optional* config file which will be read only as necessary and will allow you to specify custom values for parameters without having to touch the source code each time. You can still edit the source each time if you want, but if you want to set up a config file, follow these steps: 1) Copy the config file (included with the mon.cgi distribution) config/mon.cgi.cf to a location of your choice. It's best to start with a sample config file, because the config file format is very simple, and it will give you a chance to see how it works and experiment with parameters. 2) Edit the mon.cgi source code to find the line that specifies the variable "$moncgi_config_file". Change the value to the filesystem path of your copy of your mon.cgi config file. 3) Now you can edit the config file and make changes at will. Every time you change the mtime of the file (e.g., by saving it in a text editor, or touch'ing the file), mon.cgi will re-read the config file and the changes will take effect. If there are errors in parsing the config file, they will go to STDERR, which in most setups will end up in your web server's error log. Look in the errors file if your config isn't working like you expect it to work. Adding A New Row And Custom Commands To The Command Button Bar -------------------------------------------------------------- Adding a new row to the command button bar, with corresponding custom commands, is quite a bit more involved than the relatively simple matter of changing a config file. If you've developed, or are interested in developing your own custom commands, however, this functionality might be just what you needed. In the following example, we add a command called "ack_all" to the button bar, and also add the routine to do the ack'ing. The actual guts of the ack_all routine aren't included, but the goal of these instructions is to give you enough to start off. The first step is to create your own moncgi_custom_print_bar function. A stub function exists in the mon.cgi code, and the below code shows you how you would put in your own function that has one button, labeled "Acknowledge All Failures". Sample moncgi_custom_print_bar subroutine: sub moncgi_custom_print_bar { # # This is a sample routine, which adds a third row to the # command table, with one command: "Acknowledge All Failures" # my ($face)= (@_); $webpage->print("<tr>\n"); $webpage->print("\t<td colspan=7 align=center><font FACE=\"$face\"><a href=$url?${monhost_and_port_args}command=ack_all>Acknowledge All Failures</a></font></td>\n"); $webpage->print("</tr>\n"); } The next step is to tell mon.cgi that you are using your own custom commands, by creating your own moncgi_custom_commands subroutine. Again, there is a sample function in the mon.cgi code which you can replace with your own. Sample moncgi_custom_commands subroutine: sub moncgi_custom_commands { if ($command eq "ack_all") { # # Set up the page # &setup_page("Acknowledge All Alarms"); # # Note: you would have to write the "ack all" # command yourself! &moncgi_ack_all; } else { # # We didn't find anything, return # return 0; } return 1; # we did find something, suppress further command processing } The last step is to create the actual subroutines which will do the custom work you want them to do (assuming you weren't just calling existing commands in a different way. In our example, this means we have to write a function that actually goes out and acks all existing failures. We won't do this here, but hopefully this gives you an idea of how to proceed. sub moncgi_ack_all { # # Here is where the actual code to do the "ack all" would go # } When future releases of mon.cgi come out, you can copy and paste your custom subroutines and be up and running with the new version in minimal time. At least, that is what this was designed for. --- NEW FILE: monfailures.1 --- .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH MONFAILURES 1 "September 4, 2009" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp <n> insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME monfailures \- Lists mon failures .SH SYNOPSIS .B monfailures .br .SH DESCRIPTION .PP \fBmonfailures\fP is a program that lists the latest mon failures. .SH SEE ALSO .BR mon (8), .BR monshow (1). .SH AUTHOR monfailures was written by Dario Minnucci (midget)<de...@mi...>. .PP This manual page was written by Dario Minnucci (midget) <de...@mi...>, for the Debian project (and may be used by others). --- NEW FILE: skymon.1 --- .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp <n> insert n+1 empty lines .\" for manpage-specific macros, see man(7) .TH "SKYMON" "1" "February 12, 2007" "Dario Minnucci <de...@mi...>" "" .SH "NAME" skymon \- "moncmd" interface to a SkyTel 2\-way pager .SH "DESCRIPTION" .PP .\" TeX users may be more comfortable with the \fB<whatever>\fP and .\" \fI<whatever>\fP escape sequences to invode bold face and italics, .\" respectively. \fBskymon\fP This is a "moncmd" interface to a SkyTel 2\-way pager. .PP It utilizes procmail filters and password authentication to do its trick. I would not call this a "secure" authentication mechanism, but in Marcus Ranum\-speak it is "really nice". Use at your own risk. .PP It would be even more "really nice" if this did SecureID or S/Key. .PP Also keep in mind that all queries and all results pass through the Great Wide Internet to get back to your pager. .PP Also keep in mind that this is more useful as an example for a DIY project than for anything else. .SH "OPERATION" Commands are sent via email with the following format: /password:command Commands are the following, and can only be used if they exist in the "allow" file: .TP .B eh Enable host .TP .B es Enable service .TP .B ew Enable watch .TP .B dh host reason Disable host .TP .B ds watch service reason Disable service .TP .B dw watch reason Disable watch .TP .B lf List failures .TP .B ld List disabled .PP The idea behind the brevity is that it's a pain to compose messages on that silly little keypad. .SH "SEE ALSO" .BR mon (8), .BR moncmd (1), .BR monshow (1) .SH "AUTHOR" skymon was written by Jim Trocki, <tr...@tr...> .PP This manual page was written by Dario Minnucci <de...@mi...>, for the Debian project (but may be used by others). Index: moncmd.1 =================================================================== RCS file: /cvsroot/mon/mon/doc/moncmd.1,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** moncmd.1 17 Apr 2005 07:42:27 -0000 1.2 --- moncmd.1 28 Dec 2009 21:11:46 -0000 1.2.2.1 *************** *** 65,73 **** on the command line, then commands will be taken from either standard input, or from ! the file specified by the -f parameter. If standard input is connected ! to a TTY and the -a option is supplied, then it will prompt for a password. ! If the -a option is supplied without the -f option and standard input is not a TTY, then the username and password are read from --- 65,73 ---- on the command line, then commands will be taken from either standard input, or from ! the file specified by the \-f parameter. If standard input is connected ! to a TTY and the \-a option is supplied, then it will prompt for a password. ! If the \-a option is supplied without the \-f option and standard input is not a TTY, then the username and password are read from *************** *** 79,83 **** for obvious security reasons. ! If the username is neither supplied by the -l parameter or through standard input, it is taken from the effective user ID of the --- 79,83 ---- for obvious security reasons. ! If the username is neither supplied by the \-l parameter or through standard input, it is taken from the effective user ID of the Index: mon.8 =================================================================== RCS file: /cvsroot/mon/mon/doc/mon.8,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -C2 -d -r1.6.2.3 -r1.6.2.4 *** mon.8 25 Jun 2007 13:10:07 -0000 1.6.2.3 --- mon.8 28 Dec 2009 21:11:46 -0000 1.6.2.4 *************** *** 257,261 **** .br \fC ! monitor fping.monitor -t 4000 -r 2 \fR .br --- 257,261 ---- .br \fC ! monitor fping.monitor \-t 4000 \-r 2 \fR .br *************** *** 264,268 **** .br \fC ! MONITOR_DIR/fping.monitor -t 4000 -r 2 smtp nntp ns \fR .br --- 264,268 ---- .br \fC ! MONITOR_DIR/fping.monitor \-t 4000 \-r 2 smtp nntp ns \fR .br *************** *** 1608,1612 **** period wd {Sun-Sat} alert mail.alert so...@yo... ! upalert mail.alert -u so...@yo... .fi --- 1608,1612 ---- period wd {Sun-Sat} alert mail.alert so...@yo... ! upalert mail.alert \-u so...@yo... .fi *************** *** 1648,1652 **** period wd {Sun-Sat} alert mail.alert so...@yo... ! upalert mail.alert -u so...@yo... .fi --- 1648,1652 ---- period wd {Sun-Sat} alert mail.alert so...@yo... ! upalert mail.alert \-u so...@yo... .fi |
From: Jim T. <tr...@us...> - 2009-12-28 21:11:54
|
Update of /cvsroot/mon/mon In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv29441 Modified Files: Tag: mon-1-2-branch CHANGES mon Log Message: see CHANGES for details Index: CHANGES =================================================================== RCS file: /cvsroot/mon/mon/CHANGES,v retrieving revision 1.3.2.12 retrieving revision 1.3.2.13 diff -C2 -d -r1.3.2.12 -r1.3.2.13 *** CHANGES 6 Jun 2007 11:46:17 -0000 1.3.2.12 --- CHANGES 28 Dec 2009 21:11:45 -0000 1.3.2.13 *************** *** 1,4 **** --- 1,31 ---- $Id$ + Mon Dec 28 16:05:02 EST 2009 trockij + ---------------------------------------------- + + -fix for fork() working but not exec() in call_alert, from Denis Choulette + + + Mon Nov 23 07:26:55 EST 2009 trockij + ---------------------------------------------- + + -applied patch to irc.alert from Pierre-Emmanuel André which supports + specifying the port number and also the use of SSL + + -from Dario Minnucci, documentation fixes and additions + + -fping parsing fix + + + Thu Jun 11 19:12:30 EDT 2009 trockij + ---------------------------------------------- + + -patch to snmpvar.monitor + Group and Index both read to the end-of-line and give confusing results + if both arguments are used. This patch will limit use white space to + limit Group. + from Doug Rice <air...@ve...> + + Changes between mon-1.2.0- and mon-1.2.0-release Wed Jun 6 07:45:35 EDT 2007 Index: mon =================================================================== RCS file: /cvsroot/mon/mon/mon,v retrieving revision 1.22.2.3 retrieving revision 1.22.2.4 diff -C2 -d -r1.22.2.3 -r1.22.2.4 *** mon 5 Dec 2007 17:54:55 -0000 1.22.2.3 --- mon 28 Dec 2009 21:11:45 -0000 1.22.2.4 *************** *** 3612,3618 **** if (!exec @args) { ! syslog ('err', "could not exec '@args': $!"); exit (1); } } --- 3612,3622 ---- if (!exec @args) { ! syslog ('err', "run_monitor: could not exec '@args': $!"); exit (1); } + + syslog ('err', + "run_monitor: (unreachable!) could not exec '@args': $!"); + exit(1); } *************** *** 5079,5086 **** if (!exec @execargs) { ! syslog ('err', "could not exec alert $alert: $!"); ! return undef; } ! exit; } --- 5083,5093 ---- if (!exec @execargs) { ! syslog ('err', "call_alert: could not exec alert $alert: $!"); ! exit(1); } ! ! syslog ('err', ! "call_alert: (unreachable!) could not exec alert $alert: $!"); ! exit (1); } |
From: Augie S. <as...@us...> - 2009-06-11 17:28:47
|
Update of /cvsroot/mon/mon/mon.d In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv22180 Modified Files: netappfree.monitor Log Message: Complain if host in args not in config file -- patch submitted by Aaron Grattafiori <aa...@di...> Index: netappfree.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/netappfree.monitor,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** netappfree.monitor 9 Jun 2004 05:18:04 -0000 1.1.1.1 --- netappfree.monitor 11 Jun 2009 17:28:42 -0000 1.2 *************** *** 94,97 **** --- 94,98 ---- @ERRS = (); %HOSTS = (); + %host_list = (); $COMM = $opt{"community"} || "public"; *************** *** 108,111 **** --- 109,136 ---- readcf ($CONFIG) || die "could not read config: $!\n"; + # Loop through the arguments before doing anything to make sure our host + # exists in the config file + + # Load arrays with file contents + open(FD, "<$CONFIG") || die "Can't open $CONFIG\n"; + @configvals = <FD>; + close(FD); + + # Get all the servers from the config file + foreach my $line (@configvals) { + if ($line =~ /^[a-zA-Z0-9]/) { + my $host = (split /\s+/ , $line)[0]; + $host_list{$host} = 1; + } + } + # Check to make sure supplied argument exists, if not.. add error + foreach $host (@ARGV) { + unless (exists $host_list{$host}) { + # log to screen for debug + push (@ERRS, "Error: $host was not found in config file $CONFIG !"); + $RET = 1 + } + } + foreach $host (@ARGV) { next if (!defined $FREE{$host}); *************** *** 113,117 **** if (!defined($s = new SNMP::Session (DestHost => $host, Timeout => $TIMEOUT, Community => $COMM, ! Retries => $RETRIES))) { $RET = ($RET == 1) ? 1 : 2; $HOSTS{$host} ++; --- 138,143 ---- if (!defined($s = new SNMP::Session (DestHost => $host, Timeout => $TIMEOUT, Community => $COMM, ! Retries => $RETRIES, ! Version => 1))) { $RET = ($RET == 1) ? 1 : 2; $HOSTS{$host} ++; *************** *** 277,281 **** Timeout => $TIMEOUT, Community => $COMM, ! Retries => $RETRIES))) { print STDERR "could not create session to $host: " . $SNMP::Session::ErrorStr, "\n"; next; --- 303,308 ---- Timeout => $TIMEOUT, Community => $COMM, ! Retries => $RETRIES, ! Version => 1))) { print STDERR "could not create session to $host: " . $SNMP::Session::ErrorStr, "\n"; next; |
From: Augie S. <as...@us...> - 2009-03-06 22:50:06
|
Update of /cvsroot/mon/mon/mon.d In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32075 Modified Files: raid.monitor Log Message: Adding another verify state to ignore. Index: raid.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/raid.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** raid.monitor 14 Nov 2008 21:31:46 -0000 1.1 --- raid.monitor 6 Mar 2009 22:49:47 -0000 1.2 *************** *** 5,12 **** --- 5,26 ---- # Works with Linux software RAID, 3ware's tw_cli tool, and Areca's areca_cli tool. # Augie Schwer <au...@co...> + # + # -D file Debug file; output will be appended to the specified as well as to STDOUT. + # use strict; use warnings; + use Getopt::Std; + + my %opt; + getopts ("D:", \%opt); + my $DEBUG = $opt{"D"} || 0; + if ($DEBUG) + { + open ( DEBUG , ">>$DEBUG" ) or die "Could not open debug file $DEBUG : $!"; + } + + my $MDSTAT= '/proc/mdstat'; my $TWCLI = `which tw_cli 2> /dev/null`; *************** *** 27,31 **** { print "Failure of one or more software RAID devices\n"; ! exit 1; } --- 41,53 ---- { print "Failure of one or more software RAID devices\n"; ! ! if ( $DEBUG ) ! { ! my $time = localtime(time); ! print DEBUG $time . " Failure of one or more software RAID devices\n"; ! print DEBUG $time . " $mdstat"; ! } ! ! exit 1; } *************** *** 42,47 **** { chomp $controller; ! @{$controllers{$controller}->{'failed_units'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^u' | awk {'print \$3'} | grep -v 'OK' | grep -v 'VERIFYING'`; ! @{$controllers{$controller}->{'failed_ports'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^p' | awk {'print \$2'} | grep -v 'OK' | grep -v 'VERIFYING'`; } --- 64,69 ---- { chomp $controller; ! @{$controllers{$controller}->{'failed_units'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^u' | awk {'print \$3'} | grep -v 'OK' | grep -v 'VERIFYING' | grep -v 'VERIFY-PAUSED'`; ! @{$controllers{$controller}->{'failed_ports'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^p' | awk {'print \$2'} | grep -v 'OK' | grep -v 'VERIFYING' | grep -v 'VERIFY-PAUSED'`; } *************** *** 52,55 **** --- 74,100 ---- { print "Failure of one or more of the hardware RAID devices.\n"; + + if ( $DEBUG ) + { + my $time = localtime(time); + print DEBUG $time . " Failure of one or more of the hardware RAID devices.\n"; + if ( @{$controllers{$controller}->{'failed_units'}} ) + { + print DEBUG $time . " Failed Units :\n"; + foreach my $failed_unit ( @{$controllers{$controller}->{'failed_units'}} ) + { + print DEBUG $time . " $failed_unit\n"; + } + } + if ( @{$controllers{$controller}->{'failed_ports'}} ) + { + print DEBUG $time . " Failed Ports :\n"; + foreach my $failed_port ( @{$controllers{$controller}->{'failed_ports'}} ) + { + print DEBUG $time . " $failed_port\n"; + } + } + } + exit 1; } *************** *** 65,68 **** --- 110,121 ---- { print "Failure of one or more of the hardware RAID devices.\n"; + + if ( $DEBUG ) + { + my $time = localtime(time); + print DEBUG $time . " Failure of one or more of the hardware RAID devices.\n"; + print DEBUG $time . " @failed_raid_sets\n"; + } + exit 1; } |
From: Jim T. <tr...@us...> - 2009-02-26 19:55:40
|
Update of /cvsroot/mon/mon-contrib/monitors/radius/radius.monitor.detailcheck In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12950 Added Files: radius.monitor.detailcheck Log Message: this actually is the right one --- NEW FILE: radius.monitor.detailcheck --- #!/usr/bin/perl # # An anal-retentive check of radius. We check to make sure that # we get an expected list of specially cooked items in the reply # that matches a predefined list and we alert if we don't see all # the items, or if any don't match, or if we get unexpected avpairs # in the reply. # # To use this: # # You first need to set up your radius servers to accept requests from # your mon host and test and verify that you can peform simple radius # authorizations using radclient before your proceed. See your radius # server documentation for details. # # 1) Create a special radius test user. I have 'mon' here, # but it's user configurable. Set the below vars to this name and # password. # # 2) Assign different attributes to return for this this user. The # minimum reccomended list is: # # Framed-IP-Address # Framed-IP-Netmask # Framed-Route # Framed-MTU # Filter-Id # # **You should set these all to some weird nonsensical values that # would not be in use in your network. The purpose is to make sure # that these values are being passed thru your radius unaltered.** # # 3) Insert the attributes and values you selected above into # the %refvars hash. This has to match what radius hands back, otherwise, # it will generate an alert. # # 4) Test by running this command and checking the output: # # ./radius.monitor.detailcheck serversecret serverhost1 serverhost2 .. # # You made need to adjust the path to radclient as well as where your local # radius dictionaries are kept. # # Mike Ireton # mi...@wi... # BEGIN { $TEMPFILE=`mktemp /tmp/radius.detailcheck.XXXXXX`; chomp($TEMPFILE); } END { unlink ($TEMPFILE); }; $RADCLIENT="/usr/bin/radclient"; $DICTIONARY="/etc/freeradius"; $USER="mon"; $PASS="yourpasswordhere"; $SECRET=shift; $ok=0; while ($SERVER = shift) { %refvars = ( 'Framed-IP-Address' => "192.168.255.1", 'Framed-MTU' => "1638", 'Service-Type' => "Framed-User", 'Framed-Protocol' => "PPP", 'Framed-Compression' => "Van-Jacobson-TCP-IP", 'Framed-IP-Netmask' => "255.248.240.224", 'Filter-Id' => "\"radiusdebug\"", 'Framed-Route' => "\"192.168.255.252/30\"", ); %skipvars = ( 'User-Name' => "any", 'CHAP-Password' => "any", 'Framed-Protocol' => "any", ); # First, test Access-Accept and returned variables open(FP,"|$RADCLIENT -d $DICTIONARY -r 2 -x $SERVER auth $SECRET > $TEMPFILE 2>&1"); print FP "User-Name = \"$USER\"\n"; print FP "Chap-Password = \"$PASS\"\n"; print FP "Framed-Protocol = PPP\n"; close(FP); open(RESULTS,"<$TEMPFILE"); do { $line=<RESULTS>; if($line =~ /radclient: no response from server/) { $ok=1; print "Server failed to respond: $SERVER\n"; next; } if($line =~ /rad_recv: Access-Reject/) { $ok=1; print "Server rejected test credentials: $SERVER\n"; next; } if($line =~ /Shared secret is incorrect/) { $ok=1; print "Server test failed on $SERVER: shared secret incorrect?\n"; next; } } until $line =~ /^rad_recv/; while ($line=<RESULTS>) { if ($line =~ /^\s+([-a-zA-Z]+)\s?=\s(.+)/ ) { $var=$1; $value=$2; if ( defined $refvars{$var} ) { if ( $refvars{$var} ne $value ) { push @mismatched,"got $var = $value, expected $var = " . $refvars{$var}; } delete $refvars{$var}; } else { push @unexpected,"$var = $value"; } } } close(RESULTS); if(( keys( %refvars ) != 0) || ( @mismatched !=0 ) || (@unexpected != 0)) { print "A server failed avresponse check: $SERVER\n"; $ok=1; }; foreach ( keys %refvars ) { print "\tFailed to receive avpair: " . " " . "$_ = " . $refvars{$_} . "\n"; } foreach ( @mismatched ) { print "\tFailed to match avpair: $_ \n"; } foreach ( @unexpected ) { print "\tUnexpected avpair: $_ \n"; } undef @mismatched; undef @unxepected; } exit $ok; |
From: Jim T. <tr...@us...> - 2009-02-26 19:22:09
|
Update of /cvsroot/mon/mon-contrib/monitors/radius/radius.monitor.detailcheck In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9258 Removed Files: radius.monitor.detailcheck Log Message: new one soon --- radius.monitor.detailcheck DELETED --- |
From: Jim T. <tr...@us...> - 2009-02-26 19:00:30
|
Update of /cvsroot/mon/mon-contrib/monitors/radius/radius.monitor.detailcheck In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7552/radius.monitor.detailcheck Added Files: radius.monitor.detailcheck radius.monitor.detailcheck.README Log Message: radius.monitor.detailcheck from Mike Ireton --- NEW FILE: radius.monitor.detailcheck --- #!/usr/bin/perl # # An anal-retentive check of radius. We check to make sure that # we get an expected list of specially cooked items in the reply # that matches a predefined list and we alert if we don't see all # the items, or if any don't match, or if we get unexpected avpairs # in the reply. # # To use this: # # You first need to set up your radius servers to accept requests from # your mon host and test and verify that you can peform simple radius # authorizations using radclient before your proceed. See your radius # server documentation for details. # # 1) Create a special radius test user. I have 'mon' here, # but it's user configurable. Set the below vars to this name and # password. # # 2) Assign different attributes to return for this this user. The # minimum reccomended list is: # # Framed-IP-Address # Framed-IP-Netmask # Framed-Route # Framed-MTU # Filter-Id # # **You should set these all to some weird nonsensical values that # would not be in use in your network. The purpose is to make sure # that these values are being passed thru your radius unaltered.** # # 3) Insert the attributes and values you selected above into # the %refvars hash. This has to match what radius hands back, otherwise, # it will generate an alert. # # 4) Test by running this command and checking the output: # # ./radius.monitor.detailcheck serversecret serverhost1 serverhost2 .. # # You made need to adjust the path to radclient as well as where your local # radius dictionaries are kept. # # Mike Ireton # mi...@wi... # BEGIN { $TEMPFILE=`mktemp /tmp/radius.detailcheck.XXXXXX`; chomp($TEMPFILE); } END { unlink ($TEMPFILE); }; $RADCLIENT="/usr/bin/radclient"; $DICTIONARY="/etc/freeradius"; $USER="mon"; $PASS="yourpasswordhere"; $SECRET=shift; $ok=0; while ($SERVER = shift) { %refvars = ( 'Framed-IP-Address' => "192.168.255.1", 'Framed-MTU' => "1638", 'Service-Type' => "Framed-User", 'Framed-Protocol' => "PPP", 'Framed-Compression' => "Van-Jacobson-TCP-IP", 'Framed-IP-Netmask' => "255.248.240.224", 'Filter-Id' => "\"radiusdebug\"", 'Framed-Route' => "\"192.168.255.252/30\"", ); %skipvars = ( 'User-Name' => "any", 'CHAP-Password' => "any", 'Framed-Protocol' => "any", ); # First, test Access-Accept and returned variables open(FP,"|$RADCLIENT -d $DICTIONARY -r 2 -x $SERVER auth $SECRET > $TEMPFILE 2>&1"); print FP "User-Name = \"$USER\"\n"; print FP "Chap-Password = \"$PASS\"\n"; print FP "Framed-Protocol = PPP\n"; close(FP); open(RESULTS,"<$TEMPFILE"); do { $line=<RESULTS>; if($line =~ /radclient: no response from server/) { $ok=1; print "Server failed to respond: $SERVER\n"; next; } if($line =~ /rad_recv: Access-Reject/) { $ok=1; print "Server rejected test credentials: $SERVER\n"; next; } if($line =~ /Shared secret is incorrect/) { $ok=1; print "Server test failed on $SERVER: shared secret incorrect?\n"; next; } } until $line =~ /^rad_recv/; while ($line=<RESULTS>) { if ($line =~ /^\s+([-a-zA-Z]+)\s?=\s(.+)/ ) { $var=$1; $value=$2; if ( defined $refvars{$var} ) { if ( $refvars{$var} ne $value ) { push @mismatched,"got $var = $value, expected $var = " . $refvars{$var}; } delete $refvars{$var}; } else { push @unexpected,"$var = $value"; } } } close(RESULTS); if(( keys( %refvars ) != 0) || ( @mismatched !=0 ) || (@unexpected != 0)) { print "A server failed avresponse check: $SERVER\n"; $ok=1; }; foreach ( keys %refvars ) { print "\tFailed to receive avpair: " . " " . "$_ = " . $refvars{$_} . "\n"; } foreach ( @mismatched ) { print "\tFailed to match avpair: $_ \n"; } foreach ( @unexpected ) { print "\tUnexpected avpair: $_ \n"; } undef @mismatched; undef @unxepected; } exit $ok; --- NEW FILE: radius.monitor.detailcheck.README --- radius.monitor.detailcheck README ================================= This is an anal-retentive check of radius to ensure that not only are your servers online, but that they are returning expected av pairs. This is a good extra additional check to be doing because configuration mistakes or database problems may create problems for radius that don't show up as a simple 'access-reject'. Since mon only passes simple command line params, and because we need more extensive configuration, you need to modify the script's configuration vars to suit your installation. The general idea is that you set it up with as many unique av pairs as you can, with values that do not match anything you're likely to ever legitimately assign elsewhere, and then this script checks to make sure that all av pairs are returned and ONLY these pairs are seen else it reports. Mike Ireton WillitsOnline Feb 13 2008 |
From: Jim T. <tr...@us...> - 2009-02-26 18:56:44
|
Update of /cvsroot/mon/mon-contrib/monitors/radius/radius.monitor.detailcheck In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6956/radius.monitor.detailcheck Log Message: Directory /cvsroot/mon/mon-contrib/monitors/radius/radius.monitor.detailcheck added to the repository |
From: Augie S. <as...@us...> - 2009-02-13 18:17:36
|
Update of /cvsroot/mon/mon-contrib/monitors/ipmi In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv30065 Modified Files: ipmi_mb_temp.monitor ipmi_proc1_temp.monitor ipmi_proc2_temp.monitor ipmi_psu_temp.monitor Log Message: Use the variable everywhere, not just some places. Index: ipmi_psu_temp.monitor =================================================================== RCS file: /cvsroot/mon/mon-contrib/monitors/ipmi/ipmi_psu_temp.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ipmi_psu_temp.monitor 12 Feb 2009 18:10:21 -0000 1.1 --- ipmi_psu_temp.monitor 13 Feb 2009 18:17:22 -0000 1.2 *************** *** 21,25 **** alarm $TIMEOUT; ! $temp = `ipmitool sdr type "Temp" | grep 'Power Cage' | cut -d"|" -f 5 | awk {'print \$1'}` }; --- 21,25 ---- alarm $TIMEOUT; ! $temp = `$ipmitool sdr type "Temp" | grep 'Power Cage' | cut -d"|" -f 5 | awk {'print \$1'}` }; Index: ipmi_proc2_temp.monitor =================================================================== RCS file: /cvsroot/mon/mon-contrib/monitors/ipmi/ipmi_proc2_temp.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ipmi_proc2_temp.monitor 12 Feb 2009 18:10:21 -0000 1.1 --- ipmi_proc2_temp.monitor 13 Feb 2009 18:17:22 -0000 1.2 *************** *** 21,25 **** alarm $TIMEOUT; ! $temp = `ipmitool sdr type "Temp" | grep 'Processor2' | cut -d"|" -f 5 | awk {'print \$1'}` }; --- 21,25 ---- alarm $TIMEOUT; ! $temp = `$ipmitool sdr type "Temp" | grep 'Processor2' | cut -d"|" -f 5 | awk {'print \$1'}` }; Index: ipmi_mb_temp.monitor =================================================================== RCS file: /cvsroot/mon/mon-contrib/monitors/ipmi/ipmi_mb_temp.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ipmi_mb_temp.monitor 12 Feb 2009 18:10:21 -0000 1.1 --- ipmi_mb_temp.monitor 13 Feb 2009 18:17:22 -0000 1.2 *************** *** 21,25 **** alarm $TIMEOUT; ! $temp = `ipmitool sdr type "Temp" | grep 'Baseboard' | cut -d"|" -f 5 | awk {'print \$1'}` }; --- 21,25 ---- alarm $TIMEOUT; ! $temp = `$ipmitool sdr type "Temp" | grep 'Baseboard' | cut -d"|" -f 5 | awk {'print \$1'}` }; Index: ipmi_proc1_temp.monitor =================================================================== RCS file: /cvsroot/mon/mon-contrib/monitors/ipmi/ipmi_proc1_temp.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ipmi_proc1_temp.monitor 12 Feb 2009 18:10:21 -0000 1.1 --- ipmi_proc1_temp.monitor 13 Feb 2009 18:17:22 -0000 1.2 *************** *** 21,25 **** alarm $TIMEOUT; ! $temp = `ipmitool sdr type "Temp" | grep 'Processor1' | cut -d"|" -f 5 | awk {'print \$1'}` }; --- 21,25 ---- alarm $TIMEOUT; ! $temp = `$ipmitool sdr type "Temp" | grep 'Processor1' | cut -d"|" -f 5 | awk {'print \$1'}` }; |
Update of /cvsroot/mon/mon-contrib/monitors/ipmi In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2465/ipmi Added Files: ipmi_fan.monitor ipmi_mb_temp.monitor ipmi_power_unit.monitor ipmi_proc1_temp.monitor ipmi_proc2_temp.monitor ipmi_psu_temp.monitor Log Message: Some basic IPMI monitoring using ipmitool --- NEW FILE: ipmi_mb_temp.monitor --- #!/usr/bin/perl # # ipmi_mb_temp.monitor # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my $temp; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; $temp = `ipmitool sdr type "Temp" | grep 'Baseboard' | cut -d"|" -f 5 | awk {'print \$1'}` }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } print "Success!\n"; exit $temp; --- NEW FILE: ipmi_proc2_temp.monitor --- #!/usr/bin/perl # # ipmi_proc2_temp.monitor # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my $temp; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; $temp = `ipmitool sdr type "Temp" | grep 'Processor2' | cut -d"|" -f 5 | awk {'print \$1'}` }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } print "Success!\n"; exit $temp; --- NEW FILE: ipmi_proc1_temp.monitor --- #!/usr/bin/perl # # ipmi_proc1_temp.monitor # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my $temp; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; $temp = `ipmitool sdr type "Temp" | grep 'Processor1' | cut -d"|" -f 5 | awk {'print \$1'}` }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } print "Success!\n"; exit $temp; --- NEW FILE: ipmi_fan.monitor --- #!/usr/bin/perl # # ipmi_fan.monitor # Uses ipmi to check for failed fans. # For use with mon. # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my @fan_unit_fail; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; @fan_unit_fail = `$ipmitool sdr type "Fan" | grep lcr`; }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } if ( @fan_unit_fail ) { print "A fan has failed\n"; exit 1; } print "Success!\n"; exit 0; --- NEW FILE: ipmi_psu_temp.monitor --- #!/usr/bin/perl # # ipmi_psu_temp.monitor # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my $temp; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; $temp = `ipmitool sdr type "Temp" | grep 'Power Cage' | cut -d"|" -f 5 | awk {'print \$1'}` }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } print "Success!\n"; exit $temp; --- NEW FILE: ipmi_power_unit.monitor --- #!/usr/bin/perl # # ipmi_power_unit.monitor # Uses ipmi to check for failed power supplies. # For use with mon. # # Augie Schwer <au...@co...> use strict; use warnings; use English; my $TIMEOUT = 5; my $ipmitool = `which ipmitool 2> /dev/null`; chomp $ipmitool; my @power_unit_fail; eval { local $SIG{ALRM} = sub { die "timeout" }; alarm $TIMEOUT; @power_unit_fail = `$ipmitool sdr type "Power Unit" | grep "Redundancy Lost"`; }; alarm(0); if ($EVAL_ERROR =~ /^timeout/) { print "ipmitool timed out.\n"; exit 1; } if ( @power_unit_fail ) { print "A power unit has failed\n"; exit 1; } print "Success!\n"; exit 0; |
From: Augie S. <as...@us...> - 2009-02-12 18:09:48
|
Update of /cvsroot/mon/mon-contrib/monitors/ipmi In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2104/ipmi Log Message: Directory /cvsroot/mon/mon-contrib/monitors/ipmi added to the repository |
From: Augie S. <as...@us...> - 2009-01-19 18:42:24
|
Update of /cvsroot/mon/mon-contrib/monitors/ssl In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17672/ssl Added Files: ssl-cert-check Log Message: Adding ssl/ssl-cert-check to the contrib. tree. --- NEW FILE: ssl-cert-check --- #!/bin/bash # # Program: SSL Certificate Check <ssl-cert-check> # # Source code home: http://prefetch.net/code/ssl-cert-check # # Author: Matty < matty91 at gmail dot com > # # Current Version: 3.14 # # Revision History: # # Version 3.14 # - Fixed the Common Name parser to handle DN's where the CN is not the last item # eg. EmailAddr -- Jason Brothers # - Added the ability to grab the serial number -- Jason Brothers # - Added the "-b" option to print results without a header -- Jason Brothers # - Added the "-v" option for certificate validation -- Jason Brothers # # Version 3.13 # - Updated the subject line to include the hostname as well as # the common name embedded in the X509 certificate (if it's # available) -- idea proposed by Mike Burns # # Version 3.12 # - Updated the license to allow redistribution and modification # # Version 3.11 # - Added ability to comment out lines in files passed # to the "-f" option -- Brett Stauner # - Fixed comment next to file processing logic # # Version 3.10 # - Fixed POP3 port -- Simon Matter # # Version 3.9 # - Switched binary location logic to use which utility # # Version 3.8 # - Fixed display on 80 column displays # - Cleaned up the formatting # # Version 3.7 # - Fixed bug in NAGIOS tests -- Ben Allen # # Version 3.6 # - Added support for certificates stored in PKCS#12 databases -- Ken Gallo # - Cleaned up comments # - Adjusted variables to be more consistent # # Version 3.5 # - Added support for NAGIOS -- Quanah Gibson-Mount # - Added additional checks for mail -- Quanah Gibson-Mount # - Convert tabs to spaces -- Quanah Gibson-Mount # - Cleaned up usage() routine # - Added additional checks for openssl # # Version 3.4 # - Added a missing "{" to line 364 -- Ken Gallo # - Move mktemp to the start of the main body to avoid errors # - Adjusted default binary paths to make sure the script just works # w/ Solaris, BSD and Linux hosts # # Version 3.3 # - Added common name from X.509 certificate file to E-mail body / header -- Doug Curtis # - Fixed several documentation errors # - Use mktemp to create temporary files # - Convert printf, sed and awk to variables # - Check for printf, sed, awk and mktemp binaries # - Add additional logic to make sure mktemp returned a valid temporary file # # Version 3.2 # - Added option to list certificates in the file passed to "-f". # # Version 3.1 # - Added handling for starttls for smtp -- Marco Amrein # - Added handling for starttls for pop3 (without s) -- Marco Amrein # - Removed extra spacing at end of script # # Version 3.0 # - Added "-i" option to print certificate issuer # - Removed $0 from Subject line of outbound e-mails # - Fixed some typographical errors # - Removed redundant "-b" option # # Version 2.0 # - Fixed an issue with e-mails formatting incorrectly # - Added additional space to host column -- Darren-Perot Spruell # - Replaced GNU date dependency with CHRIS F. A. JOHNSON's # date2julian shell function. This routine can be found on # page 170 of Chris's book "Shell Scripting Recipes: A # Problem-Solution Approach," ISBN #1590594711. Julian function # was created based on a post to comp.unix.shell by Tapani Tarvainen. # - Cleaned up function descriptions # - Removed several lines of redundant code # - Adjusted the help message # # Version 1.1 # - Added "-c" flag to report expiration status of a PEM encoded # certificate -- Hampus Lundqvist # - Updated the prints messages to display the reason a connection # failed (connection refused, connection timeout, bad cert, etc) # - Updated the GNU date checking routines # - Added checks for each binary required # - Added checks for connection timeouts # - Added checks for GNU date # - Added a "-h" option # - Cleaned up the documentation # # Version 1.0 # Initial Release # # Last Updated: 05-06-2008 # # Purpose: # ssl-cert-check checks to see if a digital certificate in X.509 format # has expired. ssl-cert-check can be run in interactive and batch mode, # and provides facilities to alarm if a certificate is about to expire. # # License: # Copyright (C) 2007 Ryan Matteson <matty91 at gmail dot com> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Requirements: # Requires openssl # # Installation: # Copy the shell script to a suitable location # # Tested platforms: # -- Solaris 9 using /bin/bash # -- Solaris 10 using /bin/bash # -- OS X 10.4.2 using /bin/sh # -- OpenBSD using /bin/sh # -- FreeBSD using /bin/sh # -- Redhat advanced server 3.0MU3 using /bin/sh # # Usage: # Refer to the usage() sub-routine, or invoke ssl-cert-check # with the "-h" option. # # Examples: # Please refer to the following site for documentation and # examples: # http://prefetch.net/articles/checkcertificate.html # PATH=/bin:/usr/bin:/usr/local/bin:/usr/local/ssl/bin:/usr/sfw/bin ; export PATH # Who to page when an expired certificate is detected (cmdline: -e) ADMIN="root" # Number of days in the warning threshhold (cmdline: -x) WARNDAYS=30 # If QUIET is set to TRUE, don't print anything on the console (cmdline: -q) QUIET="FALSE" # Don't send E-mail by default (cmdline: -a) ALARM="FALSE" # Don't run as a Nagios plugin by default (cmdline: -n) NAGIOS="FALSE" # NULL out the PKCSDBPASSWD variable for later use (cmdline: -k) PKCSDBPASSWD="" # Location of system binaries AWK=$(which awk) DATE=$(which date) GREP=$(which grep) OPENSSL=$(which openssl) PRINTF=$(which printf) SED=$(which sed) MKTEMP=$(which mktemp) if [ -f /usr/bin/mailx ] then MAIL="/usr/bin/mailx" else MAIL=$(which mail) fi # Return code used by nagios. Initialize to 0. RETCODE=0 # Set the default umask to be somewhat restrictive umask 077 ############################################################################# # Purpose: Convert a date from MONTH-DAY-YEAR to Julian format # Acknowledgements: Code was adapted from examples in the book # "Shell Scripting Recipes: A Problem-Solution Approach" # ( ISBN 1590594711 ) # Arguments: # $1 -> Month (e.g., 06) # $2 -> Day (e.g., 08) # $3 -> Year (e.g., 2006) ############################################################################# date2julian() { if [ "${1} != "" ] && [ "${2} != "" ] && [ "${3}" != "" ] then ## Since leap years add aday at the end of February, ## calculations are done from 1 March 0000 (a fictional year) d2j_tmpmonth=$((12 * ${3} + ${1} - 3)) ## If it is not yet March, the year is changed to the previous year d2j_tmpyear=$(( ${d2j_tmpmonth} / 12)) ## The number of days from 1 March 0000 is calculated ## and the number of days from 1 Jan. 4713BC is added echo $(( (734 * ${d2j_tmpmonth} + 15) / 24 - 2 * ${d2j_tmpyear} + ${d2j_tmpyear}/4 - ${d2j_tmpyear}/100 + ${d2j_tmpyear}/400 + $2 + 1721119 )) else echo 0 fi } ############################################################################# # Purpose: Convert a string month into an integer representation # Arguments: # $1 -> Month name (e.g., Sep) ############################################################################# getmonth() { case ${1} in Jan) echo 1 ;; Feb) echo 2 ;; Mar) echo 3 ;; Apr) echo 4 ;; May) echo 5 ;; Jun) echo 6 ;; Jul) echo 7 ;; Aug) echo 8 ;; Sep) echo 9 ;; Oct) echo 10 ;; Nov) echo 11 ;; Dec) echo 12 ;; *) echo 0 ;; esac } ############################################################################# # Purpose: Calculate the number of seconds between two dates # Arguments: # $1 -> Date #1 # $2 -> Date #2 ############################################################################# date_diff() { if [ "${1}" != "" ] && [ "${2}" != "" ] then echo $((${2} - ${1})) else echo 0 fi } ##################################################################### # Purpose: Print a line with the expiraton interval # Arguments: # $1 -> Hostname # $2 -> TCP Port # $3 -> Status of certification (e.g., expired or valid) # $4 -> Date when certificate will expire # $5 -> Days left until the certificate will expire # $6 -> Issuer of the certificate ##################################################################### prints() { if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] then MIN_DATE=$(echo $4 | ${AWK} '{ print $1, $2, $4 }') ${PRINTF} "%-35s %-17s %-8s %-11s %-4s %-30s\n" "$1:$2" "$6" "$3" "$MIN_DATE" "$5" elif [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] then ${PRINTF} "%-35s %-35s %-32s %-17s\n" "$1:$2" "$7" "$8" "$6" elif [ "${QUIET}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] then MIN_DATE=$(echo $4 | ${AWK} '{ print $1, $2, $4 }') ${PRINTF} "%-47s %-12s %-12s %-4s %-30s\n" "$1:$2" "$3" "$MIN_DATE" "$5" elif [ "${QUIET}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] then ${PRINTF} "%-35s %-35s %-32s\n" "$1:$2" "$7" "$8" fi } #################################################### # Purpose: Print a heading with the relevant columns # Arguments: # None #################################################### print_heading() { if [ "${NOHEADER}" != "TRUE" ] then if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] then ${PRINTF} "\n%-35s %-17s %-8s %-11s %-4s\n" "Host" "Issuer" "Status" "Expires" "Days" echo "----------------------------------- ----------------- -------- ----------- ----" elif [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] then ${PRINTF} "\n%-35s %-35s %-32s %-17s\n" "Host" "Common Name" "Serial #" "Issuer" echo "----------------------------------- ----------------------------------- -------------------------------- -----------------" elif [ "${QUIET}" != "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] then ${PRINTF} "\n%-47s %-12s %-12s %-4s\n" "Host" "Status" "Expires" "Days" echo "----------------------------------------------- ------------ ------------ ----" elif [ "${QUIET}" != "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] then ${PRINTF} "\n%-35s %-35s %-32s\n" "Host" "Common Name" "Serial #" echo "----------------------------------- ----------------------------------- --------------------------------" fi fi } ########################################## # Purpose: Describe how the script works # Arguments: # None ########################################## usage() { echo "Usage: $0 [ -e email address ] [ -x days ] [-q] [-a] [-b] [-h] [-i] [-n] [-v]" echo " { [ -s common_name ] && [ -p port] } || { [ -f cert_file ] } || { [ -c certificate file ] }" echo "" echo " -a : Send a warning message through E-mail" echo " -b : Will not print header" echo " -c cert file : Print the expiration date for the PEM or PKCS12 formatted certificate in cert file" echo " -e E-mail address : E-mail address to send expiration notices" echo " -f cert file : File with a list of FQDNs and ports" echo " -h : Print this screen" echo " -i : Print the issuer of the certificate" echo " -k password : PKCS12 file password" echo " -n : Run as a Nagios plugin" echo " -p port : Port to connect to (interactive mode)" echo " -s commmon name : Server to connect to (interactive mode)" echo " -q : Don't print anything on the console" echo " -v : Only print validation data" echo " -x days : Certificate expiration interval (eg. if cert_date < days)" echo "" } ########################################################################## # Purpose: Connect to a server ($1) and port ($2) to see if a certificate # has expired # Arguments: # $1 -> Server name # $2 -> TCP port to connect to ########################################################################## check_server_status() { if [ "_${2}" = "_smtp" -o "_${2}" = "_25" ] then TLSFLAG="-starttls smtp" elif [ "_${2}" = "_pop3" -o "_${2}" = "_110" ] then TLSFLAG="-starttls pop3" else TLSFLAG="" fi echo "" | ${OPENSSL} s_client -connect ${1}:${2} ${TLSFLAG} 2> ${ERROR_TMP} 1> ${CERT_TMP} if ${GREP} -i "Connection refused" ${ERROR_TMP} > /dev/null then prints ${1} ${2} "Connection refused" "Unknown" elif ${GREP} -i "gethostbyname failure" ${ERROR_TMP} > /dev/null then prints ${1} ${2} "Cannot resolve domain" "Unknown" elif ${GREP} -i "Operation timed out" ${ERROR_TMP} > /dev/null then prints ${1} ${2} "Operation timed out" "Unknown" elif ${GREP} -i "ssl handshake failure" ${ERROR_TMP} > /dev/null then prints ${1} ${2} "SSL handshake failed" "Unknown" elif ${GREP} -i "connect: Connection timed out" ${ERROR_TMP} > /dev/null then prints ${1} ${2} "Connection timed out" "Unknown" else check_file_status ${CERT_TMP} $1 $2 fi } ##################################################### ### Check the expiration status of a certificate file ### Accepts three parameters: ### $1 -> certificate file to process ### $2 -> Server name ### $3 -> Port number of certificate ##################################################### check_file_status() { CERTFILE=${1} HOST=${2} PORT=${3} ### Check to make sure the certificate file exists if [ ! -r ${CERTFILE} ] then echo "ERROR: The file named ${CERTFILE} is unreadable or doesn't exist" RETCODE=1 return fi ### Grab the expiration date from the X.509 certificate if [ "${PKCSDBPASSWD}" != "" ] then # Extract the certificate from the PKCS#12 database, and # send the informational message to /dev/null ${OPENSSL} pkcs12 -nokeys -in ${CERTFILE} \ -out ${CERT_TMP} -password pass:${PKCSDBPASSWD} 2> /dev/null # Extract the expiration date from the certificate CERTDATE=$(${OPENSSL} x509 -in ${CERT_TMP} -enddate -noout | \ ${SED} 's/notAfter\=//') # Extract the issuer from the certificate CERTISSUER=$(${OPENSSL} x509 -in ${CERT_TMP} -issuer -noout | \ ${AWK} 'BEGIN {RS="/" } $0 ~ /^O=/ \ { print substr($0,3,17)}') ### Grab the common name (CN) from the X.509 certificate COMMONNAME=$(${OPENSSL} x509 -in ${CERT_TMP} -subject -noout | \ ${SED} -e 's/.*CN=//' | \ ${SED} -e 's/\/.*//') ### Grab the serial number from the X.509 certificate SERIAL=$(${OPENSSL} x509 -in ${CERT_TMP} -serial -noout | \ ${SED} -e 's/serial=//') else # Extract the expiration date from the ceriticate CERTDATE=$(${OPENSSL} x509 -in ${CERTFILE} -enddate -noout | \ ${SED} 's/notAfter\=//') # Extract the issuer from the certificate CERTISSUER=$(${OPENSSL} x509 -in ${CERTFILE} -issuer -noout | \ ${AWK} 'BEGIN {RS="/" } $0 ~ /^O=/ { print substr($0,3,17)}') ### Grab the common name (CN) from the X.509 certificate COMMONNAME=$(${OPENSSL} x509 -in ${CERTFILE} -subject -noout | \ ${SED} -e 's/.*CN=//' | \ ${SED} -e 's/\/.*//') ### Grab the serial number from the X.509 certificate SERIAL=$(${OPENSSL} x509 -in ${CERT_TMP} -serial -noout | \ ${SED} -e 's/serial=//') fi ### Split the result into parameters, and pass the relevant pieces to date2julian set -- ${CERTDATE} MONTH=$(getmonth ${1}) # Convert the date to seconds, and get the diff between NOW and the expiration date CERTJULIAN=$(date2julian ${MONTH#0} ${2#0} ${4}) CERTDIFF=$(date_diff ${NOWJULIAN} ${CERTJULIAN}) if [ ${CERTDIFF} -lt 0 ] then if [ "${ALARM}" = "TRUE" ] then echo "The SSL certificate for ${HOST} \"(CN: ${COMMONNAME})\" has expired!" \ | ${MAIL} -s "Certificate for ${HOST} \"(CN: ${COMMONNAME})\" has expired!" ${ADMIN} fi prints ${HOST} ${PORT} "Expired" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" RETCODE=2 elif [ ${CERTDIFF} -lt ${WARNDAYS} ] then if [ "${ALARM}" = "TRUE" ] then echo "The SSL certificate for ${HOST} \"(CN: ${COMMONNAME})\" will expire on ${CERTDATE}" \ | ${MAIL} -s "Certificate for ${HOST} \"(CN: ${COMMONNAME})\" will expire in ${WARNDAYS}-days or less" ${ADMIN} fi prints ${HOST} ${PORT} "Expiring" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" RETCODE=1 else prints ${HOST} ${PORT} "Valid" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" RETCODE=0 fi } ################################# ### Start of main program ################################# while getopts abinve:f:c:hk:p:s:qx: option do case "${option}" in a) ALARM="TRUE";; b) NOHEADER="TRUE";; c) CERTFILE=${OPTARG};; e) ADMIN=${OPTARG};; f) SERVERFILE=$OPTARG;; h) usage exit 1;; i) ISSUER="TRUE";; k) PKCSDBPASSWD=${OPTARG};; n) NAGIOS="TRUE";; p) PORT=$OPTARG;; s) HOST=$OPTARG;; q) QUIET="TRUE";; v) VALIDATION="TRUE";; x) WARNDAYS=$OPTARG;; \?) usage exit 1;; esac done ### Check to make sure a openssl utility is available if [ ! -f ${OPENSSL} ] then echo "ERROR: The openssl binary does not exist in ${OPENSSL}." echo "FIX: Please modify the \${OPENSSL} variable in the program header." exit 1 fi ### Check to make sure a date utility is available if [ ! -f ${DATE} ] then echo "ERROR: The date binary does not exist in ${DATE} ." echo "FIX: Please modify the \${DATE} variable in the program header." exit 1 fi ### Check to make sure a grep utility is available if [ ! -f ${GREP} ] then echo "ERROR: The grep binary does not exist in ${GREP} ." echo "FIX: Please modify the \${GREP} variable in the program header." exit 1 fi ### Check to make sure the mktemp and printf utilities are available if [ ! -f ${MKTEMP} ] || [ ! -f ${PRINTF} ] then echo "ERROR: Unable to locate the mktemp or printf binary." echo "FIX: Please modify the \${MKTEMP} and \${PRINTF} variables in the program header." exit 1 fi ### Check to make sure the sed and awk binaries are available if [ ! -f ${SED} ] || [ ! -f ${AWK} ] then echo "ERROR: Unable to locate the sed or awk binary." echo "FIX: Please modify the \${SED} and \${AWK} variables in the program header." exit 1 fi ### CHeck to make sure a mail client is available it automated notifcations are requested if [ "${ALARM}" = "TRUE" ] && [ ! -f ${MAIL} ] then echo "ERROR: You enabled automated alerts, but the mail binary could not be found." echo "FIX: Please modify the ${MAIL} variable in the program header." exit 1 fi # Place to stash temporary files CERT_TMP=$($MKTEMP /var/tmp/cert.XXXXXX) ERROR_TMP=$($MKTEMP /var/tmp/error.XXXXXX) ### Baseline the dates so we have something to compare to MONTH=$(${DATE} "+%m") DAY=$(${DATE} "+%d") YEAR=$(${DATE} "+%Y") NOWJULIAN=$(date2julian ${MONTH#0} ${DAY#0} ${YEAR}) ### Touch the files prior to using them if [ ! -z "${CERT_TMP}" ] && [ ! -z "${ERROR_TMP}" ] then touch ${CERT_TMP} ${ERROR_TMP} else echo "ERROR: Problem creating temporary files" echo "FIX: Check that mktemp works on your system" exit 1 fi ### If a HOST and PORT were passed on the cmdline, use those values if [ "${HOST}" != "" ] && [ "${PORT}" != "" ] then print_heading check_server_status "${HOST}" "${PORT}" ### If a file is passed to the "-f" option on the command line, check ### each certificate or server / port combination in the file to see if ### they are about to expire elif [ -f "${SERVERFILE}" ] then print_heading while read HOST PORT do if [ "${HOST:0:1}" = "#" ] then : elif [ "$PORT" = "FILE" ] then check_file_status ${HOST} "FILE" "${HOST}" else check_server_status "${HOST}" "${PORT}" fi done < ${SERVERFILE} ### Check to see if the certificate in CERTFILE is about to expire elif [ "${CERTFILE}" != "" ] then print_heading check_file_status ${CERTFILE} "FILE" "${CERTFILE}" ### There was an error, so print a detailed usage message and exit else usage exit 1 fi ### Remove the temporary files rm -f ${CERT_TMP} ${ERROR_TMP} ### Exit with a success indicator if [ "${NAGIOS}" = "TRUE" ]; then exit $RETCODE else exit 0 fi |
From: Augie S. <as...@us...> - 2009-01-19 18:41:34
|
Update of /cvsroot/mon/mon-contrib/monitors/ssl In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17537/ssl Log Message: Directory /cvsroot/mon/mon-contrib/monitors/ssl added to the repository |
From: Augie S. <as...@us...> - 2008-11-14 22:17:00
|
Update of /cvsroot/mon/mon/mon.d In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25390 Added Files: raid.monitor Log Message: Adding raid.monitor the unified software/hardware RAID monitor. --- NEW FILE: raid.monitor --- #!/usr/bin/perl # raid.monitor # A unified RAID monitor to monitor both software and hardware RAID. # Works with Linux software RAID, 3ware's tw_cli tool, and Areca's areca_cli tool. # Augie Schwer <au...@co...> use strict; use warnings; my $MDSTAT= '/proc/mdstat'; my $TWCLI = `which tw_cli 2> /dev/null`; my $ARCCLI= `which areca_cli 2> /dev/null`; chomp $TWCLI; chomp $ARCCLI; my $mdstat = ''; # Check for any failed software RAID. if ( -f $MDSTAT ) { $mdstat = `egrep "\[.*_.*\]" $MDSTAT`; $mdstat = '' if $mdstat =~ 'read_ahead not set'; # Fix for Red Hat 7.3 boxes. } if ( $mdstat ) { print "Failure of one or more software RAID devices\n"; exit 1; } # Check for any 3ware RAID failures. if ( -x $TWCLI ) { my %controllers = (); # Handle multiple controllers. my @controllers = `$TWCLI info | grep '^c' | awk {'print \$1'}`; my (@units,@ports); # Iterate through controllers and find broken ports and units. for my $controller (@controllers) { chomp $controller; @{$controllers{$controller}->{'failed_units'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^u' | awk {'print \$3'} | grep -v 'OK' | grep -v 'VERIFYING'`; @{$controllers{$controller}->{'failed_ports'}} = `$TWCLI info $controller | grep -v 'NOT-PRESENT' | grep '^p' | awk {'print \$2'} | grep -v 'OK' | grep -v 'VERIFYING'`; } # Display failure and exit with an error if there are any failed ports or units. for my $controller (@controllers) { if ( @{$controllers{$controller}->{'failed_units'}} or @{$controllers{$controller}->{'failed_ports'}} ) { print "Failure of one or more of the hardware RAID devices.\n"; exit 1; } } } # Check for any Areca RAID failures. if ( -x $ARCCLI ) { my @failed_raid_sets = `$ARCCLI rsf info | grep 'Raid Set' | grep -v 'Normal'`; # Display failure and exit with an error if there were any failed Raid Sets. if ( @failed_raid_sets ) { print "Failure of one or more of the hardware RAID devices.\n"; exit 1; } } # Otherwise everything was OK. print "Success\n"; exit 0; |
From: Augie S. <as...@us...> - 2008-10-24 22:00:02
|
Update of /cvsroot/mon/mon-contrib/alerts/lvs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29556/alerts/lvs Added Files: ipvs.alert Log Message: Added a lvs monitor and alert; contributed by Richard Hartmann <ric...@gm...>. --- NEW FILE: ipvs.alert --- #!/usr/bin/perl # ipvs.alert - Linux Virtual Server alert for mon # Bring a realserver up or down, or remove the entire virtual server. # # Invocation: # To remove a realserver from a virtual service: # ipvs.alert -P <protocol> -V <virtual_server:port> -R <real_server:port> # To add a realserver to an existing virtual service: # ipvs.alert -u -P <protocol> -V <virtual_server:port> -R <real_server:port> -W <weight> -F <forwarding> # To remove a virtual service along with any associated realservers: # ipvs.alert -D -P <protocol> -V <virtual_server:port> # To create a virtual service with the given realserver: # ipvs.alert -u -B -P <protocol> -V <virtual_server:port> -S <scheduler> -R <real_server:port> -W <weight> -F <forwarding> # # Options: # -P protocol (tcp|udp) # -V virtual server # -R realserver # -W weight # -F forwarding type (nat|tun|dr) # -S scheduler (rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq) # -D delete the entire virtual server # -B rebuild the virtual server # # Notes: # - -u is added automatically when ipvs.alert is part of an # ``upalert''. You can leave it out or append a dozen, this does not # matter. # - You can't build (-B) a virtual service without giving a # realserver, but you *can* add a realserver without building a # virtual service. # - the comments are almost double the volume of the script itself. # Good, bad or just plain ugly? # - Since it uses ipvsadm, this script (and therefore Mon) must # unfortunately run as root :( use Getopt::Std; getopts ("uDBs:g:h:t:l:P:V:R:W:F:S:"); $ipvsadm = "/sbin/ipvsadm"; $virtual_service = "$opt_V"; $realserver = "-r $opt_R"; $scheduler = "-s $opt_S"; %proto = ( "tcp" => "-t", "udp" => "-u", ); %type = ( "nat" => "-m", "tun" => "-i", "dr" => "-g", ); if ($opt_u) { # bring up the realserver if ($opt_B) { # build the virtual service first system("$ipvsadm -A $proto{$opt_P} $virtual_service $scheduler"); } $weight = "-w $opt_W"; system("$ipvsadm -a $proto{$opt_P} $virtual_service $realserver $weight $type{$opt_F}"); } elsif ($opt_D) { # tear down the entire virtual server system("$ipvsadm -D $proto{$opt_P} $virtual_service"); } else { # delete the realserver system("$ipvsadm -d $proto{$opt_P} $virtual_service $realserver"); }; # # ## ### ##### ######## ############# ##################### # CHANGELOG # Mon Jul 12 14:12:49 MYT 2004 # Initial [messy] version # Christopher DeMarco <cde...@md...> # Thu Jul 15 11:02:06 MYT 2004 # Added -D to delete the entire virtual server # Bringing up a service also adds the virtual server # General code overhaul # Christopher DeMarco <cde...@md...> # Mon Jul 26 10:09:34 MYT 2004 # Renamed "lvs" to "ipvs" # Christopher DeMarco <cde...@md...> # Wed Oct 1 18:34:27 CEST 2008 # fixed inline documentation # fixed whitespace/tab # Richard Hartmann <ri...@ne...> # # ## ### ##### ######## ############# ##################### # Copyright (C) 2004, Christopher DeMarco # Copyright (C) 2008, Richard Hartmann # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA |
From: Augie S. <as...@us...> - 2008-10-24 22:00:00
|
Update of /cvsroot/mon/mon-contrib/monitors/lvs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29556/monitors/lvs Added Files: ipvs.monitor Log Message: Added a lvs monitor and alert; contributed by Richard Hartmann <ric...@gm...>. --- NEW FILE: ipvs.monitor --- #!/usr/bin/perl # ipvs.monitor - Linux Virtual Server monitor for mon # Check whether the specified virtual service is defined, and, # optionally, whether it has any realservers defined. # # Invocation: # ipvs.monitor [options] -V <virtual_server:port> -P <protocol> # # Options: # -V virtual server # -P protocol (tcp|udp) # -z allows a virtual service to have zero realservers defined # # Notes: # - Since it uses ipvsadm, this script (and therefore mon) must # unfortunately run as root :( # - ipvs.monitor returns 0 on success and 1 on failure use Getopt::Std; getopts ("zV:P:"); %proto = ( "tcp" => "-t", "udp" => "-u", ); $virtual_service = "$opt_V"; @ipvs = `/sbin/ipvsadm -l $proto{$opt_P} $virtual_service 2>&1`; # allow a service with no realservers? defined $opt_z ? ($n = 2) : ($n = 3); # Check the output: # ...two lines of headers # ...one line of virtual service # ...one line for each realserver $#ipvs < $n ? exit 1 : exit 0; # # ## ### ##### ######## ############# ##################### # CHANGELOG # Tue Jul 27 11:17:39 MYT 2004 # Initial version # Christopher DeMarco <cde...@md...> # Tue Jul 27 14:14:08 MYT 2004 # added -z switch # Christopher DeMarco <cde...@md...> # Wed Oct 1 18:34:27 CEST 2008 # fixed inline documentation # fixed whitespace/tab # Richard Hartmann <ri...@ne...> # # ## ### ##### ######## ############# ##################### # Copyright (C) 2004, Christopher DeMarco # Copyright (C) 2008, Richard Hartmann # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # 02111-1307 USA |
From: Augie S. <as...@us...> - 2008-10-24 21:58:08
|
Update of /cvsroot/mon/mon-contrib/alerts/lvs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29477/alerts/lvs Log Message: Directory /cvsroot/mon/mon-contrib/alerts/lvs added to the repository |
From: Augie S. <as...@us...> - 2008-10-24 21:58:08
|
Update of /cvsroot/mon/mon-contrib/monitors/lvs In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv29477/monitors/lvs Log Message: Directory /cvsroot/mon/mon-contrib/monitors/lvs added to the repository |