Permalink
Browse files

Bones of a README document

  • Loading branch information...
1 parent 249c4f4 commit f5a63471bc2bd2c9f5e8a6a60b4cd4fb8d68283f @barryo committed Oct 25, 2011
Showing with 102 additions and 15 deletions.
  1. +67 −0 README
  2. +9 −4 check_chassis_cisco.pl
  3. +9 −4 check_chassis_server.pl
  4. +8 −4 check_portsecurity.pl
  5. +9 −3 check_portstatus.pl
View
67 README
@@ -0,0 +1,67 @@
+Nagios Plugins :: nagios-plugins
+================================
+
+Introduction
+------------
+
+`nagios-plugins` is a collection of various plugins I have written and expaned
+over the last ten years or so. They main goal of Nagios plugins that I write
+and release are:
+
+* BSD (or BSD like) license so you can hack away to wield into something that
+ may be more suitable for your own environment;
+* scalable in that if I am polling power supply units (PSUs) in a Cisco switch
+ then it should not matter if there is one or a hundred - the script should
+ handle them all;
+* WARNINGs are designed for email notifications during working hours; CRITICAL
+ means an out of hours text / SMS message :(
+* Perl is not my first language but all scripts are written in Perl. Forgive
+ my inelegence (and give me C / C++ / PHP anyday!)
+* each script should be an independant unit with no dependancies on each
+ other or unusual Perl modules;
+* the scripts should all be run with the `--verbose` on new kit. This will
+ provide an inventory of what it finds as well as show anything that is being
+ skipped. OIDs searched for by the script but reported as not supported on
+ the target device should really be skipped via various `--skip-xxx` options.
+* useful help available via `--help` or `-?`
+
+License
+-------
+
+Unless stated otherwise at the top of the script of its help output, all scripts
+are:
+
+ Copyright (c) 2011, Barry O'Donovan <barry@opensolutions.ie>
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ list of conditions and the following disclaimer in the documentation and/or
+ other materials provided with the distribution.
+
+ * Neither the name of Open Solutions nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+About the Author
+----------------
+
+Please see my company website at http://www.opensolutions.ie/ or my own personal
+site at http://www.barryodonovan.com/.
+
View
@@ -93,6 +93,7 @@
my %threscpuarg;
my $verbose = 0;
+my $help = 0;
my $memwarn = 70;
my $memcrit = 90;
@@ -138,15 +139,16 @@
"thres-cpu-5sec=s", \$threscpuarg{'5sec'},
"thres-cpu-1min=s", \$threscpuarg{'1min'},
"thres-cpu-5min=s", \$threscpuarg{'5min'},
+ "help|?", \$help,
"verbose", \$verbose,
"reboot=i", \$rebootWindow
);
-if( $status == 0 )
-{
+if( !$status || $help ) {
usage();
}
+
usage() if( !defined( $hostname ) );
( $session, $error ) = Net::SNMP->session(
@@ -485,6 +487,7 @@ sub usage {
printf " * system load\n";
printf " * if the device was recently rebooted\n\n";
printf "Additional options:\n\n";
+ printf " --help This help message\n\n";
printf " --hostname The hostname to check\n";
printf " --port The port to query SNMP on (using: $port)\n";
printf " --community The SNMP access community (using: $community)\n\n";
@@ -508,13 +511,15 @@ sub usage {
printf( " --thres-cpu-5min CPU warning,critical thresholds for 5min checks (using %d,%d)\n\n", $threscpu{'5minw'}, $threscpu{'5minc'} );
printf " --reboot <integer> How many minutes ago should we warn that the device has been rebooted (using: " . $rebootWindow . ")\n\n";
- printf "\nCopyright (c) 2011, Barry O'Donovan\n";
+ printf "\nCopyright (c) 2011, Barry O'Donovan <barry\@opensolutions.ie>\n";
printf "All rights reserved.\n\n";
printf "check_chassis_server.pl comes with ABSOLUTELY NO WARRANTY\n";
printf "This programm is licensed under the terms of the ";
printf "BSD New License (check source code for details)\n";
printf "\n\n";
- exit $ERRORS{"UNKNOWN"};
+
+ exit $ERRORS{"UNKNOWN"} if !$help;
+ exit 0;
}
sub setstate {
View
@@ -89,6 +89,7 @@
my $skipmem = 0;
my $skipload = 0;
my $verbose = 0;
+my $help = 0;
@@ -110,15 +111,16 @@
"skipreboot", \$skipreboot,
"verbose", \$verbose,
"memwarn=i", \$memwarn,
+ "help|?", \$help,
"memcrit=i", \$memcrit,
"reboot=i", \$rebootWindow
);
-if( $status == 0 )
-{
+if( !$status || $help ) {
usage();
}
+
usage() if( !defined( $hostname ) );
( $session, $error ) = Net::SNMP->session(
@@ -308,6 +310,7 @@ sub usage {
printf " * system load\n";
printf " * if the device was recently rebooted\n\n";
printf "Additional options:\n\n";
+ printf " --help This help message\n\n";
printf " --hostname The hostname to check\n";
printf " --community The SNMP access community\n";
printf " --skipload Skip server load checks\n";
@@ -321,13 +324,15 @@ sub usage {
printf " --swapcrit <integer> Percentage of swap usage for critical (default: " . $swapcrit . ")\n";
printf " --loadwarn <float> Multiplier of load critical value for warning (default: " . $loadwarn . ")\n";
printf " (critical load value is taken from SNMP)\n";
- printf "\nCopyright (c) 2011, Barry O'Donovan\n";
+ printf "\nCopyright (c) 2011, Barry O'Donovan <barry\@opensolutions.ie>\n";
printf "All rights reserved.\n\n";
printf "check_chassis_server.pl comes with ABSOLUTELY NO WARRANTY\n";
printf "This programm is licensed under the terms of the ";
printf "BSD New License (check source code for details)\n";
printf "\n\n";
- exit $ERRORS{"UNKNOWN"};
+
+ exit $ERRORS{"UNKNOWN"} if !$help;
+ exit 0;
}
sub setstate {
View
@@ -73,7 +73,7 @@
my $alertOnSecureDown = 0;
my $verbose = 0;
-
+my $help = 0;
# Just in case of problems, let's not hang Nagios
$SIG{'ALRM'} = sub {
@@ -88,10 +88,11 @@
"community=s", \$community,
"port=i", \$port,
"verbose", \$verbose,
+ "help|?", \$help,
"alert-on-secure-down", \$alertOnSecureDown
);
-if( !$status ) {
+if( !$status || $help ) {
usage();
}
@@ -187,17 +188,20 @@ sub usage {
printf " security violation when the object cpsIfViolationAction is of type\n";
printf " 'shutdown'.\n\n";
printf "Additional options:\n\n";
+ printf " --help This help message\n\n";
printf " --hostname The hostname to check\n";
printf " --port The port to query SNMP on (using: $port)\n";
printf " --community The SNMP access community (using: $community)\n\n";
printf " --alert-on-secure-down If port is in SECUREDOWN state, generate a warning alert\n\n";
- printf "\nCopyright (c) 2011, Barry O'Donovan\n";
+ printf "\nCopyright (c) 2011, Barry O'Donovan <barry\@opensolutions.ie>\n";
printf "All rights reserved.\n\n";
printf "check_chassis_server.pl comes with ABSOLUTELY NO WARRANTY\n";
printf "This programm is licensed under the terms of the ";
printf "BSD New License (check source code for details)\n";
printf "\n\n";
- exit $ERRORS{"UNKNOWN"};
+
+ exit $ERRORS{"UNKNOWN"} if !$help;
+ exit 0;
}
sub setstate {
View
@@ -81,6 +81,7 @@
my $allports = 0;
my $verbose = 0;
+my $help = 0;
# Just in case of problems, let's not hang Nagios
@@ -97,13 +98,15 @@
"port=i", \$port,
"verbose", \$verbose,
"all-ports", \$allports,
+ "help|?", \$help,
"window=i", \$window
);
-if( !$status ) {
+if( !$status || $help ) {
usage();
}
+
usage() if( !defined( $hostname ) );
( $session, $error ) = Net::SNMP->session(
@@ -235,18 +238,21 @@ sub usage {
printf "Checks the operational status of the port and alerts if it changed within\n";
printf " \$window seconds ago (default: $window).\n\n";
printf "Additional options:\n\n";
+ printf " --help This help message\n\n";
printf " --hostname The hostname to check\n";
printf " --port The port to query SNMP on (using: $port)\n";
printf " --community The SNMP access community (using: $community)\n\n";
printf " --window If change occured within \$window seconds ago, then alert\n\n";
printf " --all-ports By default, we only examine Ethernet ports\n\n";
- printf "\nCopyright (c) 2011, Barry O'Donovan\n";
+ printf "\nCopyright (c) 2011, Barry O'Donovan <barry\@opensolutions.ie>\n";
printf "All rights reserved.\n\n";
printf "check_chassis_server.pl comes with ABSOLUTELY NO WARRANTY\n";
printf "This programm is licensed under the terms of the ";
printf "BSD New License (check source code for details)\n";
printf "\n\n";
- exit $ERRORS{"UNKNOWN"};
+
+ exit $ERRORS{"UNKNOWN"} if !$help;
+ exit 0;
}
sub setstate {

0 comments on commit f5a6347

Please sign in to comment.