mon-commit Mailing List for mon (Page 5)
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: Augie S. <as...@us...> - 2008-10-23 20:05:47
|
Update of /cvsroot/mon/mon/mon.d In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv4081 Modified Files: dns-query.monitor Log Message: Accept multiple query names. Index: dns-query.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/dns-query.monitor,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dns-query.monitor 7 Feb 2008 22:31:31 -0000 1.2 --- dns-query.monitor 23 Oct 2008 20:05:42 -0000 1.3 *************** *** 5,9 **** # arguments: # -t timeout timeout (defaults to 5 seconds) ! # -n name name to query, defaults to "mailhost" # -T Use TCP instead of default UDP. # --- 5,10 ---- # arguments: # -t timeout timeout (defaults to 5 seconds) ! # -n name[,name] name to query, defaults to "mailhost"; separate ! # multiple names with a ',' (comma). # -T Use TCP instead of default UDP. # *************** *** 38,41 **** --- 39,44 ---- my $USETCP = $opt{'T'}; + my @names = split /,/,$NAME; + my $r = Net::DNS::Resolver->new; *************** *** 61,76 **** $r->nameservers ($server); ! my $p = $r->search ($NAME); ! ! if (!defined $p) { ! $bad{$server}->{"detail"} = $r->errorstring; ! } ! else ! { ! my $n = $p->{"answer"}->[0]; ! $good{$server}->{"detail"} = "$n->{name} $n->{class} $n->{type} $n->{address}"; } } --- 64,82 ---- $r->nameservers ($server); ! foreach my $name (@names) { ! my $p = $r->search ($name); ! if (!defined $p) ! { ! $bad{$server}->{$name}->{"detail"} = $r->errorstring; ! } ! else ! { ! my $n = $p->{"answer"}->[0]; ! ! $good{$server}->{$name}->{"detail"} = "$n->{name} $n->{class} $n->{type} $n->{address}"; ! } } } *************** *** 89,95 **** { print "failures:\n"; ! foreach my $k (keys %bad) { ! print " $k: $bad{$k}->{detail} ($NAME)\n"; } --- 95,104 ---- { print "failures:\n"; ! foreach my $server (keys %bad) { ! foreach my $name (keys %{ $bad{$server} }) ! { ! print " $server: $bad{$server}->{$name}->{detail} ($name)\n"; ! } } *************** *** 101,107 **** print "successes:\n"; ! foreach my $k (keys %good) { ! print " $k: successfull lookup for $good{$k}->{detail} ($NAME)\n"; } } --- 110,119 ---- print "successes:\n"; ! foreach my $server (keys %good) { ! foreach my $name (keys %{ $good{$server} }) ! { ! print " $server: successfull lookup for $good{$server}->{detail} ($name)\n"; ! } } } |
From: 欧阳王强 <sd...@to...> - 2008-08-03 16:54:06
|
<html> <head> <meta http-equiv="Content-Language" content="zh-cn"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>Home</title> </head> <body> <div align="center"> <table border="0" width="500" id="table1"> <tr> <td align="center" bgcolor="#FF0000"> <p style="line-height: 150%"><b> <font face="Verdana" color="#FFFF00" size="2"> <a target="_blank" href="http://hi.baidu.com/exporthats/blog/item/2c4d3afb00f77b8f9e5146e8.html" style="text-decoration: none"> <font color="#FFFF00">Home</font></a></font></b></td> <td align="center" bgcolor="#FF0000"> <p style="line-height: 150%"><b> <font face="Verdana" color="#FFFF00" size="2"> <a target="_blank" href="http://hi.baidu.com/exporthats/blog/item/37b611168fbdb9074a90a7f5.html" style="text-decoration: none"> <font color="#FFFF00">Lady's hats</font></a></font></b></td> <td align="center" bgcolor="#FF0000"> <p style="line-height: 150%"><b> <font face="Verdana" color="#FFFF00" size="2"> <a target="_blank" href="http://hi.baidu.com/exporthats/blog/item/5c4544fa0dd2ab62034f56f5.html" style="text-decoration: none"> <font color="#FFFF00">Men's hats</font></a></font></b></td> <td align="center" bgcolor="#FF0000"> <p style="line-height: 150%"><b> <font face="Verdana" color="#FFFF00" size="2"> <a target="_blank" href="http://hi.baidu.com/exporthats/blog/item/ab09f4f3d5519315b07ec5f6.html" style="text-decoration: none"> <font color="#FFFF00">Other hats</font></a></font></b></td> <td align="center" bgcolor="#FF0000"> <p style="line-height: 150%"><b> <font face="Verdana" color="#FFFF00" size="2"> <a target="_blank" href="http://hi.baidu.com/exporthats/blog/item/9f43c63cb28f3bc19f3d62f6.html" style="text-decoration: none"> <font color="#FFFF00">Contact us</font></a></font></b></td> </tr> <tr> <td colspan="5"><font size="2" face="Verdana">We, Guangzhou Kingdu Hats Co., Ltd., recommend Chinese hand-made hats to you. These hats are exported to the US, Japan, EU. and other parts of the world.<br> <br> Our company is located in Guangzhou, China, which is a developed city of hand-made manufacturing. We can supply low cost & high quality products due to the cheaper hand-made employees.<br> <br> If you have your own brand, logo, artwork or sample that you want to develop and import from us, please send them to us by e-mail attachment or air parcel, we'll do our best to develop the samples including designing them for you.<br> <br> And we promise you that we are the best supplier based on our long-time experience, products of high quality, competitive prices, versatile designs and on-time delivery, and with the principle of, "Customer First". <br> <br> If you wish to form a powerful, long-term business relationship, please do not hesitate to contact us. And we'll reply to your inquiry as soon as possible.<br> <br> <font color="#800080">(Please send your inquiry to the email address on our website. )</font></font><table border="0" width="100%" id="table2" cellspacing="0" cellpadding="0"> <tr> <td align="center"> <img border="0" src="http://photo14.hexun.com/p/2008/0715/224587/b_2B4B2C0ED85E013ED8D61CC852E00F8C.jpg" width="120" height="96"></td> <td align="center"> <img border="0" src="http://photo14.hexun.com/p/2008/0715/224587/b_0A5646F65A47F33B6D8850C972D450BE.jpg" width="120" height="96"></td> <td align="center"> <img border="0" src="http://photo14.hexun.com/p/2008/0715/224588/b_D215234E77328FF035CBF721D04258B5.jpg" width="120" height="96"></td> <td align="center"> <img border="0" src="http://photo14.hexun.com/p/2008/0715/224588/b_0C8C4EC69DAECAC6266EB04061265FE4.jpg" width="120" height="96"></td> </tr> </table> <p align="center" style="line-height: 150%"><b> <font face="Verdana" size="2">Guangzhou Kingdu Hats Co., Ltd.<br> Tel:+86-20-83617056 Fax:+86-20-87279459<br> Add:Room 1908, 320, shataibei Road, GuangZhou City, China 510515</font></b></p> <p align="left"><font face="Verdana" size="2">If you can not refer to the link and the photos above, pls visit this website:<font color="#000080"><b>http://hi.baidu.com/exporthats/blog/item/37b611168fbdb9074a90a7f5.html</b></font></font></td> </tr> </table> </div> <p> </p> </body> </html> |
From: Augie S. <as...@us...> - 2008-08-01 17:02:23
|
Update of /cvsroot/mon/mon-contrib/monitors/ftp/ftps In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6768/ftp/ftps Added Files: ftps.monitor Log Message: Adding the ftps.monitor monitor. --- NEW FILE: ftps.monitor --- #!/usr/bin/perl # # Use try to connect to a FTP/SSL server, and # wait for the right output. # # For use with "mon". # # Arguments are "[-p port] [-u user] [-s password] [-e I|E] [-t timeout] host [host...]" # # -p port TCP port to connect to (defaults to 21) # -u user user to login (defaults to ftp) # -s password password to login (defaults to ft...@mo...valid) # -e I|E is for Implicit or Explicit encryption # -t secs timeout, defaults to 30 # # Adapted from "ftp.monitor" by Pierre-Emmanuel Andre # # Copyright (C) 2008, Pierre-Emmanuel Andre # # 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 # # $Id: ftps.monitor,v 1.1 2008/08/01 17:02:19 aschwer Exp $ use Getopt::Std; use Net::FTPSSL; #Get arguments getopts ("p:u:s:e:t:"); $PORT = $opt_p || 21; $USER = $opt_u || 'ftp' ; $PASSWORD = $opt_s || 'ft...@mo...valid' ; $ENCRYPTION = $opt_e || 'E' ; $TIMEOUT = $opt_t || 30; my %good; my %bad; # Start loop foreach my $host (@ARGV) { my $result = ftpGET ($host, $PORT); if (!$result->{"ok"}) { $bad{$host} = $result; } else { $good{$host} = $result; } } # No bad -> exit with success if (keys %bad == 0) { exit 0; } # Else print errors print join (" ", sort keys %bad), "\n"; foreach my $h (keys %bad) { print "HOST $h: " . $bad{$h}->{"error"}, "\n"; } exit 1; # Function to connect on FTP/SSL server sub ftpGET { my ($server,$port) = @_ ; #Open connexion my $ftps = Net::FTPSSL->new($server, Port => $port, Encryption => $ENCRYPTION, Timeout => $TIMEOUT, Debug => 0 ) or return { "ok" => 0, "error" => $ftps->last_message, }; #Login $ftps->login($USER,$PASSWORD) or return { "ok" => 0, "error" => $ftps->last_message, }; #Quit $ftps->quit() ; #No error return { "ok" => 1, "error" => undef, }; } |
From: Augie S. <as...@us...> - 2008-08-01 16:57:59
|
Update of /cvsroot/mon/mon-contrib/monitors/ftp/ftps In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2798/ftps Log Message: Directory /cvsroot/mon/mon-contrib/monitors/ftp/ftps added to the repository |
From: Augie S. <as...@us...> - 2008-08-01 16:57:25
|
Update of /cvsroot/mon/mon-contrib/monitors/ftp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2731/ftp Log Message: Directory /cvsroot/mon/mon-contrib/monitors/ftp added to the repository |
From: Jim T. <tr...@us...> - 2008-04-02 22:13:34
|
Update of /cvsroot/mon/mon-contrib/monitors/nfs In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16881/nfs Log Message: Directory /cvsroot/mon/mon-contrib/monitors/nfs added to the repository |
From: Augie S. <as...@us...> - 2008-03-17 23:14:17
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31583 Modified Files: mysql-replication.monitor Log Message: Added some substantial features: master/slave comparisons for binary logs and updates, debugging flag, real POD. Index: mysql-replication.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/mysql-replication.monitor,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mysql-replication.monitor 1 Dec 2007 00:28:11 -0000 1.1 --- mysql-replication.monitor 17 Mar 2008 23:14:12 -0000 1.2 *************** *** 1,6 **** #!/usr/bin/perl - # arguments: - # [ --username=username --password=password --port=# ] hostname(s) use DBI; use Getopt::Long; --- 1,125 ---- #!/usr/bin/perl + =head1 NAME + + mysql-replication.monitor - Monitor MySQL Replication for the "mon" system. + + =head1 SYNOPSIS + + mysql-replicaiton.monitor + + =over + + --slave-user=username --slave-pass=password --slave-port=# + + [ --master-host=hostname --master-user=username --master-pass=password --master-port=# ] + + [ --binlogs=# --slave-seconds=# --real-seconds=# --debug ] hostname(s) ... + + =back + + =head1 DESCRIPTION + + mysql-replication.monitor will connect to the slave host(s) and potentially the master to compare values to provided thresholds. + + =over + + =item slave-user + + User name to use when connecting to the slave host(s). + + =item slave-pass + + Password to use when connecting to the slave host(s). + + =item slave-port + + Port number to use when connecting to the slave host(s). + + =item master-host + + Host name of the master host. + + =item master-user + + User name to use when connecting to the master host. + + =item master-pass + + Password to use when connecting to the master host. + + =item master-port + + Port number to use when connecting to the master host. + + =item binlogs + + Number of binary logs behind a master a slave is allowed to be before alarming. + + This requires that you provide the 'master-*' variables. + + =item slave-seconds + + The number of seconds behind a master a slave thinks it is before alarming. This is the Seconds_Behind_Master you see when + you do a 'SHOW SLAVE STATUS\G' on a slave; which is actually how far behind the SQL thread is compared to the binary logs + it has locally; this does not help if your slave does not have the most up to date binary log from the master. See the link + below for more information: + + http://dev.mysql.com/doc/refman/5.0/en/replication-faq.html#qandaitem-16-3-4-3 + + =item real-seconds + + This is the number of seconds behind a master a slave actually is before alarming. This is a far more pedantic approach to + monitoring lag in your slaves then the 'slave-seconds' option, but may also be overkill for some sites. With this option set + the monitor will actually update a table on the master with a time stamp and compare that same time stamp on the slave(s); + if the two time stamps differ by more then the ammount specified here, then an alarm will be generated. + + To use this you will need to create a database named 'replication', allow your 'master-user' to connect to it and update a + table called 'heartbeat'. The SQL commands below should help get you started: + + CREATE DATABASE replication; + + CREATE TABLE heartbeat (unix_time INTEGER NOT NULL); + + GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl-check'@'monitoring-host-name' IDENTIFIED BY 'pa$$word'; + + GRANT SELECT,UPDATE ON replication.heartbeat to 'repl-check'@'monitoring-host-name'; + + INSERT INTO HEARTBEAT (unix_time) VALUES (1205778309); + + This requires that you provide the 'master-*' variables. + + =item debug + + Will print out some helpful messages of what the monitor is doing while it's doing it. + + =back + + There is a section of the code that you can uncomment and set your variables there so that you do not have to pass + everything on the command line. + + If you only provide the slave information, then only the status of the SQL and IO threads, and 'slave-seconds' can + be checked. + + Providing master information will allow you to check the above and 'binlogs' and 'real-seconds'. + + A sample GRANT statement follows to help get you started: + + GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl-check'@'monitoring-host-name' IDENTIFIED BY 'pa$$word'; + + =head1 AUTHOR + + Augie Schwer, C<< <augie at schwer.us> >> + + http://www.schwer.us + + =head1 ACKNOWLEDGEMENTS + + I would like to thank Sonic.net for allowing me to release this to the public. + + =cut + + + use strict; use DBI; use Getopt::Long; *************** *** 8,36 **** my @details=(); my @failures=(); ! GetOptions( \%options, "port=i", "username=s", "password=s" , "seconds=i" ); ! # uncomment these two lines and provide suitable information if you don't ! # want to pass sensitive information on the command line ! $options{username} ||= "repl-check"; ! $options{password} ||= "m449kwf"; ! $options{port} ||= 3306; ! $options{seconds} ||= 3600; ! for $host( @ARGV ) { ! my( $dbh ) = DBI->connect( "DBI:mysql:host=$host:port=$options{port}", $options{username}, $options{password}, { PrintError => 0 } ); if( ! $dbh ) { push( @failures, $host); ! push( @details, "$host: Could not connect to MySQL server on $options{port}: " . $DBI::errstr . "\n"); next; } ! # Gather vital replication information. my $sth = $dbh->prepare('SHOW SLAVE STATUS'); $sth->execute; my $slave = $sth->fetchrow_hashref; - $sth->finish; ! # Check those variables. if ( $slave->{Slave_IO_Running} ne 'Yes' ) { --- 127,231 ---- my @details=(); my @failures=(); + my %options=(); ! GetOptions( \%options, ! "slave-port=i", "slave-user=s", "slave-pass=s" , ! "master-host=s" , "master-user=s" , "master-pass=s" , "master-port=i" , ! "binlogs=i" , "slave-seconds=i" , "real-seconds=i" , "debug" ! ); ! ######################################################################### ! # Set options here if you don't want to pass options on the command line. ! #$options{'slave-user'} ||= "repl-check"; ! #$options{'slave-pass'} ||= 'pa$$word'; ! #$options{'slave-port'} ||= 3306; ! #$options{'master-host'} ||= 'localhost'; ! #$options{'master-user'} ||= "repl-check"; ! #$options{'master-pass'} ||= 'pa$$word'; ! #$options{'master-port'} ||= 3306; ! #$options{'binlogs'} ||= 3; ! #$options{'slave-seconds'} ||= 3600; ! #$options{'real-seconds'} ||= 3600; ! ######################################################################### ! my $master; ! ! if ( (defined $options{'binlogs'}) or (defined $options{'real-seconds'}) ) ! { ! print "debug - Connecting to master with DSN : DBI:mysql:host=$options{'master-host'}:port=$options{'master-port'},$options{'master-user'},$options{'master-pass'} \n" if $options{'debug'}; ! ! my $dbh = DBI->connect( "DBI:mysql:host=$options{'master-host'}:port=$options{'master-port'}",$options{'master-user'},$options{'master-pass'}, { PrintError => 0 } ); ! if( ! $dbh ) { ! print "$options{'master-host'}\n"; ! print "$options{'master-host'}: Could not connect to MySQL server on $options{'master-port'}: " . $DBI::errstr . "\n"; ! exit 1; ! } ! ! # Gather master replication information. ! ! print "debug - Gathering master replication information.\n" if $options{'debug'}; ! ! my $sth = $dbh->prepare('SHOW MASTER STATUS'); ! $sth->execute; ! $master = $sth->fetchrow_hashref; ! ! if (defined $options{'real-seconds'}) ! { ! $sth = $dbh->prepare('USE replication'); ! $sth->execute; ! ! my $unix_time = time(); ! $sth = $dbh->prepare('UPDATE heartbeat SET unix_time = ?'); ! $sth->execute($unix_time); ! ! $master->{'unix_time'} = $unix_time; ! ! print "debug - Setting master 'unix_time' to $unix_time \n" if $options{'debug'}; ! } ! ! $sth->finish(); ! $dbh->disconnect(); ! } ! ! for my $host( @ARGV ) { ! print "debug - Connecting to slave host $host with DSN : DBI:mysql:host=$host:port=$options{'slave-port'},$options{'slave-user'},$options{'slave-pass'}\n" if $options{'debug'}; ! ! my $dbh = DBI->connect( "DBI:mysql:host=$host:port=$options{'slave-port'}", $options{'slave-user'},$options{'slave-pass'}, { PrintError => 0 } ); if( ! $dbh ) { push( @failures, $host); ! push( @details, "$host: Could not connect to MySQL server on $options{'slave-port'}: " . $DBI::errstr . "\n"); next; } ! # Gather slave replication information. ! ! print "debug - Gathering slave replication information.\n" if $options{'debug'}; ! my $sth = $dbh->prepare('SHOW SLAVE STATUS'); $sth->execute; my $slave = $sth->fetchrow_hashref; ! if (defined $options{'real-seconds'}) ! { ! $sth = $dbh->prepare('USE replication'); ! $sth->execute; ! ! $sth = $dbh->prepare('SELECT unix_time FROM heartbeat'); ! $sth->execute; ! ! my ($unix_time) = $sth->fetchrow_array; ! ! $slave->{'unix_time'} = $unix_time; ! ! print "debug - Setting slave 'unix_time' to $unix_time \n" if $options{'debug'}; ! } ! ! $sth->finish(); ! $dbh->disconnect(); ! ! # Check slave variables. ! ! print "debug - Slave_IO_Running is $slave->{Slave_IO_Running}\n" if $options{'debug'}; ! if ( $slave->{Slave_IO_Running} ne 'Yes' ) { *************** *** 40,43 **** --- 235,240 ---- } + print "debug - Slave_SQL_Running is $slave->{Slave_SQL_Running}\n" if $options{'debug'}; + if ( $slave->{Slave_SQL_Running} ne 'Yes' ) { *************** *** 47,58 **** } ! if ( $slave->{Seconds_Behind_Master} > $options{seconds} ) { push( @failures, $host); ! push( @details, "$host: Slave is more than " . $options{seconds} . " seconds behind master.\n"); next; } ! $dbh->disconnect(); } --- 244,287 ---- } ! print "debug - Seconds_Behind_Master is $slave->{Seconds_Behind_Master}\n" if $options{'debug'}; ! ! if ( (defined $options{'slave-seconds'}) && ($slave->{Seconds_Behind_Master} > $options{'slave-seconds'}) ) { push( @failures, $host); ! push( @details, "$host: Slave is more than " . $options{'slave-seconds'} . " slave seconds behind master.\n"); next; } ! # Check master variables ! if ( defined $options{'binlogs'} ) ! { ! print "debug - master file is $master->{'File'}\n" if $options{'debug'}; ! print "debug - slave file is $slave->{'Master_Log_File'}\n" if $options{'debug'}; ! ! $master->{'File_No'} = $1 if ($master->{'File'} =~ /(\d+)$/); ! $slave->{'File_No'} = $1 if ($slave->{'Master_Log_File'} =~ /(\d+)$/); ! ! my $binlog_diff = $master->{'File_No'} - $slave->{'File_No'}; ! if ( $binlog_diff > $options{'binlogs'} ) ! { ! push( @failures, $host); ! push( @details, "$host: Slave is more than " . $options{'binlogs'} . " binary logs behind master.\n"); ! next; ! } ! } ! ! if ( defined $options{'real-seconds'} ) ! { ! print "debug - master 'unix_time' is $master->{'unix_time'}\n" if $options{'debug'}; ! print "debug - slave 'unix_time' is $slave->{'unix_time'}\n" if $options{'debug'}; ! ! my $realsec_diff = $master->{'unix_time'} - $slave->{'unix_time'}; ! if ( $realsec_diff > $options{'real-seconds'} ) ! { ! push( @failures, $host); ! push( @details, "$host: Slave is more than " . $options{'real-seconds'} . " real seconds behind master.\n"); ! next; ! } ! } } |
From: Augie S. <as...@us...> - 2008-03-10 23:12:07
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21048 Added Files: netappdiskfail.monitor Log Message: Created a new monitor to check for failed NetApp disks. --- NEW FILE: netappdiskfail.monitor --- #!/usr/bin/perl # # Use SNMP to get disk failures from a NetApp. # # USAGE # [--community=<SNMP COMMUNITY>] [--timeout=<seconds>] [--retries=<count>] host1 host2 ... # sample invocation in mon.cf, with local MIB directory for the Netapp MIB # NETWORK-APPLIANCE-MIB.txt (copy from /etc/mib/netapp.mib on filer): # service diskfree # description test disk failure on Netapp filers # depend SELF:ping # MIBDIRS=/usr/local/share/snmp/mibs # interval 7m # monitor netappdiskfail.monitor # # This requires the UCD SNMP library and G.S. Marzot's Perl SNMP # module. # use strict; use SNMP; use Getopt::Long; $ENV{"MIBS"} = 'RFC1213-MIB:NETWORK-APPLIANCE-MIB'; my %opt = (); GetOptions (\%opt, "community=s", "timeout=i", "retries=i"); die "no host arguments\n" if (@ARGV == 0); my $RET = 0; my @ERRS = (); my %HOSTS = (); my $COMM = $opt{"community"} || "public"; my $TIMEOUT = $opt{"timeout"} || 2; $TIMEOUT *= 1000 * 1000; my $RETRIES = $opt{"retries"} || 5; my $sess; foreach my $host (@ARGV) { if (!defined($sess = new SNMP::Session (DestHost => $host, Timeout => $TIMEOUT, Community => $COMM, Retries => $RETRIES, Version => 1))) { $RET = 1; $HOSTS{$host} ++; push (@ERRS, "could not create session to $host: " . $SNMP::Session::ErrorStr); next; } if ($sess->get('diskFailedCount.0') > 0) { $HOSTS{$host} ++; push (@ERRS, "Disk failure - " . $sess->get('diskFailedCount.0') . " failed disk(s)."); push (@ERRS, $sess->get('diskFailedMessage.0')); $RET = 1; } } if ($RET) { print join(" ", sort keys %HOSTS), "\n\n", join("\n", @ERRS), "\n"; } exit $RET; |
From: Augie S. <as...@us...> - 2008-03-10 23:09:30
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19672 Added Files: Tag: mon-1-2-branch netappdiskfail.monitor Log Message: Created a new monitor to check for failed NetApp disks. --- NEW FILE: netappdiskfail.monitor --- #!/usr/bin/perl # # Use SNMP to get disk failures from a NetApp. # # USAGE # [--community=<SNMP COMMUNITY>] [--timeout=<seconds>] [--retries=<count>] host1 host2 ... # sample invocation in mon.cf, with local MIB directory for the Netapp MIB # NETWORK-APPLIANCE-MIB.txt (copy from /etc/mib/netapp.mib on filer): # service diskfree # description test disk failure on Netapp filers # depend SELF:ping # MIBDIRS=/usr/local/share/snmp/mibs # interval 7m # monitor netappdiskfail.monitor # # This requires the UCD SNMP library and G.S. Marzot's Perl SNMP # module. # use strict; use SNMP; use Getopt::Long; $ENV{"MIBS"} = 'RFC1213-MIB:NETWORK-APPLIANCE-MIB'; my %opt = (); GetOptions (\%opt, "community=s", "timeout=i", "retries=i"); die "no host arguments\n" if (@ARGV == 0); my $RET = 0; my @ERRS = (); my %HOSTS = (); my $COMM = $opt{"community"} || "public"; my $TIMEOUT = $opt{"timeout"} || 2; $TIMEOUT *= 1000 * 1000; my $RETRIES = $opt{"retries"} || 5; my $sess; foreach my $host (@ARGV) { if (!defined($sess = new SNMP::Session (DestHost => $host, Timeout => $TIMEOUT, Community => $COMM, Retries => $RETRIES, Version => 1))) { $RET = 1; $HOSTS{$host} ++; push (@ERRS, "could not create session to $host: " . $SNMP::Session::ErrorStr); next; } if ($sess->get('diskFailedCount.0') > 0) { $HOSTS{$host} ++; push (@ERRS, "Disk failure - " . $sess->get('diskFailedCount.0') . " failed disk(s)."); push (@ERRS, $sess->get('diskFailedMessage.0')); $RET = 1; } } if ($RET) { print join(" ", sort keys %HOSTS), "\n\n", join("\n", @ERRS), "\n"; } exit $RET; |
From: Augie S. <as...@us...> - 2008-02-07 22:31:39
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1090/mon.d Modified Files: dns-query.monitor Log Message: Add support for TCP queries. Index: dns-query.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/dns-query.monitor,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** dns-query.monitor 9 Jun 2004 05:18:06 -0000 1.1.1.1 --- dns-query.monitor 7 Feb 2008 22:31:31 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- # -t timeout timeout (defaults to 5 seconds) # -n name name to query, defaults to "mailhost" + # -T Use TCP instead of default UDP. # # $Id$ *************** *** 31,38 **** my %opt; ! getopts ("t:n:", \%opt); my $TIMEOUT = defined $opt{"t"} ? $opt{"t"} : 5; my $NAME = $opt{"n"} || "mailhost"; my $r = Net::DNS::Resolver->new; --- 32,40 ---- my %opt; ! getopts ("t:n:T", \%opt); my $TIMEOUT = defined $opt{"t"} ? $opt{"t"} : 5; my $NAME = $opt{"n"} || "mailhost"; + my $USETCP = $opt{'T'}; my $r = Net::DNS::Resolver->new; *************** *** 43,47 **** } ! $r->udp_timeout ($TIMEOUT); my (%good, %bad); --- 45,57 ---- } ! if ($USETCP) ! { ! $r->tcp_timeout ($TIMEOUT); ! $r->usevc (1); ! } ! else ! { ! $r->udp_timeout ($TIMEOUT); ! } my (%good, %bad); |
From: Augie S. <as...@us...> - 2008-01-09 22:50:46
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7698 Modified Files: nntp.monitor Log Message: Added a maintenance mode, propper error reporting and work in a 'use strict' environment. Index: nntp.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/nntp.monitor,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nntp.monitor 17 Jul 2007 18:03:17 -0000 1.3 --- nntp.monitor 9 Jan 2008 22:47:49 -0000 1.4 *************** *** 9,13 **** # For use with "mon". # ! # Arguments are "-p port -t timeout [-g group] [-f] host [host...] -u username -a password" # # This monitor connects to the NNTP server(s), checks for a greeting, logs in, --- 9,13 ---- # For use with "mon". # ! # Arguments are "[-m] -p port -t timeout [-g group] [-f] host [host...] -u username -a password" # # This monitor connects to the NNTP server(s), checks for a greeting, logs in, *************** *** 49,92 **** use Getopt::Std; use English; ! getopts ("fg:p:t:d:u:a:"); ! $GROUP = $opt_g || 'control'; ! $PORT = $opt_p || 119; ! $TIMEOUT = $opt_t || 30; ! $FEEDER = $opt_f; ! $DEBUG = $opt_d || ""; ! $USER = $opt_u || ''; ! $PASS = $opt_a || ''; ! ! @failures = (); ! ! foreach $host (@ARGV) { ! ! if (! &nntpGET($host, $PORT)) { ! push (@failures, $host); ! } ! } ! ! if (@failures == 0) { ! exit 0; ! } ! ! print join (" ", sort @failures), "\n"; ! ! exit 1; ! ! ! sub nntpGET { ! use Socket; ! use Sys::Hostname; ! my($Server, $Port) = @_; ! my($ServerOK, $TheContent); ! $ServerOK = 0; ! $TheContent = ''; ! $Path = '/'; ############################################################### --- 49,74 ---- use Getopt::Std; use English; + use Socket; + use Sys::Hostname; + use strict; ! getopts ("fg:p:t:d:u:a:m"); ! our ($opt_g,$opt_p,$opt_t,$opt_f,$opt_u,$opt_a,$opt_m); ! my $GROUP = $opt_g || 'control'; ! my $PORT = $opt_p || 119; ! my $TIMEOUT = $opt_t || 30; ! my $FEEDER = $opt_f; ! my $USER = $opt_u || ''; ! my $PASS = $opt_a || ''; ! my $MAINT = $opt_m; ! my @failures = (); ! my @details = (); ! foreach my $host (@ARGV) { ! my $TheContent = ''; ! my $Path = '/'; ############################################################### *************** *** 95,115 **** local $SIG{ALRM} = sub { die "Timeout Alarm" }; alarm $TIMEOUT; ! $result = &OpenSocket($Server, $Port); # Open a connection to the server if ($result == 0) { # Failure to open the socket ! print "Unable to open socket\n" if $DEBUG; ! return ''; } ! # ! # welcome message ! # ! $in = <S>; ! if ($in !~ /^2\d\d/) { ! alarm 0; ! print "No welcome message\n" if $DEBUG; ! return 0; } - if (!$FEEDER) { if ($USER ne "") { --- 77,156 ---- local $SIG{ALRM} = sub { die "Timeout Alarm" }; alarm $TIMEOUT; ! my $result = &OpenSocket($host, $PORT); # Open a connection to the server if ($result == 0) { # Failure to open the socket ! print "Host: $host\n"; ! print "Port: $PORT\n"; ! push @failures , $host; ! push @details , "$host: Unable to open socket."; ! alarm 0; ! next; } ! if ($FEEDER) ! { ! # welcome message ! my $in = <S>; ! if ($in !~ /^2\d\d/) { ! alarm 0; ! push @failures , $host; ! push @details , "$host: No welcome message."; ! next; ! } ! ! print S "quit\r\n"; ! ! $in = <S>; ! if ($in !~ /^2\d\d/) { ! alarm 0; ! push @failures , $host; ! push @details , "$host: No response on 'quit' command."; ! next; ! } ! ! close(S); ! alarm 0; # Cancel the alarm } + elsif ($MAINT) + { + # Is the server currently in a maintenance mode? + my $in = <S>; + if ( $in =~ /^502 .+ System currently paused.*/ ) + { + close(S); + alarm 0; # Cancel the alarm + } + elsif ( $in =~ /^2\d\d/ ) # Server not in maintenance mode, but is accepting connections. + { + print S "quit\r\n"; + + $in = <S>; + if ($in !~ /^2\d\d/) { + alarm 0; + push @failures , $host; + push @details , "$host: No response on 'quit' command."; + next; + } + + close(S); + alarm 0; # Cancel the alarm + } + else # Server is not OK. + { + alarm 0; + push @failures , $host; + push @details , "$host: Server is not accepting connections."; + next; + } + } + else { + # welcome message + my $in = <S>; + if ($in !~ /^2\d\d/) { + alarm 0; + push @failures , $host; + push @details , "$host: No welcome message."; + next; + } if ($USER ne "") { *************** *** 118,124 **** $in = <S>; if ($in !~ /^381/) { ! alarm 0; ! print "No reaction to authinfo user\n" if $DEBUG; ! return 0; } # password --- 159,166 ---- $in = <S>; if ($in !~ /^381/) { ! alarm 0; ! push @failures , $host; ! push @details , "$host: No reaction to authinfo user."; ! next; } # password *************** *** 127,132 **** if ($in !~ /^281/) { alarm 0; ! print "No reaction to authinfo pass or wrong password\n" if $DEBUG; ! return 0; } } --- 169,175 ---- if ($in !~ /^281/) { alarm 0; ! push @failures , $host; ! push @details , "$host: No reaction to authinfo pass or wrong password."; ! next; } } *************** *** 139,144 **** if ($in !~ /^2\d\d/) { alarm 0; ! print "Unable to perform 'mode reader'\n" if $DEBUG; ! return 0; } --- 182,188 ---- if ($in !~ /^2\d\d/) { alarm 0; ! push @failures , $host; ! push @details , "$host: Unable to perform 'mode reader'."; ! next; } *************** *** 151,186 **** if ($in !~ /^2\d\d/) { alarm 0; ! print "Unable to select group '$GROUP'\n" if $DEBUG; ! return 0; } - } - - # - # log out - # - print S "quit\r\n"; ! $in = <S>; ! if ($in !~ /^2\d\d/) { ! alarm 0; ! print "No response on 'quit' command.\n" if $DEBUG; ! return 0; } - - $ServerOK = 1; - - close(S); - alarm 0; # Cancel the alarm - }; if ($EVAL_ERROR and ($EVAL_ERROR =~ /^Timeout Alarm/)) { ! print "**** Time Out\n"; ! return 0; } - return $ServerOK; } sub OpenSocket { # --- 195,244 ---- if ($in !~ /^2\d\d/) { alarm 0; ! push @failures , $host; ! push @details , "$host: Unable to select group '$GROUP'."; ! next; ! } ! # ! # log out ! # ! print S "quit\r\n"; ! $in = <S>; ! if ($in !~ /^2\d\d/) { ! alarm 0; ! push @failures , $host; ! push @details , "$host: No response on 'quit' command."; ! next; } ! close(S); ! alarm 0; # Cancel the alarm } }; if ($EVAL_ERROR and ($EVAL_ERROR =~ /^Timeout Alarm/)) { ! push @failures , $host; ! push @details , "$host: Time Out."; ! next; ! } ! } ! ! if (@failures) ! { ! print join (" ", sort @failures), "\n"; ! ! if (@details) ! { ! print join ("\n", @details), "\n"; } + exit 1; + } + else + { + print "no failures\n"; + exit 0; } + sub OpenSocket { # *************** *** 188,194 **** # on another (or this) host. Port can be a number or a named service # ! local($OtherHostname, $Port) = @_; ! local($OurHostname, $sockaddr, $name, $aliases, $proto, $type, $len, ! $ThisAddr, $that); $OurHostname = &hostname; --- 246,252 ---- # on another (or this) host. Port can be a number or a named service # ! my ($OtherHostname, $Port) = @_; ! my ($OurHostname, $sockaddr, $name, $aliases, $proto, $type, $len, ! $ThisAddr, $that, $OtherHostAddr); $OurHostname = &hostname; *************** *** 198,204 **** ($name, $aliases, $type, $len, $OtherHostAddr) = gethostbyname($OtherHostname); ! my $that = sockaddr_in ($Port, $OtherHostAddr); ! $result = socket(S, &PF_INET, &SOCK_STREAM, $proto) || return undef; $result = connect(S, $that) || return undef; --- 256,262 ---- ($name, $aliases, $type, $len, $OtherHostAddr) = gethostbyname($OtherHostname); ! $that = sockaddr_in ($Port, $OtherHostAddr); ! my $result = socket(S, &PF_INET, &SOCK_STREAM, $proto) || return undef; $result = connect(S, $that) || return undef; |
From: Augie S. <as...@us...> - 2007-12-05 17:56:00
|
Update of /cvsroot/mon/mon In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7114 Modified Files: mon Log Message: Checking in Jim's patch for syslog dying in eval. Index: mon =================================================================== RCS file: /cvsroot/mon/mon/mon,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mon 3 Dec 2007 18:24:55 -0000 1.24 --- mon 5 Dec 2007 17:55:53 -0000 1.25 *************** *** 5393,5404 **** no warnings; # Redefining syslog sub syslog { ! eval { ! local $SIG{"__DIE__"}= sub { }; ! my @log = @_; ! for ( @log ) { ! s/\%//mg; ! } ! Sys::Syslog::syslog(@log); ! } } use warnings; --- 5393,5403 ---- no warnings; # Redefining syslog sub syslog { ! return if (!@_); ! ! my $pri = (@_ == 1) ? "err" : shift; ! ! eval { Sys::Syslog::syslog ($pri, '%s', "@_"); }; ! ! print STDERR "syslog error: $@\n" if ($@ ne ""); } use warnings; |
From: Augie S. <as...@us...> - 2007-12-05 17:55:03
|
Update of /cvsroot/mon/mon In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6685 Modified Files: Tag: mon-1-2-branch mon Log Message: Checking in Jim's patch for syslog dying in eval. Index: mon =================================================================== RCS file: /cvsroot/mon/mon/mon,v retrieving revision 1.22.2.2 retrieving revision 1.22.2.3 diff -C2 -d -r1.22.2.2 -r1.22.2.3 *** mon 6 Jun 2007 11:46:19 -0000 1.22.2.2 --- mon 5 Dec 2007 17:54:55 -0000 1.22.2.3 *************** *** 5393,5401 **** no warnings; # Redefining syslog sub syslog { ! eval { ! local $SIG{"__DIE__"}= sub { }; ! my @log = map { s/\%//mg; } @_; ! Sys::Syslog::syslog(@log); ! } } use warnings; --- 5393,5403 ---- no warnings; # Redefining syslog sub syslog { ! return if (!@_); ! ! my $pri = (@_ == 1) ? "err" : shift; ! ! eval { Sys::Syslog::syslog ($pri, '%s', "@_"); }; ! ! print STDERR "syslog error: $@\n" if ($@ ne ""); } use warnings; |
From: Augie S. <as...@us...> - 2007-12-03 23:18:10
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18415/mon.d Modified Files: mon.monitor Log Message: Making the mon monitor alert when the scheduler is not running. Index: mon.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/mon.monitor,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mon.monitor 17 Jul 2007 18:01:26 -0000 1.2 --- mon.monitor 3 Dec 2007 23:18:05 -0000 1.3 *************** *** 62,65 **** --- 62,72 ---- my @st = $c->list_state; + if ($st[0] == 0) + { + push @failures, $host; + push @details, "$host: scheduler stopped since " . localtime ($st[1]) . "\n"; + undef $c; + next; + } if ($c->error ne "") |
From: Augie S. <as...@us...> - 2007-12-03 18:24:58
|
Update of /cvsroot/mon/mon In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7593 Modified Files: mon Log Message: Fixing syslog dying in eval because of attempted write to read-only variable; bug 1803008 - patch from Andrew Eason. Index: mon =================================================================== RCS file: /cvsroot/mon/mon/mon,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mon 15 Jul 2007 13:21:48 -0000 1.23 --- mon 3 Dec 2007 18:24:55 -0000 1.24 *************** *** 5395,5399 **** eval { local $SIG{"__DIE__"}= sub { }; ! my @log = map { s/\%//mg; } @_; Sys::Syslog::syslog(@log); } --- 5395,5402 ---- eval { local $SIG{"__DIE__"}= sub { }; ! my @log = @_; ! for ( @log ) { ! s/\%//mg; ! } Sys::Syslog::syslog(@log); } |
From: Augie S. <as...@us...> - 2007-12-01 00:28:17
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14856 Added Files: mysql-replication.monitor Log Message: Adding mysql-replication.monitor . --- NEW FILE: mysql-replication.monitor --- #!/usr/bin/perl # arguments: # [ --username=username --password=password --port=# ] hostname(s) use DBI; use Getopt::Long; my @details=(); my @failures=(); GetOptions( \%options, "port=i", "username=s", "password=s" , "seconds=i" ); # uncomment these two lines and provide suitable information if you don't # want to pass sensitive information on the command line $options{username} ||= "repl-check"; $options{password} ||= "m449kwf"; $options{port} ||= 3306; $options{seconds} ||= 3600; for $host( @ARGV ) { my( $dbh ) = DBI->connect( "DBI:mysql:host=$host:port=$options{port}", $options{username}, $options{password}, { PrintError => 0 } ); if( ! $dbh ) { push( @failures, $host); push( @details, "$host: Could not connect to MySQL server on $options{port}: " . $DBI::errstr . "\n"); next; } # Gather vital replication information. my $sth = $dbh->prepare('SHOW SLAVE STATUS'); $sth->execute; my $slave = $sth->fetchrow_hashref; $sth->finish; # Check those variables. if ( $slave->{Slave_IO_Running} ne 'Yes' ) { push( @failures, $host); push( @details, "$host: Slave IO thread is not running.\n"); next; } if ( $slave->{Slave_SQL_Running} ne 'Yes' ) { push( @failures, $host); push( @details, "$host: Slave SQL thread is not running.\n"); next; } if ( $slave->{Seconds_Behind_Master} > $options{seconds} ) { push( @failures, $host); push( @details, "$host: Slave is more than " . $options{seconds} . " seconds behind master.\n"); next; } $dbh->disconnect(); } if (@failures) { print join (" ", sort @failures), "\n"; print sort @details if (scalar @details > 0); exit 1; } else { exit 0; } |
From: Augie S. <as...@us...> - 2007-12-01 00:22:58
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12387 Modified Files: fping.monitor Log Message: Backporting bug fix from 1.2 branch Index: fping.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/fping.monitor,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fping.monitor 17 Apr 2005 07:42:27 -0000 1.3 --- fping.monitor 1 Dec 2007 00:22:53 -0000 1.4 *************** *** 69,73 **** { chomp; ! if (/^(\S+).*unreachable/i) { push (@unreachable, $1); --- 69,73 ---- { chomp; ! if (/^(\S+) is unreachable/i) { push (@unreachable, $1); |
From: Augie S. <as...@us...> - 2007-07-17 18:05:24
|
Update of /cvsroot/mon/mon/alert.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15447/alert.d Modified Files: snpp.alert Log Message: Fixing bug 1708251; snpp.alert does not work with 'use strict' enabled. Index: snpp.alert =================================================================== RCS file: /cvsroot/mon/mon/alert.d/snpp.alert,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** snpp.alert 9 Jun 2004 05:18:07 -0000 1.1.1.1 --- snpp.alert 17 Jul 2007 18:05:10 -0000 1.2 *************** *** 26,30 **** # use strict; ! use vars qw /$opt_g $opt_q $opt_s $opt_t/; use Getopt::Std; use Net::SNPP; --- 26,30 ---- # use strict; ! use vars qw /$opt_g $opt_q $opt_s $opt_t $opt_u/; use Getopt::Std; use Net::SNPP; *************** *** 32,36 **** getopts ("s:g:h:t:l:q:u"); ! $opt_q ||= 'localhost'; # --- 32,36 ---- getopts ("s:g:h:t:l:q:u"); ! my $opt_q ||= 'localhost'; # *************** *** 53,57 **** my $snpp = Net::SNPP->new ($opt_q) or die; ! $ALERT = $opt_u ? "UPALERT" : "ALERT"; $snpp->send ( Pager => [ @ARGV ], Message => "$ALERT $opt_g/$opt_s: $summary ($wday $mon $day $tm)" ); --- 53,57 ---- my $snpp = Net::SNPP->new ($opt_q) or die; ! my $ALERT = $opt_u ? "UPALERT" : "ALERT"; $snpp->send ( Pager => [ @ARGV ], Message => "$ALERT $opt_g/$opt_s: $summary ($wday $mon $day $tm)" ); |
From: Augie S. <as...@us...> - 2007-07-17 18:03:21
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14511/mon.d Modified Files: nntp.monitor Log Message: Fixing bug 1708241; nntp.monitor -f option does not parse properly. Index: nntp.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/nntp.monitor,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nntp.monitor 17 Apr 2005 07:42:27 -0000 1.2 --- nntp.monitor 17 Jul 2007 18:03:17 -0000 1.3 *************** *** 54,58 **** $PORT = $opt_p || 119; $TIMEOUT = $opt_t || 30; ! $FEEDER = $opt{"f"}; $DEBUG = $opt_d || ""; $USER = $opt_u || ''; --- 54,58 ---- $PORT = $opt_p || 119; $TIMEOUT = $opt_t || 30; ! $FEEDER = $opt_f; $DEBUG = $opt_d || ""; $USER = $opt_u || ''; |
From: Augie S. <as...@us...> - 2007-07-17 18:01:31
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12837/mon.d Modified Files: mon.monitor Log Message: Fixing bug 1708231; mon.monitor does not accept a password. Index: mon.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/mon.monitor,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** mon.monitor 9 Jun 2004 05:18:05 -0000 1.1.1.1 --- mon.monitor 17 Jul 2007 18:01:26 -0000 1.2 *************** *** 15,19 **** my %opt; ! getopts ('u:p:p:t:', \%opt); my @failures; --- 15,19 ---- my %opt; ! getopts ('u:P:p:t:', \%opt); my @failures; *************** *** 47,55 **** } ! if ($opt{"u"} && $opt{"p"}) { if (! defined $c->login ( "username" => $opt{"u"}, ! "password" => $opt{"p"}, )) { --- 47,55 ---- } ! if ($opt{"u"} && $opt{"P"}) { if (! defined $c->login ( "username" => $opt{"u"}, ! "password" => $opt{"P"}, )) { |
From: Augie S. <as...@us...> - 2007-07-17 17:53:08
|
Update of /cvsroot/mon/mon/clients In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4519/clients Modified Files: mon.cgi Log Message: Fixing bug 1686965; mon.cgi does not display ACK messages. Index: mon.cgi =================================================================== RCS file: /cvsroot/mon/mon/clients/mon.cgi,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mon.cgi 31 Jul 2005 16:59:13 -0000 1.4 --- mon.cgi 17 Jul 2007 17:52:37 -0000 1.5 *************** *** 175,179 **** # If you do not wish to use a config file, leave this variable empty. # ! $moncgi_config_file = ""; --- 175,179 ---- # If you do not wish to use a config file, leave this variable empty. # ! $moncgi_config_file = "/var/www/html/mon.cgi.cf"; *************** *** 1084,1088 **** # user requested it, otherwise, just pass it on through # as is. ! if ( $op{$group}{$service}{'ack'} == 1 ) { if ($untaint_ack_msgs) { # --- 1084,1088 ---- # user requested it, otherwise, just pass it on through # as is. ! if ( $op{$group}{$service}{'ack'} != 0 ) { if ($untaint_ack_msgs) { # *************** *** 1679,1683 **** $webpage->print("<td $ack_command_bgcolor colspan=1 width=50%>"); ! if ($op{$group}{$service}{'ack'} == 1) { # Service has already been acked, offer to re-ack $acknowledge_string = "<font size=+1><b>Re-acknowledge this failure:</b></font><br>(changes the acknowledgement message)<br>"; --- 1679,1683 ---- $webpage->print("<td $ack_command_bgcolor colspan=1 width=50%>"); ! if ($op{$group}{$service}{'ack'} != 0) { # Service has already been acked, offer to re-ack $acknowledge_string = "<font size=+1><b>Re-acknowledge this failure:</b></font><br>(changes the acknowledgement message)<br>"; |
From: Augie S. <as...@us...> - 2007-07-17 17:25:35
|
Update of /cvsroot/mon/mon/doc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5567/doc Modified Files: mon.8 Log Message: Adding documentation for unack_summary. Index: mon.8 =================================================================== RCS file: /cvsroot/mon/mon/doc/mon.8,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mon.8 31 Jul 2005 17:02:38 -0000 1.6 --- mon.8 17 Jul 2007 17:25:25 -0000 1.7 *************** *** 929,932 **** --- 929,939 ---- is available in the clients directory. + .TP + .BI "unack_summary = "[0|1|y|yes|n|no] + + If set to "yes" or "1", then an acknowledged alert for a service + will be un-acknowledged any time that the summary for that service + changes. + .SS "Hostgroup Entries" |
From: Augie S. <as...@us...> - 2007-07-16 23:39:29
|
Update of /cvsroot/mon/mon/etc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15875/etc Modified Files: S99mon Log Message: Fixing bug 1686296; the init script does not match where the RPM puts the binary, and 'restart' seems to work better for me this way. Index: S99mon =================================================================== RCS file: /cvsroot/mon/mon/etc/S99mon,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** S99mon 9 Jun 2004 05:18:06 -0000 1.1.1.1 --- S99mon 16 Jul 2007 23:39:20 -0000 1.2 *************** *** 22,26 **** start) echo -n "Starting mon daemon: " ! daemon /usr/lib/mon/mon -f -l -c /etc/mon/mon.cf echo touch /var/lock/subsys/mon --- 22,26 ---- start) echo -n "Starting mon daemon: " ! daemon /usr/sbin/mon -f -l -c /etc/mon/mon.cf echo touch /var/lock/subsys/mon *************** *** 36,40 **** ;; restart) ! killall -HUP mon ;; *) --- 36,41 ---- ;; restart) ! $0 stop ! $0 start ;; *) |
From: Jim T. <tr...@us...> - 2007-07-15 13:22:04
|
Update of /cvsroot/mon/mon In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16117 Modified Files: mon Log Message: updated some changes from mon-1.2.0 Index: mon =================================================================== RCS file: /cvsroot/mon/mon/mon,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mon 13 Jul 2006 12:03:39 -0000 1.22 --- mon 15 Jul 2007 13:21:48 -0000 1.23 *************** *** 1133,1141 **** if (defined $2) { if ($2 =~ /y(es)?/i) { ! $2 = 1; } elsif ($2 =~ /n(o)?/i) { ! $2 = 0; ! } ! if ($2 eq "0" || $2 eq "1") { $UNACK_SUMMARY = $2; } else { --- 1133,1140 ---- if (defined $2) { if ($2 =~ /y(es)?/i) { ! $UNACK_SUMMARY = 1; } elsif ($2 =~ /n(o)?/i) { ! $UNACK_SUMMARY = 0; ! } elsif ($2 eq "0" || $2 eq "1") { $UNACK_SUMMARY = $2; } else { *************** *** 2888,2911 **** } ! if (@notfound == 0) { foreach my $h (@hosts) { ! if (my $g=host_singleton_group($h) ) { disen_watch($g, 0); - $stchanged++; mysystem("$CF{MONREMOTE} disable watch $g") if ($CF{MONREMOTE}); - } else { - disen_host ($h, 0); - $stchanged++; - mysystem("$CF{MONREMOTE} disable host $h") if ($CF{MONREMOTE}); } } sock_write ($fh, "220 disable host completed\n"); } - else - { - sock_write ($fh, "520 disable host failed, @notfound does not exist\n"); - } } else { --- 2887,2915 ---- } ! if (@notfound) ! { ! sock_write ($fh, "520 disable host failed, host(s) @notfound do not exist\n"); ! } ! ! else { foreach my $h (@hosts) { ! # ! # disable a watch if there is a group with this host ! # as its only member. this prevents warning messages ! # about monitors not being run on empty host groups ! # ! foreach my $g (host_singleton_group($h)) { disen_watch($g, 0); mysystem("$CF{MONREMOTE} disable watch $g") if ($CF{MONREMOTE}); } + + disen_host ($h, 0); + $stchanged++; + mysystem("$CF{MONREMOTE} disable host $h") if ($CF{MONREMOTE}); } sock_write ($fh, "220 disable host completed\n"); } } else { *************** *** 2913,2917 **** } - # # enable watch, service or host --- 2917,2920 ---- *************** *** 2952,2964 **** } elsif ($cmd eq "host") { foreach my $h (split (/\s+/, $args)) { ! if (my $g=host_singleton_group($h) ) { disen_watch($g, 1); mysystem("$CF{MONREMOTE} enable watch $g") if ($CF{MONREMOTE}); - $stchanged++; - } else { - disen_host ($h, 1); - mysystem("$CF{MONREMOTE} enable host $h") if ($CF{MONREMOTE}); - $stchanged++; } } sock_write ($fh, "220 enable completed\n"); --- 2955,2966 ---- } elsif ($cmd eq "host") { foreach my $h (split (/\s+/, $args)) { ! foreach my $g (host_singleton_group($h)) { disen_watch($g, 1); mysystem("$CF{MONREMOTE} enable watch $g") if ($CF{MONREMOTE}); } + + disen_host ($h, 1); + mysystem("$CF{MONREMOTE} enable host $h") if ($CF{MONREMOTE}); + $stchanged++; } sock_write ($fh, "220 enable completed\n"); *************** *** 3796,3814 **** } sub host_singleton_group { my $host = shift; ! my $found; foreach my $g (keys %groups) { ! if (grep (/^$host$/, @{$groups{$g}}) && scalar(@{$groups{$g}}) == 1) { ! $found = $g; ! last; } } ! $found; } --- 3798,3823 ---- } + + + # + # given a host, search groups and return an array of group + # names which have that host as their only member. return + # an empty array if no group found + # + # sub host_singleton_group { my $host = shift; ! my @found; foreach my $g (keys %groups) { ! if (grep (/^\*?$host$/, @{$groups{$g}}) && scalar(@{$groups{$g}}) == 1) { ! push (@found, $g); } } ! return (@found); } |
From: Jim T. <tr...@us...> - 2007-06-27 11:51:23
|
Update of /cvsroot/mon/mon In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19963 Modified Files: Tag: mon-1-2-branch TODO Log Message: Index: TODO =================================================================== RCS file: /cvsroot/mon/mon/TODO,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** TODO 15 Nov 2004 14:45:16 -0000 1.2 --- TODO 27 Jun 2007 11:51:17 -0000 1.2.2.1 *************** *** 1,2 **** --- 1,97 ---- + -implement trap delivery for "redistribute" in the mon server itself as an + option. retain the "call script" behavior, but maybe specify internal + trap delivery via "redistribute -h hostname [hostname...]". also allow + multiple redistribute lines to build a list of scripts to call + + -deliver traps with acknowledgement via tcp + + -add protocol commands to dump entire status + configuration in one operation + to reduce latency (not so many serialized get/response operations just to + get status) + + -no alerts for n mins + + -better cookbook of examples, including some pre-fab m4 defines for templates + with focus on the ability to quickly configure mon out-of-the-box for + the most common setups + + -period "templates" + > like I have to repeat my period definitions all 260 times, one for + > each watch. we should have templates in the Mon config file for any + > kind of object so it can be reused. + + so do you mean a way to define a "template" for a period so that + you don't need to keep rewriting "wd {Sun-Sat}", or so that it'll use + some default period if you don't specify one, or what? i can see this + working a bunch of different ways. + + + like this? + + define period-template xyz + period wd {Sun-Sat} + alert mail.alert mi...@do... + alert page.alert mis...@do... + alertevery 1h + + + watch something + service something + period template(xyz) + + watch somethingelse + service something + period template(xyz) + # override the 1h + alertevery 2h + + + -my recent thoughts on config management are that the parsing should be + all modularized, (a keeping the config parsing code in a separate + perl module to be reused by other apps), + and there should be a way to turn the resulting data + structure into xml and importing the same back, not so you can write + your config by hand in xml, but so you can use some generic xml editing + tool to mess around with the config, to get one type of gui. + + -the most common things should be easiest to do, regardless of + a gui or text file config. that is what makes stuff "easy". however, + i don't think more complicated setups lend themselves to guis as much, + and in complicated setups you have to invest a lot of time to learn how + the tool works, and a fancy gui in that case is less of a payoff. + this is for configuration, i mean. fancy guis for reporting and stuff + are good, no doubt. + + -global alert definitions with their own squelches (alertevery, etc.) + > also, alarms need to be collated so pagers and cell phones don't get + > buried with large numbers of alerts. I have a custom solution that I + > wrote for this, but it's a lousy solution since it essentially implements + > its own paging system. + + i could see how it would be good to be able to define some alert + destinations *outside* of the period definitions, then refer to them + in the period definitions, then you can do "collation" that way. like + this: + + define global-alert xyz mail.alert xy...@lm... + alertevery 1h + + watch + service + period + globalalert xyz <---collated globally + + watch + service + period + globalalert xyz <---collated globally + alert mail.alert pd...@lm... <---not collated + + + that would be quite easy to do and i think very useful. you could + apply all the same squelch knobs (alertevery, etc.) to the global ones. + + ----- + (from mon-1.2.0) $Id$ *************** *** 18,21 **** --- 113,117 ---- -make "chainable" alerts + ?? i don't recall who asked for this or how it would work -make alerts nonblocking, and handle them in a similar fashion to *************** *** 28,39 **** -Document traps. - -fix client opstatus parsing by converting clients to use Mon::Client - -Make monitors parallelize their tasks, similar to fping.monitor. This is an important scalability problem. - -make changes to tkined so that it can query a mon server and - update the graphical map accordingly. - -re-vamp the host disabling. 1) store them in a table with a timeout on each so that they can automatically re-enable themselves so --- 124,130 ---- *************** *** 50,54 **** -maybe make a command that will disable an alert for a certain amount ! of time (maybe implement this as an at(1) job??) -make it possible to disable just one of multiple alarms in a service --- 141,145 ---- -maybe make a command that will disable an alert for a certain amount ! of time -make it possible to disable just one of multiple alarms in a service *************** *** 84,85 **** --- 175,369 ---- -g, -s group, service + ----------- + notes on a v2 protocol redesign from trockij + + - Configuring on a hostgroup scheme works very well. In the beginning, mon was + never intended to get this complex(tm), it was intended to be a tool + where it was easy to whip up custom monitoring scripts and alert scripts + and plug them into a framework which allowed them all to connect to each + other, and to have a way to easily build custom clients and report + generators as well. + + - However, per host status is needed now. + + - This requires changes to both mon itself and also the monitors / alerts. + + Backward compatibility is important, and KISS is very important to + retain the ease at which one can whip up a new monitor or alert or reporting + client. + + - There will be a new protocol for communicating with the monitors / alerts, + which will be masked by a Mon::Monitor / Mon::Alert module in Perl. + Appropriate shell functions will be provided by the first one who asks. + See below for the protocol. + + - We still want to retain the benefits of the old behaviour, but extend + some alert management features, such as the ability to liberate + alert definitions from the service periods so they can be used globally. + + - The server code might be broken up into multiple files (I/O routines, config + parser, related parts, etc) + + - monitors can communicate better with the alerts (see below). For example, + the monitor might hint (using "a_mail_list") the mail.alert about where else + to send a warning that a user dir goes over quota. + (Attention should be paid to privacy that we don't accidentially inform + all users that /home/foo/how-i-will-destroy-western-civilization/ + is consuming 1GB too much space ;) + + - Associations: these allow monitors to communicate details + about failures back to the server which can be used to specify who + to alert. + + The associations are based on key/value pairs specified in the + association config file, and are expanded on the alert command line + (or possibly within the alert protocol) if "@assoc-*" is in the + configuration. If a host assoc. is needed, an alert spec will look like: + + alert mail.alert ad...@xy... @assoc-host + + There are two association types (possibly more in the future): host + associations, and user-defined associations. Host associations use the + "assoc-host" specifier, and map one or more username to an individual + host. User-defined associations are just that, and begin with the + "assoc-u-" specifier. + + Monitors return associations via the "assoc-*" key in the monitor + protocol. + + Alerts obtain association information either via command-line arguments + which were expanded by the server from "@assoc-*" in the config file, + or via the "assoc-*" key in the alert protocol. + + - Metrics are only passed to the mon server for "monitoring" purposes, but can + be marked up in such a way that they could be easily piped to a logging + utility, one which is not part of the mon process itself. + monitors are _encouraged_ to collect and report performance data. + + "Failures" are basically just a conclusion based upon performance data and + it makes no sense to collect the data twice, e.g. if you have mon polling + ifInOctets.0 on a system, why should mrtg have to poll on its own. + + It may be desireable to propose a "unified logging system" which all + monitors can easily use, something which is pluggable and extensible + + - The hostgroup syntax is going to be extended to add per host options. (which + will be passed to the monitors / alerts using the new protocol) + ns1.teuto.net( fs="/(80%,90%)",mail_list="lm...@te..." ) + would be passed as "h_fs=/(80%,90%)" and "h_mail_list="lm...@te..." + + FLOATING MONITORS + + A floating monitor is started by mon and remains running for the entire time. + If it dies, it is automatically restarted. + + The server forks off a separate process for fping and communicates with + it via some IPC, like a named pipe or a socket or something. The floating + monitor sits there waiting for a message from the server that says "start + checking now". The server then adds this descriptor to %fhandles and %running + and treats it similar to other forked monitors. When the floting monitor is + done, it spits its output back to the server and then goes dormant again, + awaiting another message from the server. Floating monitors are started + when mon starts, and are restarted if mon notices that they go away. This + is a way to save on fork() overhead, but to also + + PROTOCOL + + The protocol will be simple and ASCII based, in the form of "key=value". Line + continuation will be provided by prefixing following lines with a ">". A "\n" + on a line by itself indicates the start of a new block. + + The order of the keys should not be important. + + The first block will always contain metadata further defining the following + blocks. The "version" key is always present. + + The current protocol version is "1". + + (In the examples, everything after a "#" is a comment and should be cut out) + + KEY CONVENTIONS + + Keys only private to monitors will be prefixed with an "m_". In the same + vain, keys private to alerts will be prefixed with a "a_", and additional + host option keys specified in the mon.cf file will be prefixed with a "h_" + before being passed to monitors/alerts. + + By convention, flags only pertaining to a specific alert will embed that name + in the key name too - ie keys only pertaining to "mail.alert" will start with + "a_mail_". + + The key/values pairs will be passed to all processes for a specific service. + "h_" are static between invocations as they come from the mon.cf file. "m_" + keys will be preserved between multiple monitor executions. "a_" keys will be + passed from the monitor to the alert script. + + + MONITOR PROTOCOL (monitor -> mon) + + The metadata block is followed by a block describing the overall hostgroup + status, followed by a detailled status for each host. + + The following keys are defined for the blocks: + "summary" = contains a one line short summary of the status. + "status" = up, fail, ignore + "metric_1" = an opaque floating point number which can be referenced for + triggering alerts. May try to give an "operational percentage". + More than one metric may be returned. + (Ping rtt, packet loss, disk space etc) + "description" = longer elaborate description of the current status. + "host" = hostgroup member to which this status applies. The overall + hostgroup status does not include this field. + "assoc-host" = host association + "assoc-u-*" = user-defined association + + Here is an example for a hypothetical hostgroup with 2 hosts and the ping + service. + + ### + version=1 + + summary=Still alive. + metric_1=50 # Packetloss + metric_2=20.23 # rtt times + description=1 out of 2 hosts still responding. + > Whatever else one might want to say about the status. It is difficult to + > come up with a good text here so I will just babble. + status=up + + host=foo.bar.com + metric_1=100 + metric_2=0 # 100% packet loss make rtt measurements difficult ;) + summary=ICMP unreachable from 2.2.2.2 + status=fail + description=PING 2.2.2.2 (2.2.2.2): 56 data bytes + > + >--- 2.2.2.2 ping statistics --- + >23 packets transmitted, 0 packets received, 100% packet loss + + metric_1=0 + metric_2=52.1 + summary=ICMP echo reply received ok + status=up + description=64 bytes from 212.8.197.2: icmp_seq=0 ttl=60 time=110.0 ms + >64 bytes from 212.8.197.2: icmp_seq=1 ttl=60 time=32.3 ms + >64 bytes from 212.8.197.2: icmp_seq=2 ttl=60 time=32.8 ms + >64 bytes from 212.8.197.2: icmp_seq=3 ttl=60 time=33.4 ms + > + >--- ns1.teuto.net ping statistics --- + >4 packets transmitted, 4 packets received, 0% packet loss + >round-trip min/avg/max = 32.3/52.1/110.0 ms + host=baz.bar.com + ###### + + + Points still open: + - mon -> monitor communication + + - mon <-> alert communication + + - the new trap protocol + + - muxpect + + - a unified logging proposal |