mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Initial Import
git-svn-id: http://www.observium.org/svn/observer/trunk@2 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
12
COPYRIGHT
Normal file
12
COPYRIGHT
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Project Observer Copyright (C) 2007 Adam Armstrong
|
||||||
|
|
||||||
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
BIN
DejaVuSansCondensed.ttf
Normal file
BIN
DejaVuSansCondensed.ttf
Normal file
Binary file not shown.
BIN
DejaVuSansMono.ttf
Normal file
BIN
DejaVuSansMono.ttf
Normal file
Binary file not shown.
26
INSTALL
Normal file
26
INSTALL
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
Basic Installation Instructions
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
Point apache to the html directory. Give apache read/write access to rrd and graphs (check symlinks in html/ work!)
|
||||||
|
|
||||||
|
Create a database, give a user full privileges on it. Insert the mysql schema file into it.
|
||||||
|
|
||||||
|
Edit your config.php
|
||||||
|
|
||||||
|
Customise html/includes/topnav.inc to be useful for your organisation (put some handy links in it!)
|
||||||
|
|
||||||
|
Put cron.sh into your crontab for every 5 mins and cron-hourly.sh into your crontab for every hour.
|
||||||
|
|
||||||
|
add a host with 'host-add.php <hostname> <snmp community>'
|
||||||
|
|
||||||
|
Cisco network devices with cdp enabled should be detected automatically in waves each hour as it spiders outwards
|
||||||
|
(run discover.php manually to speed it up!)
|
||||||
|
|
||||||
|
Servers will need to be added manually.
|
||||||
|
|
||||||
|
Replace the logo!
|
||||||
|
|
||||||
|
Login to the web interface with the username 'admin' and the password 'observer'.
|
||||||
|
|
||||||
|
*** Drop me an email to adama@memetic.org ***
|
||||||
|
|
11
LICENCE
Normal file
11
LICENCE
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Copyright <20> 2006-2007 by Adam Armstrong.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. 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.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED "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 AUTHOR 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.
|
||||||
|
|
67
README
Normal file
67
README
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
Copyright (C) 2007 Adam Armstrong <adama@memetic.org>
|
||||||
|
|
||||||
|
Released under the GNU Public License
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
------------
|
||||||
|
|
||||||
|
Project Observer is an auto-discovering network monitoring system. It's not designed to be a drop-in replacement for
|
||||||
|
Nagios, Mon, JFFNMS or similar applications. It's designed to be an easily-navigable interface to the health of your
|
||||||
|
network.
|
||||||
|
|
||||||
|
***********************************************************
|
||||||
|
Release 0.2.4
|
||||||
|
Fixed some misnamed files
|
||||||
|
Fixed some hardcoded binary locations
|
||||||
|
Removed some messy AJAX
|
||||||
|
Replaced the menu bar
|
||||||
|
Added some new menu items
|
||||||
|
Cleaned up presentation of some pages
|
||||||
|
|
||||||
|
Release 0.2.3
|
||||||
|
Fixed some broken graphing code
|
||||||
|
Added host add/remove to web interface
|
||||||
|
Added host/interface/service status to web interface
|
||||||
|
Tidied up some code
|
||||||
|
|
||||||
|
Release 0.2.2
|
||||||
|
Replaced old layout with new 'Project Observer' layout
|
||||||
|
Added recognition of SNOM SIP phones, data collection and some graphing
|
||||||
|
Modified standard layout to remove Vostron-specific elements
|
||||||
|
Added cpu graphing for ProCurve devices
|
||||||
|
Added tabs for device page and AJAX loading of contents
|
||||||
|
Detection of HP ProCurve devices
|
||||||
|
Detection of m0n0wall devices by new snmp-id
|
||||||
|
Can now disable the Transit, Peering and Customer sections
|
||||||
|
Added some tabbing to Interface
|
||||||
|
Added detection of Net/Open/DragonFlyBSD
|
||||||
|
|
||||||
|
Release 0.2.1 - 19th January 2007
|
||||||
|
Modification of graphing disply style
|
||||||
|
Seperatation of device types
|
||||||
|
Implementation of storage graphing
|
||||||
|
|
||||||
|
Release 0.2.0 - 20th December 2006
|
||||||
|
Cleanup of graphing code
|
||||||
|
Seperation of customer-accessible interface
|
||||||
|
Preliminary alerting system
|
||||||
|
|
||||||
|
Release 0.1.2 - Late November 2006
|
||||||
|
Graphing of additional server-related data
|
||||||
|
|
||||||
|
Release 0.1.1 - November 2006
|
||||||
|
Removal of large amounts of perl.
|
||||||
|
|
||||||
|
Release 0.1.0 - October 2006
|
||||||
|
Initial Release.
|
||||||
|
Basic discovery in place. Graphing in place.
|
||||||
|
|
||||||
|
Feature Waiting List
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
* Verification of discovered devices and interfaces
|
||||||
|
* Serial number tracking
|
||||||
|
* Manual layer 1 linking
|
||||||
|
* Service Monitoring
|
||||||
|
* Alerting
|
||||||
|
* Temperature Monitoring
|
25
alerts.php
Executable file
25
alerts.php
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$alert_query = mysql_query("SELECT *, A.id as id FROM `alerts` as A, `devices` as D where A.device_id = D.id AND alerted = '0'");
|
||||||
|
while ($alert = mysql_fetch_array($alert_query)) {
|
||||||
|
$id = $alert['id'];
|
||||||
|
$host = $alert['hostname'];
|
||||||
|
$date = $alert['time_logged'];
|
||||||
|
$msg = $alert['message'];
|
||||||
|
$alert_text .= "$date $host $msg";
|
||||||
|
|
||||||
|
mysql_query("UPDATE `alerts` SET alerted = '1' WHERE `id` = '$id'");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($alert_text) {
|
||||||
|
echo("$alert_text");
|
||||||
|
# `echo '$alert_text' | gnokii --sendsms 07885729982`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
25
cdp.php
Executable file
25
cdp.php
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
include("includes/cdp.php");
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT id,hostname,community FROM `devices` WHERE `ignore` = '0' AND status = '1' AND `os` = 'IOS' ORDER BY `id` ASC");
|
||||||
|
while ($device = mysql_fetch_row($device_query)) {
|
||||||
|
|
||||||
|
echo("Detecting CDP neighbours on $device[1]...\n");
|
||||||
|
$snmp = new snmpCDP($device[1], $device[2]);
|
||||||
|
$ports = $snmp->getports();
|
||||||
|
$cdp = $snmp->explore_cdp($ports);
|
||||||
|
|
||||||
|
foreach (array_keys($cdp) as $key) {
|
||||||
|
$port = $ports[$key];
|
||||||
|
$link = $cdp[$key];
|
||||||
|
$loc_if[$key] = @mysql_result(mysql_query("SELECT `id` FROM `interfaces` WHERE host = '" . $device['id'] . "' AND `if` = '" . $port['desc'] . "'"), 0);
|
||||||
|
echo( $key . "||" . $hostname . "||" . $loc_if[$key] . "||" . $port['desc'] . "||" . $link['host'] . "||" . $link['port'] . "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
150
check-device.php
Executable file
150
check-device.php
Executable file
@@ -0,0 +1,150 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE id = '$argv[1]'");
|
||||||
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
|
||||||
|
$hostname = $device['hostname'];
|
||||||
|
$id = $device['id'];
|
||||||
|
$status = $device['status'];
|
||||||
|
unset($update);
|
||||||
|
unset($update_query);
|
||||||
|
unset($seperator);
|
||||||
|
unset($newversion);
|
||||||
|
unset($newuptime);
|
||||||
|
unset($newfeatures);
|
||||||
|
unset($newlocation);
|
||||||
|
unset($newhardware);
|
||||||
|
$pingable = isPingable($hostname);
|
||||||
|
$snmpable = FALSE;
|
||||||
|
if($pingable) {
|
||||||
|
$snmpable = isSNMPable($hostname);
|
||||||
|
}
|
||||||
|
echo("$snmpable");
|
||||||
|
if ($pingable !== FALSE && $snmpable !== FALSE ) {
|
||||||
|
$newstatus = '1';
|
||||||
|
$hardware = $device['hardware'];
|
||||||
|
$version = $device['version'];
|
||||||
|
$old_rebooted = $device['rebooted'];
|
||||||
|
$features = $device['features'];
|
||||||
|
$location = $device['location'];
|
||||||
|
$uptime = $device['uptime'];
|
||||||
|
$os = $device['os'];
|
||||||
|
if($os == "FreeBSD" || $os == "Linux" || $os == "Windows") { $uptimeoid = ".1.3.6.1.2.1.25.1.1.0"; } else { $uptimeoid = "1.3.6.1.2.1.1.3.0"; }
|
||||||
|
$snmp = "$uptimeoid sysLocation.0 .1.3.6.1.2.1.47.1.1.1.1.13.1 sysDescr.0";
|
||||||
|
$snmpdata = `snmpget -O qv -v2c -c $community $hostname $snmp | grep -v "Cisco Internetwork Operating System Software"`;
|
||||||
|
$snmpdata = preg_replace("/^.*IOS/","", $snmpdata);
|
||||||
|
$snmpdata = trim($snmpdata);
|
||||||
|
list($sysUptime, $sysLocation, $ciscomodel, $sysDescr) = explode("\n", $snmpdata);
|
||||||
|
$sysUptime = str_replace("(", "", $sysUptime);
|
||||||
|
$sysUptime = str_replace(")", "", $sysUptime);
|
||||||
|
list($days, $hours, $mins, $secs) = explode(":", $sysUptime);
|
||||||
|
list($secs, $microsecs) = explode(".", $secs);
|
||||||
|
$timeticks = mktime(0, $secs, $mins, $hours, $days, 0);
|
||||||
|
$hours = $hours + ($days * 24);
|
||||||
|
$mins = $mins + ($hours * 60);
|
||||||
|
$secs = $secs + ($mins * 60);
|
||||||
|
$newuptime = $secs;
|
||||||
|
if($os == "Windows") {
|
||||||
|
if(strstr($sysDescr, "x86")) { $newhardware = "x86 PC"; }
|
||||||
|
if(strstr($sysDescr, "Windows Version 5.2")) { $newversion = "2003 Server"; }
|
||||||
|
if(strstr($sysDescr, "Uniprocessor Free")) { $newfeatures = "Uniprocessor"; }
|
||||||
|
if(strstr($sysDescr, "Multiprocessor Free")) { $newfeatures = "Multiprocessor"; }
|
||||||
|
}
|
||||||
|
if($os == "FreeBSD") {
|
||||||
|
$sysDescr = str_replace(" 0 ", " ", $sysDescr);
|
||||||
|
list(,,$newversion) = explode (" ", $sysDescr);
|
||||||
|
$newhardware = "Generic";
|
||||||
|
list($newversion,$newfeatures) = explode("-", $newversion);
|
||||||
|
}
|
||||||
|
if($os == "Linux") {
|
||||||
|
list(,,$newversion) = explode (" ", $sysDescr);
|
||||||
|
if(strstr($sysDescr, "386")|| strstr($sysDescr, "486")||strstr($sysDescr, "586")||strstr($sysDescr, "686")) { $newhardware = "Generic x86"; }
|
||||||
|
list($newversion,$newfeatures,$newfeaturesb) = explode("-", $newversion);
|
||||||
|
}
|
||||||
|
if ($os == "IOS") {
|
||||||
|
$newversion = str_replace("Cisco IOS Software,", "", $sysDescr);
|
||||||
|
$newversion = str_replace("IOS (tm) ", "", $newversion);
|
||||||
|
$newversion = str_replace(",RELEASE SOFTWARE", "", $newversion);
|
||||||
|
$newversion = str_replace(",MAINTENANCE INTERIM SOFTWARE", "", $newversion);
|
||||||
|
$newversion = str_replace("Version ","", $newversion);
|
||||||
|
$newversion = str_replace("Cisco Internetwork Operating System Software", "", $newversion);
|
||||||
|
$newversion = trim($newversion);
|
||||||
|
list($newversion) = explode("\n", $newversion);
|
||||||
|
$newversion = preg_replace("/^[A-Za-z0-9\ \_]*\(([A-Za-z0-9\-\_]*)\), (.+), .*/", "\\1|\\2", $newversion);
|
||||||
|
$newversion = str_replace("-M|", "|", $newversion);
|
||||||
|
$newversion = str_replace("-", "|", $newversion);
|
||||||
|
echo("$newversion");
|
||||||
|
list($newhardware, $newfeatures, $newversion) = explode("|", $newversion);;
|
||||||
|
$newfeatures = fixIOSFeatures($newfeatures);
|
||||||
|
$newhardware = fixIOSHardware($newhardware);
|
||||||
|
if(!strstr($ciscomodel, " ")) {
|
||||||
|
echo("$ciscomodel");
|
||||||
|
$newhardware = str_replacE("\"", "", $ciscomodel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$newlocation = str_replace("\"","", $sysLocation);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$newstatus = '0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $newlocation && $location != $newlocation ) {
|
||||||
|
$update = "`location` = '$newlocation'";
|
||||||
|
$seperator = ", ";
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Changed location from $location to $newlocation')");
|
||||||
|
}
|
||||||
|
if ( $newversion && $version != $newversion ) {
|
||||||
|
$update .= $seperator . "`version` = '$newversion'";
|
||||||
|
$seperator = ", ";
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Changed version from $version to $newversion')");
|
||||||
|
}
|
||||||
|
if ( $newfeatures && $newfeatures != $features ) {
|
||||||
|
$update .= $seperator . "`features` = '$newfeatures'";
|
||||||
|
$seperator = ", ";
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Changed features from $features to $newfeatures')");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $newhardware && $newhardware != $hardware ) {
|
||||||
|
$update .= $seperator . "`hardware` = '$newhardware'";
|
||||||
|
$seperator = ", ";
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Changed hardware from $hardware to $newhardware')");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $newuptime && $uptime != $newuptime ) {
|
||||||
|
$update .= $seperator . "`uptime` = '$newuptime'";
|
||||||
|
$seperator = ", ";
|
||||||
|
}
|
||||||
|
if ( $newuptime && $newuptime < $uptime ) {
|
||||||
|
$update .= $seperator . "`lastchange` = NOW()";
|
||||||
|
$seperator = ", ";
|
||||||
|
} elseif($status != $newstatus) {
|
||||||
|
$update .= $seperator . "`lastchange` = NOW()";
|
||||||
|
$seperator = ", ";
|
||||||
|
}
|
||||||
|
if( $status != $newstatus ) {
|
||||||
|
$update .= $seperator . "`status` = '$newstatus'";
|
||||||
|
$seperator = ", ";
|
||||||
|
if ($newstatus == '1') { $stat = "Up";
|
||||||
|
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '$id', 'Device is up\n')");
|
||||||
|
} else {
|
||||||
|
$stat = "Down";
|
||||||
|
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('9', '$id', 'Device is down\n')");
|
||||||
|
}
|
||||||
|
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('$id', NULL, NOW(), 'Device status changed to $stat')");
|
||||||
|
}
|
||||||
|
if ($update) {
|
||||||
|
$update_query = "UPDATE `devices` SET ";
|
||||||
|
$update_query .= $update;
|
||||||
|
$update_query .= " WHERE `id` = '$id'";
|
||||||
|
echo("Updating : $hostname\n$update_query\n\n");
|
||||||
|
$update_result = mysql_query($update_query);
|
||||||
|
} else {
|
||||||
|
echo("Not Updating : $hostname \n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
30
check-services.php
Executable file
30
check-services.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM devices AS D, services AS S WHERE D.status = '1' AND S.service_host = D.id ORDER by D.id DESC";
|
||||||
|
$query = mysql_query($sql);
|
||||||
|
while ($service = mysql_fetch_array($query)) {
|
||||||
|
|
||||||
|
unset($check, $service_status, $time, $status);
|
||||||
|
|
||||||
|
$service_status = $service['service_status'];
|
||||||
|
|
||||||
|
$service_type = strtolower($service[service_type]);
|
||||||
|
|
||||||
|
$service_param = $service['service_param'];
|
||||||
|
|
||||||
|
$checker_script = "includes/services/" . $service_type . "/check.inc";
|
||||||
|
|
||||||
|
if(is_file($checker_script)) {
|
||||||
|
include($checker_script);
|
||||||
|
} else {
|
||||||
|
$status = "2";
|
||||||
|
$check = "Error : Script not found ($checker_script)";
|
||||||
|
}
|
||||||
|
if($service_status != $status) { $updated = ", `service_changed` = '" . time() . "' "; } else { unset($updated); }
|
||||||
|
mysql_query("UPDATE `services` SET `service_status` = '$status', `service_message` = '$check', `service_checked` = '" . time() . "' $updated WHERE `service_id` = '$service[service_id]'");
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
160
checkers/check_bl
Executable file
160
checkers/check_bl
Executable file
@@ -0,0 +1,160 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# check_bl plugin for nagios
|
||||||
|
# $Revision: 1.0 $
|
||||||
|
#
|
||||||
|
# Nagios plugin designed to warn you if you mail servers appear in one of the
|
||||||
|
# many anti-spam 'blacklists'
|
||||||
|
#
|
||||||
|
# By Sam Bashton, Bashton Ltd
|
||||||
|
# bashton.com/content/nagios-plugins
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
use Net::DNS;
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
my ($verbose,$host),;
|
||||||
|
my ($opt_V,$opt_h,$opt_B,$opt_H,$opt_c);
|
||||||
|
$opt_V = $opt_h = $opt_B = $opt_H = $opt_c = '';
|
||||||
|
my $state = 'UNKNOWN';
|
||||||
|
sub print_help();
|
||||||
|
sub print_usage();
|
||||||
|
|
||||||
|
$PROGNAME = "check_bl";
|
||||||
|
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'LC_ALL'}='C';
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions(
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||||
|
"B=s" => \$opt_B, "blacklists=s" => \$opt_B,
|
||||||
|
"c=s" => \$opt_c, "critical=s" => \$opt_c
|
||||||
|
);
|
||||||
|
|
||||||
|
# -h means display verbose help screen
|
||||||
|
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
|
||||||
|
|
||||||
|
# -V means display version number
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.0 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# First check the hostname is OK..
|
||||||
|
unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; }
|
||||||
|
|
||||||
|
if (! utils::is_hostname($opt_H)){
|
||||||
|
print "$opt_H is not a valid host name\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
if ($opt_H =~ /[a-zA-Z]/ )
|
||||||
|
# If the host contains letters we assume it's a hostname, not an IP
|
||||||
|
{
|
||||||
|
$host = lookup($opt_H);
|
||||||
|
}
|
||||||
|
else { $host = $opt_H }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# $opt_c is a count of the blacklists a mail server is in,
|
||||||
|
# after which state will be CRITICAL rather than WARNING
|
||||||
|
# By default any listing is CRITICAL
|
||||||
|
my $critcount = 0;
|
||||||
|
if ($opt_c) { $critcount = $opt_c };
|
||||||
|
|
||||||
|
# $opt_B is a comma seperated list of blacklists
|
||||||
|
$opt_B = shift unless ($opt_B);
|
||||||
|
unless ($opt_B) { print_usage(); exit -1 }
|
||||||
|
my @bls = split(/,/, $opt_B);
|
||||||
|
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: No response from BL server (alarm)\n");
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
alarm($TIMEOUT);
|
||||||
|
|
||||||
|
my %listed; # Hash of blacklists we're listed in.
|
||||||
|
foreach(@bls)
|
||||||
|
{
|
||||||
|
if (blcheck($host,$_)) { $listed{$_} = 1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar(keys(%listed)) == 0) { $state = 'OK' }
|
||||||
|
elsif (scalar(keys(%listed)) < $critcount) { $state = 'WARNING' }
|
||||||
|
else { $state = 'CRITICAL' }
|
||||||
|
|
||||||
|
if (%listed)
|
||||||
|
{
|
||||||
|
print "Listed at";
|
||||||
|
foreach (keys(%listed)) { print " $_" }
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
else { print "Not black-listed\n" }
|
||||||
|
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
|
||||||
|
|
||||||
|
######## Subroutines ==========================
|
||||||
|
|
||||||
|
|
||||||
|
sub print_help() {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.0 $ ');
|
||||||
|
print "\n";
|
||||||
|
support();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: \n";
|
||||||
|
print " $PROGNAME -H host -B [blacklist1],[blacklist2] [-c critnum]\n";
|
||||||
|
print " $PROGNAME [-h | --help]\n";
|
||||||
|
print " $PROGNAME [-V | --version]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub blcheck
|
||||||
|
{
|
||||||
|
my ($ip, $bl) = @_;
|
||||||
|
my $lookupip = $ip;
|
||||||
|
$lookupip =~
|
||||||
|
s/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/$4.$3.$2.$1.$bl/;
|
||||||
|
if (lookup($lookupip)) { return 1 }
|
||||||
|
else { return 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
sub lookup
|
||||||
|
{
|
||||||
|
my $tolookup = shift;
|
||||||
|
my $res = Net::DNS::Resolver->new;
|
||||||
|
my $query = $res->search($tolookup);
|
||||||
|
if ($query)
|
||||||
|
{
|
||||||
|
foreach my $rr ($query->answer)
|
||||||
|
{
|
||||||
|
next unless $rr->type eq "A"; # We're not interested in TXT records
|
||||||
|
return $rr->address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
87
checkers/check_breeze
Executable file
87
checkers/check_breeze
Executable file
@@ -0,0 +1,87 @@
|
|||||||
|
#! /usr/bin/perl -wT
|
||||||
|
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
|
||||||
|
use lib "/usr/lib/nagios/plugins" ;
|
||||||
|
use utils qw(%ERRORS &print_revision &support &usage);
|
||||||
|
|
||||||
|
$PROGNAME = "check_breeze";
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||||
|
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||||
|
"C=s" => \$opt_C, "community=s" => \$opt_C);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.5 $');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||||
|
|
||||||
|
($opt_H) || usage("Host name/address not specified\n");
|
||||||
|
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
|
||||||
|
($host) || usage("Invalid host: $opt_H\n");
|
||||||
|
|
||||||
|
($opt_w) || usage("Warning threshold not specified\n");
|
||||||
|
my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/);
|
||||||
|
($warning) || usage("Invalid warning threshold: $opt_w\n");
|
||||||
|
|
||||||
|
($opt_c) || usage("Critical threshold not specified\n");
|
||||||
|
my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/);
|
||||||
|
($critical) || usage("Invalid critical threshold: $opt_c\n");
|
||||||
|
|
||||||
|
($opt_C) || ($opt_C = "public") ;
|
||||||
|
|
||||||
|
my $sig=0;
|
||||||
|
$sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`;
|
||||||
|
my @test=split(/ /,$sig);
|
||||||
|
$sig=$test[2];
|
||||||
|
$sig=int($sig);
|
||||||
|
if ($sig>100){$sig=100}
|
||||||
|
|
||||||
|
print "Signal Strength at: $sig%\n";
|
||||||
|
|
||||||
|
exit $ERRORS{'CRITICAL'} if ($sig<$critical);
|
||||||
|
exit $ERRORS{'WARNING'} if ($sig<$warning);
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -H <host> [-C community] -w <warn> -c <crit>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.5 $');
|
||||||
|
print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop
|
||||||
|
|
||||||
|
This plugin reports the signal strength of a Breezecom wireless equipment
|
||||||
|
|
||||||
|
";
|
||||||
|
print_usage();
|
||||||
|
print "
|
||||||
|
-H, --hostname=HOST
|
||||||
|
Name or IP address of host to check
|
||||||
|
-C, --community=community
|
||||||
|
SNMPv1 community (default public)
|
||||||
|
-w, --warning=INTEGER
|
||||||
|
Percentage strength below which a WARNING status will result
|
||||||
|
-c, --critical=INTEGER
|
||||||
|
Percentage strength below which a CRITICAL status will result
|
||||||
|
|
||||||
|
";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/check_by_ssh
Executable file
BIN
checkers/check_by_ssh
Executable file
Binary file not shown.
BIN
checkers/check_dhcp
Executable file
BIN
checkers/check_dhcp
Executable file
Binary file not shown.
BIN
checkers/check_dig
Executable file
BIN
checkers/check_dig
Executable file
Binary file not shown.
BIN
checkers/check_disk
Executable file
BIN
checkers/check_disk
Executable file
Binary file not shown.
296
checkers/check_disk_smb
Executable file
296
checkers/check_disk_smb
Executable file
@@ -0,0 +1,296 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
|
||||||
|
#
|
||||||
|
# Nagios host script to get the disk usage from a SMB share
|
||||||
|
#
|
||||||
|
# Changes and Modifications
|
||||||
|
# =========================
|
||||||
|
# 7-Aug-1999 - Michael Anthon
|
||||||
|
# Created from check_disk.pl script provided with netsaint_statd (basically
|
||||||
|
# cause I was too lazy (or is that smart?) to write it from scratch)
|
||||||
|
# 8-Aug-1999 - Michael Anthon
|
||||||
|
# Modified [warn] and [critical] parameters to accept format of nnn[M|G] to
|
||||||
|
# allow setting of limits in MBytes or GBytes. Percentage settings for large
|
||||||
|
# drives is a pain in the butt
|
||||||
|
# 2-May-2002 - SGhosh fix for embedded perl
|
||||||
|
#
|
||||||
|
# $Id: check_disk_smb.pl,v 1.12 2005/04/17 22:22:41 seanius Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
require 5.004;
|
||||||
|
use POSIX;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose);
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
use lib "/usr/lib/nagios/plugins" ;
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
$PROGNAME = "check_disk_smb";
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("v" => \$verbose, "verbose" => \$verbose,
|
||||||
|
"P=s" => \$opt_P, "port=s" => \$opt_P,
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||||
|
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||||
|
"p=s" => \$opt_p, "password=s" => \$opt_p,
|
||||||
|
"u=s" => \$opt_u, "username=s" => \$opt_u,
|
||||||
|
"s=s" => \$opt_s, "share=s" => \$opt_s,
|
||||||
|
"W=s" => \$opt_W, "workgroup=s" => \$opt_W,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||||
|
"a=s" => \$opt_a, "address=s" => \$opt_a);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.12 $'); #'
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||||
|
|
||||||
|
my $smbclient= "$utils::PATH_TO_SMBCLIENT " ;
|
||||||
|
my $smbclientoptions= $opt_P ? "-p $opt_P " : "";
|
||||||
|
|
||||||
|
|
||||||
|
# Options checking
|
||||||
|
|
||||||
|
($opt_H) || ($opt_H = shift) || usage("Host name not specified\n");
|
||||||
|
my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/);
|
||||||
|
($host) || usage("Invalid host: $opt_H\n");
|
||||||
|
|
||||||
|
($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n");
|
||||||
|
my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/);
|
||||||
|
($share) || usage("Invalid share: $opt_s\n");
|
||||||
|
|
||||||
|
($opt_u) || ($opt_u = shift) || ($opt_u = "guest");
|
||||||
|
my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/);
|
||||||
|
($user) || usage("Invalid user: $opt_u\n");
|
||||||
|
|
||||||
|
($opt_p) || ($opt_p = shift) || ($opt_p = "");
|
||||||
|
my $pass = $1 if ($opt_p =~ /(.*)/);
|
||||||
|
|
||||||
|
($opt_w) || ($opt_w = shift) || ($opt_w = 85);
|
||||||
|
my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
|
||||||
|
($warn) || usage("Invalid warning threshold: $opt_w\n");
|
||||||
|
|
||||||
|
($opt_c) || ($opt_c = shift) || ($opt_c = 95);
|
||||||
|
my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
|
||||||
|
($crit) || usage("Invalid critical threshold: $opt_c\n");
|
||||||
|
|
||||||
|
# split the type from the unit value
|
||||||
|
#Check $warn and $crit for type (%/M/G) and set up for tests
|
||||||
|
#P = Percent, K = KBytes
|
||||||
|
my $warn_type;
|
||||||
|
my $crit_type;
|
||||||
|
|
||||||
|
if ($opt_w =~ /^([0-9]+)\%?$/) {
|
||||||
|
$warn = "$1";
|
||||||
|
$warn_type = "P";
|
||||||
|
} elsif ($opt_w =~ /^([0-9]+)k$/) {
|
||||||
|
$warn_type = "K";
|
||||||
|
$warn = $1;
|
||||||
|
} elsif ($opt_w =~ /^([0-9]+)M$/) {
|
||||||
|
$warn_type = "K";
|
||||||
|
$warn = $1 * 1024;
|
||||||
|
} elsif ($opt_w =~ /^([0-9]+)G$/) {
|
||||||
|
$warn_type = "K";
|
||||||
|
$warn = $1 * 1048576;
|
||||||
|
}
|
||||||
|
if ($opt_c =~ /^([0-9]+)\%?$/) {
|
||||||
|
$crit = "$1";
|
||||||
|
$crit_type = "P";
|
||||||
|
} elsif ($opt_c =~ /^([0-9]+)k$/) {
|
||||||
|
$crit_type = "K";
|
||||||
|
$crit = $1;
|
||||||
|
} elsif ($opt_c =~ /^([0-9]+)M$/) {
|
||||||
|
$crit_type = "K";
|
||||||
|
$crit = $1 * 1024;
|
||||||
|
} elsif ($opt_c =~ /^([0-9]+)G$/) {
|
||||||
|
$crit_type = "K";
|
||||||
|
$crit = $1 * 1048576;
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if both warning and critical are percentage or size
|
||||||
|
unless( ( $warn_type eq "P" && $crit_type eq "P" ) || ( $warn_type ne "P" && $crit_type ne "P" ) ){
|
||||||
|
$opt_w =~ s/\%/\%\%/g;
|
||||||
|
$opt_c =~ s/\%/\%\%/g;
|
||||||
|
usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n");
|
||||||
|
}
|
||||||
|
|
||||||
|
# verify warning is less than critical
|
||||||
|
if ( $warn_type eq "K") {
|
||||||
|
unless ( $warn > $crit) {
|
||||||
|
usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
unless ( $warn < $crit) {
|
||||||
|
$opt_w =~ s/\%/\%\%/g;
|
||||||
|
$opt_c =~ s/\%/\%\%/g;
|
||||||
|
usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $workgroup = $1 if (defined($opt_W) && $opt_W =~ /(.*)/);
|
||||||
|
|
||||||
|
my $address = $1 if (defined($opt_a) && $opt_a =~ /(.*)/);
|
||||||
|
|
||||||
|
# end of options checking
|
||||||
|
|
||||||
|
|
||||||
|
my $state = "OK";
|
||||||
|
my $answer = undef;
|
||||||
|
my $res = undef;
|
||||||
|
my @lines = undef;
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print "No Answer from Client\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
alarm($TIMEOUT);
|
||||||
|
|
||||||
|
# Execute an "ls" on the share using smbclient program
|
||||||
|
# get the results into $res
|
||||||
|
if (defined($workgroup)) {
|
||||||
|
if (defined($address)) {
|
||||||
|
print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls\n" if ($verbose);
|
||||||
|
$res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls/;
|
||||||
|
} else {
|
||||||
|
print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose);
|
||||||
|
$res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -c ls/;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (defined($address)) {
|
||||||
|
print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -I $address -c ls\n" if ($verbose);
|
||||||
|
$res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -I $address -c ls/;
|
||||||
|
} else {
|
||||||
|
print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose);
|
||||||
|
$res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -c ls/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#Turn off alarm
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
#Split $res into an array of lines
|
||||||
|
@lines = split /\n/, $res;
|
||||||
|
|
||||||
|
#Get the last line into $_
|
||||||
|
$_ = $lines[$#lines];
|
||||||
|
#print "$_\n";
|
||||||
|
|
||||||
|
#Process the last line to get free space.
|
||||||
|
#If line does not match required regexp, return an UNKNOWN error
|
||||||
|
if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) {
|
||||||
|
|
||||||
|
my ($avail) = ($3*$2)/1024;
|
||||||
|
my ($avail_bytes) = $avail;
|
||||||
|
my ($capper) = int(($3/$1)*100);
|
||||||
|
my ($mountpt) = "\\\\$host\\$share";
|
||||||
|
|
||||||
|
|
||||||
|
if (int($avail / 1024) > 0) {
|
||||||
|
$avail = int($avail / 1024);
|
||||||
|
if (int($avail /1024) > 0) {
|
||||||
|
$avail = (int(($avail / 1024)*100))/100;
|
||||||
|
$avail = $avail ."G";
|
||||||
|
} else {
|
||||||
|
$avail = $avail ."M";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$avail = $avail ."K";
|
||||||
|
}
|
||||||
|
|
||||||
|
#print ":$warn:$warn_type:\n";
|
||||||
|
#print ":$crit:$crit_type:\n";
|
||||||
|
#print ":$avail:$avail_bytes:$capper:$mountpt:\n";
|
||||||
|
|
||||||
|
if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) {
|
||||||
|
$answer = "Disk ok - $avail ($capper%) free on $mountpt\n";
|
||||||
|
} elsif ((($crit_type eq "P") && (100 - $capper) < $crit) || (($crit_type eq "K") && ($avail_bytes > $crit))) {
|
||||||
|
$state = "WARNING";
|
||||||
|
$answer = "WARNING: Only $avail ($capper%) free on $mountpt\n";
|
||||||
|
} else {
|
||||||
|
$state = "CRITICAL";
|
||||||
|
$answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$answer = "Result from smbclient not suitable\n";
|
||||||
|
$state = "UNKNOWN";
|
||||||
|
foreach (@lines) {
|
||||||
|
if (/(Access denied|NT_STATUS_LOGON_FAILURE)/) {
|
||||||
|
$answer = "Access Denied\n";
|
||||||
|
$state = "CRITICAL";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
if (/(Unknown host \w*|Connection.*failed)/) {
|
||||||
|
$answer = "$1\n";
|
||||||
|
$state = "CRITICAL";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) {
|
||||||
|
$answer = "Invalid share name \\\\$host\\$share\n";
|
||||||
|
$state = "CRITICAL";
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print $answer;
|
||||||
|
print "$state\n" if ($verbose);
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -H <host> -s <share> -u <user> -p <password>
|
||||||
|
-w <warn> -c <crit> [-W <workgroup>] [-P <port>] [-a <IP>]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.12 $');
|
||||||
|
print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop
|
||||||
|
|
||||||
|
Perl Check SMB Disk plugin for Nagios
|
||||||
|
|
||||||
|
";
|
||||||
|
print_usage();
|
||||||
|
print "
|
||||||
|
-H, --hostname=HOST
|
||||||
|
NetBIOS name of the server
|
||||||
|
-s, --share=STRING
|
||||||
|
Share name to be tested
|
||||||
|
-W, --workgroup=STRING
|
||||||
|
Workgroup or Domain used (Defaults to \"WORKGROUP\")
|
||||||
|
-a, --address=IP
|
||||||
|
IP-address of HOST (only necessary if HOST is in another network)
|
||||||
|
-u, --user=STRING
|
||||||
|
Username to log in to server. (Defaults to \"guest\")
|
||||||
|
-p, --password=STRING
|
||||||
|
Password to log in to server. (Defaults to an empty password)
|
||||||
|
-w, --warning=INTEGER or INTEGER[kMG]
|
||||||
|
Percent of used space at which a warning will be generated (Default: 85%)
|
||||||
|
|
||||||
|
-c, --critical=INTEGER or INTEGER[kMG]
|
||||||
|
Percent of used space at which a critical will be generated (Defaults: 95%)
|
||||||
|
-P, --port=INTEGER
|
||||||
|
Port to be used to connect to. Some Windows boxes use 139, others 445 (Defaults to smbclient default)
|
||||||
|
|
||||||
|
If thresholds are followed by either a k, M, or G then check to see if that
|
||||||
|
much disk space is available (kilobytes, Megabytes, Gigabytes)
|
||||||
|
|
||||||
|
Warning percentage should be less than critical
|
||||||
|
Warning (remaining) disk space should be greater than critical.
|
||||||
|
|
||||||
|
";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/check_dns
Executable file
BIN
checkers/check_dns
Executable file
Binary file not shown.
BIN
checkers/check_dummy
Executable file
BIN
checkers/check_dummy
Executable file
Binary file not shown.
113
checkers/check_file_age
Executable file
113
checkers/check_file_age
Executable file
@@ -0,0 +1,113 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
# $Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $
|
||||||
|
|
||||||
|
# check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com>
|
||||||
|
#
|
||||||
|
# Checks a file's size and modification time to make sure it's not empty
|
||||||
|
# and that it's sufficiently recent.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# 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 (or with Nagios); if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use English;
|
||||||
|
use Getopt::Long;
|
||||||
|
use File::stat;
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw (%ERRORS &print_revision &support);
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V);
|
||||||
|
my ($result, $message, $age, $size, $st);
|
||||||
|
|
||||||
|
$PROGNAME="check_file_age";
|
||||||
|
|
||||||
|
$opt_w = 240;
|
||||||
|
$opt_c = 600;
|
||||||
|
$opt_W = 0;
|
||||||
|
$opt_C = 0;
|
||||||
|
$opt_f = "";
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions(
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"f=s" => \$opt_f, "file" => \$opt_f,
|
||||||
|
"w=f" => \$opt_w, "warning-age=f" => \$opt_w,
|
||||||
|
"W=f" => \$opt_W, "warning-size=f" => \$opt_W,
|
||||||
|
"c=f" => \$opt_c, "critical-age=f" => \$opt_c,
|
||||||
|
"C=f" => \$opt_C, "critical-size=f" => \$opt_C);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME, '$Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt_f = shift unless ($opt_f);
|
||||||
|
|
||||||
|
if (! $opt_f) {
|
||||||
|
print "No file specified\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Examine the file.
|
||||||
|
unless (-f $opt_f) {
|
||||||
|
print "$opt_f: File not found\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
$st = File::stat::stat($opt_f);
|
||||||
|
$age = time - $st->mtime;
|
||||||
|
$size = $st->size;
|
||||||
|
|
||||||
|
|
||||||
|
$result = 'OK';
|
||||||
|
|
||||||
|
if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) {
|
||||||
|
$result = 'CRITICAL';
|
||||||
|
}
|
||||||
|
elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
|
||||||
|
$result = 'WARNING';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "$result - $opt_f is $age seconds old and $size bytes\n";
|
||||||
|
exit $ERRORS{$result};
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage:\n";
|
||||||
|
print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n";
|
||||||
|
print " $PROGNAME [-h | --help]\n";
|
||||||
|
print " $PROGNAME [-V | --version]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME, '$Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $');
|
||||||
|
print "Copyright (c) 2003 Steven Grimm\n\n";
|
||||||
|
print_usage();
|
||||||
|
print "\n";
|
||||||
|
print " <secs> File must be no more than this many seconds old\n";
|
||||||
|
print " <size> File must be at least this many bytes long\n";
|
||||||
|
print "\n";
|
||||||
|
support();
|
||||||
|
}
|
245
checkers/check_flexlm
Executable file
245
checkers/check_flexlm
Executable file
@@ -0,0 +1,245 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# check_flexlm.pl license_file
|
||||||
|
#
|
||||||
|
# Check available flexlm license managers.
|
||||||
|
# Use lmstat to check the status of the license server
|
||||||
|
# described by the license file given as argument.
|
||||||
|
# Check and interpret the output of lmstat
|
||||||
|
# and create returncodes and output.
|
||||||
|
#
|
||||||
|
# Contrary to the nagios concept, this script takes
|
||||||
|
# a file, not a hostname as an argument and returns
|
||||||
|
# the status of hosts and services described in that
|
||||||
|
# file. Use these hosts.cfg entries as an example
|
||||||
|
#
|
||||||
|
#host[anchor]=any host will do;some.address.com;;check-host-alive;3;120;24x7;1;1;1;
|
||||||
|
#service[anchor]=yodel;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yodel_lic
|
||||||
|
#service[anchor]=yeehaw;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yeehaw_lic
|
||||||
|
#command[check_flexlm]=/some/path/libexec/check_flexlm.pl $ARG1$
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
# - you need the lmstat utility which comes with flexlm.
|
||||||
|
# - set the correct path in the variable $lmstat.
|
||||||
|
#
|
||||||
|
# initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com
|
||||||
|
#
|
||||||
|
# License: GPL
|
||||||
|
# $Id: check_flexlm.pl,v 1.6 2003/02/04 06:16:16 sghosh Exp $
|
||||||
|
#
|
||||||
|
# lmstat output patches from Steve Rigler/Cliff Rice 13-Apr-2002
|
||||||
|
# srigler@marathonoil.com,cerice@marathonoil.com
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME);
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw(%ERRORS &print_revision &support &usage);
|
||||||
|
|
||||||
|
$PROGNAME="check_flexlm";
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v" => \$verbose, "verbose" => \$verbose,
|
||||||
|
"F=s" => \$opt_F, "filename=s" => \$opt_F,
|
||||||
|
"t=i" => \$opt_t, "timeout=i" => \$opt_t);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.6 $');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (defined $opt_t) {
|
||||||
|
$opt_t = $utils::TIMEOUT ; # default timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||||
|
|
||||||
|
unless (defined $opt_F) {
|
||||||
|
print "Missing license.dat file\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print "Timeout: No Answer from Client\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
};
|
||||||
|
alarm($opt_t);
|
||||||
|
|
||||||
|
my $lmstat = $utils::PATH_TO_LMSTAT ;
|
||||||
|
unless (-x $lmstat ) {
|
||||||
|
print "Cannot find \"lmstat\"\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
($opt_F) || ($opt_F = shift) || usage("License file not specified\n");
|
||||||
|
my $licfile = $1 if ($opt_F =~ /^(.*)$/);
|
||||||
|
($licfile) || usage("Invalid filename: $opt_F\n");
|
||||||
|
|
||||||
|
print "$licfile\n" if $verbose;
|
||||||
|
|
||||||
|
if ( ! open(CMD,"$lmstat -c $licfile |") ) {
|
||||||
|
print "ERROR: Could not open \"$lmstat -c $licfile\" ($!)\n";
|
||||||
|
exit exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
my $serverup = 0;
|
||||||
|
my @upsrv;
|
||||||
|
my @downsrv; # list of servers up and down
|
||||||
|
|
||||||
|
#my ($ls1,$ls2,$ls3,$lf1,$lf2,$lf3,$servers);
|
||||||
|
|
||||||
|
# key off of the term "license server" and
|
||||||
|
# grab the status. Keep going until "Vendor" is found
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Collect list of license servers by their status
|
||||||
|
# Vendor daemon status is ignored for the moment.
|
||||||
|
|
||||||
|
while ( <CMD> ) {
|
||||||
|
next if (/^lmstat/); # ignore 1st line - copyright
|
||||||
|
next if (/^Flexible/); # ignore 2nd line - timestamp
|
||||||
|
(/^Vendor/) && last; # ignore Vendor daemon status
|
||||||
|
print $_ if $verbose;
|
||||||
|
|
||||||
|
if ($_ =~ /license server /) { # matched 1 (of possibly 3) license server
|
||||||
|
s/^\s*//; #some servers start at col 1, other have whitespace
|
||||||
|
# strip staring whitespace if any
|
||||||
|
if ( $_ =~ /UP/) {
|
||||||
|
$_ =~ /^(.*):/ ;
|
||||||
|
push(@upsrv, $1);
|
||||||
|
print "up:$1:\n" if $verbose;
|
||||||
|
} else {
|
||||||
|
$_ =~ /^(.*):/;
|
||||||
|
push(@downsrv, $1);
|
||||||
|
print "down:$1:\n" if $verbose;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# if ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*)/ ) {
|
||||||
|
# $ls1 = $1;
|
||||||
|
# $ls2 = $2;
|
||||||
|
# $ls3 = $3;
|
||||||
|
# $lf1 = $lf2 = $lf3 = 0;
|
||||||
|
# $servers = 3;
|
||||||
|
# } elsif ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*)/ ) {
|
||||||
|
# $ls1 = $1;
|
||||||
|
# $ls2 = $ls3 = "";
|
||||||
|
# $lf1 = $lf2 = $lf3 = 0;
|
||||||
|
# $servers = 1;
|
||||||
|
# } elsif ( / *$ls1: license server UP/ ) {
|
||||||
|
# print "$ls1 UP, ";
|
||||||
|
# $lf1 = 1
|
||||||
|
# } elsif ( / *$ls2: license server UP/ ) {
|
||||||
|
# print "$ls2 UP, ";
|
||||||
|
# $lf2 = 1
|
||||||
|
# } elsif ( / *$ls3: license server UP/ ) {
|
||||||
|
# print "$ls3 UP, ";
|
||||||
|
# $lf3 = 1
|
||||||
|
# } elsif ( / *([^:]*: UP .*)/ ) {
|
||||||
|
# print " license server for $1\n";
|
||||||
|
# $serverup = 1;
|
||||||
|
# }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if ( $serverup == 0 ) {
|
||||||
|
# print " license server not running\n";
|
||||||
|
# exit 2;
|
||||||
|
#}
|
||||||
|
|
||||||
|
close CMD;
|
||||||
|
|
||||||
|
if ($verbose) {
|
||||||
|
print "License Servers running: ".scalar(@upsrv) ."\n";
|
||||||
|
foreach my $upserver (@upsrv) {
|
||||||
|
print "$upserver\n";
|
||||||
|
}
|
||||||
|
print "License servers not running: ".scalar(@downsrv)."\n";
|
||||||
|
foreach my $downserver (@downsrv) {
|
||||||
|
print "$downserver\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# print list of servers which are up.
|
||||||
|
#
|
||||||
|
if (scalar(@upsrv) > 0) {
|
||||||
|
print "License Servers running:";
|
||||||
|
foreach my $upserver (@upsrv) {
|
||||||
|
print "$upserver,";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#
|
||||||
|
# Ditto for those which are down.
|
||||||
|
#
|
||||||
|
if (scalar(@downsrv) > 0) {
|
||||||
|
print "License servers NOT running:";
|
||||||
|
foreach my $downserver (@downsrv) {
|
||||||
|
print "$downserver,";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# perfdata
|
||||||
|
print "\n|flexlm::up:".scalar(@upsrv).";down:".scalar(@downsrv)."\n";
|
||||||
|
|
||||||
|
exit $ERRORS{'OK'} if ( scalar(@downsrv) == 0 );
|
||||||
|
exit $ERRORS{'WARNING'} if ( (scalar(@upsrv) > 0) && (scalar(@downsrv) > 0));
|
||||||
|
|
||||||
|
#exit $ERRORS{'OK'} if ( $servers == $lf1 + $lf2 + $lf3 );
|
||||||
|
#exit $ERRORS{'WARNING'} if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );
|
||||||
|
exit $ERRORS{'CRITICAL'};
|
||||||
|
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage:
|
||||||
|
$PROGNAME -F <filename> [-v] [-t] [-V] [-h]
|
||||||
|
$PROGNAME --help
|
||||||
|
$PROGNAME --version
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.6 $');
|
||||||
|
print "Copyright (c) 2000 Ernst-Dieter Martin/Karl DeBisschop
|
||||||
|
|
||||||
|
Check available flexlm license managers
|
||||||
|
|
||||||
|
";
|
||||||
|
print_usage();
|
||||||
|
print "
|
||||||
|
-F, --filename=FILE
|
||||||
|
Name of license file (usually \"license.dat\")
|
||||||
|
-v, --verbose
|
||||||
|
Print some extra debugging information (not advised for normal operation)
|
||||||
|
-t, --timeout
|
||||||
|
Plugin time out in seconds (default = $utils::TIMEOUT )
|
||||||
|
-V, --version
|
||||||
|
Show version and license information
|
||||||
|
-h, --help
|
||||||
|
Show this help screen
|
||||||
|
|
||||||
|
Flexlm license managers usually run as a single server or three servers and a
|
||||||
|
quorum is needed. The plugin return OK if 1 (single) or 3 (triple) servers
|
||||||
|
are running, CRITICAL if 1(single) or 3 (triple) servers are down, and WARNING
|
||||||
|
if 1 or 2 of 3 servers are running\n
|
||||||
|
";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/check_fping
Executable file
BIN
checkers/check_fping
Executable file
Binary file not shown.
1
checkers/check_ftp
Symbolic link
1
checkers/check_ftp
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_game
Executable file
BIN
checkers/check_game
Executable file
Binary file not shown.
BIN
checkers/check_hpjd
Executable file
BIN
checkers/check_hpjd
Executable file
Binary file not shown.
BIN
checkers/check_http
Executable file
BIN
checkers/check_http
Executable file
Binary file not shown.
BIN
checkers/check_icmp
Executable file
BIN
checkers/check_icmp
Executable file
Binary file not shown.
505
checkers/check_ifoperstatus
Executable file
505
checkers/check_ifoperstatus
Executable file
@@ -0,0 +1,505 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# check_ifoperstatus.pl - nagios plugin
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000 Christoph Kron,
|
||||||
|
# Modified 5/2002 to conform to updated Nagios Plugin Guidelines
|
||||||
|
# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh)
|
||||||
|
# Added SNMPv3 support (10/2003)
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Report bugs to: nagiosplug-help@lists.sourceforge.net
|
||||||
|
#
|
||||||
|
# 11.01.2000 Version 1.0
|
||||||
|
# $Id: check_ifoperstatus.pl,v 1.6 2004/12/07 03:13:14 mattkent Exp $
|
||||||
|
#
|
||||||
|
# Patches from Guy Van Den Bergh to warn on ifadminstatus down interfaces
|
||||||
|
# instead of critical.
|
||||||
|
#
|
||||||
|
# Primary MIB reference - RFC 2863
|
||||||
|
|
||||||
|
|
||||||
|
use POSIX;
|
||||||
|
use strict;
|
||||||
|
use lib "/usr/lib/nagios/plugins" ;
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
|
||||||
|
use Net::SNMP;
|
||||||
|
use Getopt::Long;
|
||||||
|
&Getopt::Long::config('bundling');
|
||||||
|
|
||||||
|
my $PROGNAME = "check_ifoperstatus";
|
||||||
|
sub print_help ();
|
||||||
|
sub usage ();
|
||||||
|
sub process_arguments ();
|
||||||
|
|
||||||
|
my $timeout;
|
||||||
|
my $status;
|
||||||
|
my %ifOperStatus = ('1','up',
|
||||||
|
'2','down',
|
||||||
|
'3','testing',
|
||||||
|
'4','unknown',
|
||||||
|
'5','dormant',
|
||||||
|
'6','notPresent',
|
||||||
|
'7','lowerLayerDown'); # down due to the state of lower layer interface(s)
|
||||||
|
|
||||||
|
my $state = "UNKNOWN";
|
||||||
|
my $answer = "";
|
||||||
|
my $snmpkey = 0;
|
||||||
|
my $community = "public";
|
||||||
|
my $maxmsgsize = 1472 ; # Net::SNMP default is 1472
|
||||||
|
my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context);
|
||||||
|
my $port = 161;
|
||||||
|
my @snmpoids;
|
||||||
|
my $sysUptime = '1.3.6.1.2.1.1.3.0';
|
||||||
|
my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2';
|
||||||
|
my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7';
|
||||||
|
my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8';
|
||||||
|
my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1';
|
||||||
|
my $snmpIfLastChange = '1.3.6.1.2.1.2.2.1.9';
|
||||||
|
my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18';
|
||||||
|
my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28';
|
||||||
|
my $hostname;
|
||||||
|
my $ifName;
|
||||||
|
my $session;
|
||||||
|
my $error;
|
||||||
|
my $response;
|
||||||
|
my $snmp_version = 1 ;
|
||||||
|
my $ifXTable;
|
||||||
|
my $opt_h ;
|
||||||
|
my $opt_V ;
|
||||||
|
my $ifdescr;
|
||||||
|
my $key;
|
||||||
|
my $lastc;
|
||||||
|
my $dormantWarn;
|
||||||
|
my $adminWarn;
|
||||||
|
my $name;
|
||||||
|
|
||||||
|
### Validate Arguments
|
||||||
|
|
||||||
|
$status = process_arguments();
|
||||||
|
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: No snmp response from $hostname (alarm)\n");
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
|
||||||
|
alarm($timeout);
|
||||||
|
|
||||||
|
|
||||||
|
## map ifdescr to ifindex - should look at being able to cache this value
|
||||||
|
|
||||||
|
if (defined $ifdescr) {
|
||||||
|
# escape "/" in ifdescr - very common in the Cisco world
|
||||||
|
$ifdescr =~ s/\//\\\//g;
|
||||||
|
|
||||||
|
$status=fetch_ifdescr(); # if using on device with large number of interfaces
|
||||||
|
# recommend use of SNMP v2 (get-bulk)
|
||||||
|
if ($status==0) {
|
||||||
|
$state = "UNKNOWN";
|
||||||
|
printf "$state: could not retrive ifdescr snmpkey - $status-$snmpkey\n";
|
||||||
|
$session->close;
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Main function
|
||||||
|
|
||||||
|
$snmpIfAdminStatus = $snmpIfAdminStatus . "." . $snmpkey;
|
||||||
|
$snmpIfOperStatus = $snmpIfOperStatus . "." . $snmpkey;
|
||||||
|
$snmpIfDescr = $snmpIfDescr . "." . $snmpkey;
|
||||||
|
$snmpIfName = $snmpIfName . "." . $snmpkey ;
|
||||||
|
$snmpIfAlias = $snmpIfAlias . "." . $snmpkey ;
|
||||||
|
|
||||||
|
push(@snmpoids,$snmpIfAdminStatus);
|
||||||
|
push(@snmpoids,$snmpIfOperStatus);
|
||||||
|
push(@snmpoids,$snmpIfDescr);
|
||||||
|
push(@snmpoids,$snmpIfName) if (defined $ifXTable) ;
|
||||||
|
push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ;
|
||||||
|
|
||||||
|
if (!defined($response = $session->get_request(@snmpoids))) {
|
||||||
|
$answer=$session->error;
|
||||||
|
$session->close;
|
||||||
|
$state = 'WARNING';
|
||||||
|
print ("$state: SNMP error: $answer\n");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
$answer = sprintf("host '%s', %s(%s) is %s\n",
|
||||||
|
$hostname,
|
||||||
|
$response->{$snmpIfDescr},
|
||||||
|
$snmpkey,
|
||||||
|
$ifOperStatus{$response->{$snmpIfOperStatus}}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
## Check to see if ifName match is requested and it matches - exit if no match
|
||||||
|
## not the interface we want to monitor
|
||||||
|
if ( defined $name && not ($response->{$snmpIfName} eq $name) ) {
|
||||||
|
$state = 'UNKNOWN';
|
||||||
|
$answer = "Interface name ($name) doesn't match snmp value ($response->{$snmpIfName}) (index $snmpkey)";
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
## define the interface name
|
||||||
|
if (defined $ifXTable) {
|
||||||
|
$name = $response->{$snmpIfName} ." - " .$response->{$snmpIfAlias} ;
|
||||||
|
}else{
|
||||||
|
$name = $response->{$snmpIfDescr} ;
|
||||||
|
}
|
||||||
|
|
||||||
|
## if AdminStatus is down - some one made a consious effort to change config
|
||||||
|
##
|
||||||
|
if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
|
||||||
|
$answer = "Interface $name (index $snmpkey) is administratively down.";
|
||||||
|
if ( not defined $adminWarn or $adminWarn eq "w" ) {
|
||||||
|
$state = 'WARNING';
|
||||||
|
} elsif ( $adminWarn eq "i" ) {
|
||||||
|
$state = 'OK';
|
||||||
|
} elsif ( $adminWarn eq "c" ) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
} else { # If wrong value for -a, say warning
|
||||||
|
$state = 'WARNING';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
## Check operational status
|
||||||
|
elsif ( $response->{$snmpIfOperStatus} == 2 ) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is down.";
|
||||||
|
} elsif ( $response->{$snmpIfOperStatus} == 5 ) {
|
||||||
|
if (defined $dormantWarn ) {
|
||||||
|
if ($dormantWarn eq "w") {
|
||||||
|
$state = 'WARNING';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is dormant.";
|
||||||
|
}elsif($dormantWarn eq "c") {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is dormant.";
|
||||||
|
}elsif($dormantWarn eq "i") {
|
||||||
|
$state = 'OK';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is dormant.";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
# dormant interface - but warning/critical/ignore not requested
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is dormant.";
|
||||||
|
}
|
||||||
|
} elsif ( $response->{$snmpIfOperStatus} == 6 ) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) notPresent - possible hotswap in progress.";
|
||||||
|
} elsif ( $response->{$snmpIfOperStatus} == 7 ) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) down due to lower layer being down.";
|
||||||
|
|
||||||
|
} elsif ( $response->{$snmpIfOperStatus} == 3 || $response->{$snmpIfOperStatus} == 4 ) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = "Interface $name (index $snmpkey) down (testing/unknown).";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$state = 'OK';
|
||||||
|
$answer = "Interface $name (index $snmpkey) is up.";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
|
||||||
|
|
||||||
|
### subroutines
|
||||||
|
|
||||||
|
sub fetch_ifdescr {
|
||||||
|
if (!defined ($response = $session->get_table($snmpIfDescr))) {
|
||||||
|
$answer=$session->error;
|
||||||
|
$session->close;
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
printf ("$state: SNMP error with snmp version $snmp_version ($answer)\n");
|
||||||
|
$session->close;
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $key ( keys %{$response}) {
|
||||||
|
if ($response->{$key} =~ /^$ifdescr$/) {
|
||||||
|
$key =~ /.*\.(\d+)$/;
|
||||||
|
$snmpkey = $1;
|
||||||
|
#print "$ifdescr = $key / $snmpkey \n"; #debug
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unless (defined $snmpkey) {
|
||||||
|
$session->close;
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
printf "$state: Could not match $ifdescr on $hostname\n";
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $snmpkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub usage() {
|
||||||
|
printf "\nMissing arguments!\n";
|
||||||
|
printf "\n";
|
||||||
|
printf "usage: \n";
|
||||||
|
printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\n";
|
||||||
|
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||||
|
printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n";
|
||||||
|
printf "This programm is licensed under the terms of the ";
|
||||||
|
printf "GNU General Public License\n(check source code for details)\n";
|
||||||
|
printf "\n\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help() {
|
||||||
|
printf "check_ifoperstatus plugin for Nagios monitors operational \n";
|
||||||
|
printf "status of a particular network interface on the target host\n";
|
||||||
|
printf "\nUsage:\n";
|
||||||
|
printf " -H (--hostname) Hostname to query - (required)\n";
|
||||||
|
printf " -C (--community) SNMP read community (defaults to public,\n";
|
||||||
|
printf " used with SNMP v1 and v2c\n";
|
||||||
|
printf " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||||
|
printf " 2 for SNMP v2c\n";
|
||||||
|
printf " SNMP v2c will use get_bulk for less overhead\n";
|
||||||
|
printf " if monitoring with -d\n";
|
||||||
|
printf " -L (--seclevel) choice of \"noAuthNoPriv\", \"authNoPriv\", or \"authPriv\"\n";
|
||||||
|
printf " -U (--secname) username for SNMPv3 context\n";
|
||||||
|
printf " -c (--context) SNMPv3 context name (default is empty string)";
|
||||||
|
printf " -A (--authpass) authentication password (cleartext ascii or localized key\n";
|
||||||
|
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
|
||||||
|
printf " auth password and authEngineID\n";
|
||||||
|
printf " -a (--authproto) Authentication protocol ( MD5 or SHA1)\n";
|
||||||
|
printf " -X (--privpass) privacy password (cleartext ascii or localized key\n";
|
||||||
|
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
|
||||||
|
printf " privacy password and authEngineID\n";
|
||||||
|
printf " -k (--key) SNMP IfIndex value\n";
|
||||||
|
printf " -d (--descr) SNMP ifDescr value\n";
|
||||||
|
printf " -p (--port) SNMP port (default 161)\n";
|
||||||
|
printf " -I (--ifmib) Agent supports IFMIB ifXTable. Do not use if\n";
|
||||||
|
printf " you don't know what this is. \n";
|
||||||
|
printf " -n (--name) the value should match the returned ifName\n";
|
||||||
|
printf " (Implies the use of -I)\n";
|
||||||
|
printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n";
|
||||||
|
printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n";
|
||||||
|
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
|
||||||
|
printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
|
||||||
|
printf " -V (--version) Plugin version\n";
|
||||||
|
printf " -h (--help) usage help \n\n";
|
||||||
|
printf " -k or -d must be specified\n\n";
|
||||||
|
printf "Note: either -k or -d must be specified and -d is much more network \n";
|
||||||
|
printf "intensive. Use it sparingly or not at all. -n is used to match against\n";
|
||||||
|
printf "a much more descriptive ifName value in the IfXTable to verify that the\n";
|
||||||
|
printf "snmpkey has not changed to some other network interface after a reboot.\n\n";
|
||||||
|
print_revision($PROGNAME, '$Revision: 1.6 $');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub process_arguments() {
|
||||||
|
$status = GetOptions(
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version,
|
||||||
|
"C=s" => \$community, "community=s" => \$community,
|
||||||
|
"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
|
||||||
|
"a=s" => \$authproto, "authproto=s" => \$authproto,
|
||||||
|
"U=s" => \$secname, "secname=s" => \$secname,
|
||||||
|
"A=s" => \$authpass, "authpass=s" => \$authpass,
|
||||||
|
"X=s" => \$privpass, "privpass=s" => \$privpass,
|
||||||
|
"c=s" => \$context, "context=s" => \$context,
|
||||||
|
"k=i" => \$snmpkey, "key=i",\$snmpkey,
|
||||||
|
"d=s" => \$ifdescr, "descr=s" => \$ifdescr,
|
||||||
|
"l=s" => \$lastc, "lastchange=s" => \$lastc,
|
||||||
|
"p=i" => \$port, "port=i" =>\$port,
|
||||||
|
"H=s" => \$hostname, "hostname=s" => \$hostname,
|
||||||
|
"I" => \$ifXTable, "ifmib" => \$ifXTable,
|
||||||
|
"n=s" => \$ifName, "name=s" => \$ifName,
|
||||||
|
"w=s" => \$dormantWarn, "warn=s" => \$dormantWarn,
|
||||||
|
"D=s" => \$adminWarn, "admin-down=s" => \$adminWarn,
|
||||||
|
"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
|
||||||
|
"t=i" => \$timeout, "timeout=i" => \$timeout,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if ($status == 0){
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.6 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! utils::is_hostname($hostname)){
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unless ($snmpkey > 0 || defined $ifdescr){
|
||||||
|
printf "Either a valid snmpkey key (-k) or a ifDescr (-d) must be provided)\n";
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (defined $name) {
|
||||||
|
$ifXTable=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $dormantWarn) {
|
||||||
|
unless ($dormantWarn =~ /^(w|c|i)$/ ) {
|
||||||
|
printf "Dormant alerts must be one of w|c|i \n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (defined $timeout) {
|
||||||
|
$timeout = $TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($snmp_version =~ /3/ ) {
|
||||||
|
# Must define a security level even though default is noAuthNoPriv
|
||||||
|
# v3 requires a security username
|
||||||
|
if (defined $seclevel && defined $secname) {
|
||||||
|
|
||||||
|
# Must define a security level even though defualt is noAuthNoPriv
|
||||||
|
unless ($seclevel eq ('noAuthNoPriv' || 'authNoPriv' || 'authPriv' ) ) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Authentication wanted
|
||||||
|
if ($seclevel eq ('authNoPriv' || 'authPriv') ) {
|
||||||
|
|
||||||
|
unless ($authproto eq ('MD5' || 'SHA1') ) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !defined $authpass) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
if ($authpass =~ /^0x/ ) {
|
||||||
|
$auth = "-authkey => $authpass" ;
|
||||||
|
}else{
|
||||||
|
$auth = "-authpassword => $authpass";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Privacy (DES encryption) wanted
|
||||||
|
if ($seclevel eq 'authPriv' ) {
|
||||||
|
if (! defined $privpass) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
if ($privpass =~ /^0x/){
|
||||||
|
$priv = "-privkey => $privpass";
|
||||||
|
}else{
|
||||||
|
$priv = "-privpassword => $privpass";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Context name defined or default
|
||||||
|
|
||||||
|
unless ( defined $context) {
|
||||||
|
$context = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'}; ;
|
||||||
|
}
|
||||||
|
} # end snmpv3
|
||||||
|
|
||||||
|
|
||||||
|
if ( $snmp_version =~ /[12]/ ) {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-community => $community,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-maxmsgsize => $maxmsgsize
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!defined($session)) {
|
||||||
|
$state='UNKNOWN';
|
||||||
|
$answer=$error;
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
}elsif ( $snmp_version =~ /3/ ) {
|
||||||
|
|
||||||
|
if ($seclevel eq 'noAuthNoPriv') {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
);
|
||||||
|
|
||||||
|
}elsif ( $seclevel eq 'authNoPriv' ) {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
$auth,
|
||||||
|
-authprotocol => $authproto,
|
||||||
|
);
|
||||||
|
}elsif ($seclevel eq 'authPriv' ) {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
$auth,
|
||||||
|
-authprotocol => $authproto,
|
||||||
|
$priv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!defined($session)) {
|
||||||
|
$state='UNKNOWN';
|
||||||
|
$answer=$error;
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$state='UNKNOWN';
|
||||||
|
print ("$state: No support for SNMP v$snmp_version yet\n");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
## End validation
|
||||||
|
|
459
checkers/check_ifstatus
Executable file
459
checkers/check_ifstatus
Executable file
@@ -0,0 +1,459 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# check_ifstatus.pl - nagios plugin
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Copyright (C) 2000 Christoph Kron
|
||||||
|
# Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh)
|
||||||
|
# Added -x option (4/2003)
|
||||||
|
# Added -u option (4/2003)
|
||||||
|
# Added -M option (10/2003)
|
||||||
|
# Added SNMPv3 support (10/2003)
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net
|
||||||
|
#
|
||||||
|
# 11.01.2000 Version 1.0
|
||||||
|
#
|
||||||
|
# $Id: check_ifstatus.pl,v 1.9 2004/08/18 19:51:35 tonvoon Exp $
|
||||||
|
|
||||||
|
use POSIX;
|
||||||
|
use strict;
|
||||||
|
use lib "/usr/lib/nagios/plugins" ;
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
|
||||||
|
use Net::SNMP;
|
||||||
|
use Getopt::Long;
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
|
||||||
|
my $PROGNAME = "check_ifstatus";
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub usage ();
|
||||||
|
sub process_arguments ();
|
||||||
|
|
||||||
|
|
||||||
|
my $status;
|
||||||
|
my %ifOperStatus = ('1','up',
|
||||||
|
'2','down',
|
||||||
|
'3','testing',
|
||||||
|
'4','unknown',
|
||||||
|
'5','dormant',
|
||||||
|
'6','notPresent',
|
||||||
|
'7','lowerLayerDown'); # down due to the state of lower layer interface(s));
|
||||||
|
|
||||||
|
my $timeout ;
|
||||||
|
my $state = "UNKNOWN";
|
||||||
|
my $answer = "";
|
||||||
|
my $snmpkey=0;
|
||||||
|
my $snmpoid=0;
|
||||||
|
my $key=0;
|
||||||
|
my $community = "public";
|
||||||
|
my $maxmsgsize = 1472 ; # Net::SNMP default is 1472
|
||||||
|
my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context);
|
||||||
|
my $port = 161;
|
||||||
|
my @snmpoids;
|
||||||
|
my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7';
|
||||||
|
my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2';
|
||||||
|
my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8';
|
||||||
|
my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1';
|
||||||
|
my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18';
|
||||||
|
my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28';
|
||||||
|
my $snmpIfType = '1.3.6.1.2.1.2.2.1.3';
|
||||||
|
my $hostname;
|
||||||
|
my $session;
|
||||||
|
my $error;
|
||||||
|
my $response;
|
||||||
|
my %ifStatus;
|
||||||
|
my $ifup =0 ;
|
||||||
|
my $ifdown =0;
|
||||||
|
my $ifdormant = 0;
|
||||||
|
my $ifexclude = 0 ;
|
||||||
|
my $ifunused = 0;
|
||||||
|
my $ifmessage = "";
|
||||||
|
my $snmp_version = 1;
|
||||||
|
my $ifXTable;
|
||||||
|
my $opt_h ;
|
||||||
|
my $opt_V ;
|
||||||
|
my $opt_u;
|
||||||
|
my $opt_x ;
|
||||||
|
my %excluded ;
|
||||||
|
my @unused_ports ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: No snmp response from $hostname (alarm timeout)\n");
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#Option checking
|
||||||
|
$status = process_arguments();
|
||||||
|
|
||||||
|
if ($status != 0)
|
||||||
|
{
|
||||||
|
print_help() ;
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
alarm($timeout);
|
||||||
|
|
||||||
|
push(@snmpoids,$snmpIfOperStatus);
|
||||||
|
push(@snmpoids,$snmpIfAdminStatus);
|
||||||
|
push(@snmpoids,$snmpIfDescr);
|
||||||
|
push(@snmpoids,$snmpIfType);
|
||||||
|
push(@snmpoids,$snmpIfName) if ( defined $ifXTable);
|
||||||
|
push(@snmpoids,$snmpIfAlias) if ( defined $ifXTable);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach $snmpoid (@snmpoids) {
|
||||||
|
|
||||||
|
if (!defined($response = $session->get_table($snmpoid))) {
|
||||||
|
$answer=$session->error;
|
||||||
|
$session->close;
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
if ( ( $snmpoid =~ $snmpIfName ) && defined $ifXTable ) {
|
||||||
|
print ("$state: Device does not support ifTable - try without -I option\n");
|
||||||
|
}else{
|
||||||
|
print ("$state: $answer for $snmpoid with snmp version $snmp_version\n");
|
||||||
|
}
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $snmpkey (keys %{$response}) {
|
||||||
|
$snmpkey =~ /.*\.(\d+)$/;
|
||||||
|
$key = $1;
|
||||||
|
$ifStatus{$key}{$snmpoid} = $response->{$snmpkey};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$session->close;
|
||||||
|
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
foreach $key (keys %ifStatus) {
|
||||||
|
|
||||||
|
# skip unused interfaces
|
||||||
|
if (!defined($ifStatus{$key}{'notInUse'})) {
|
||||||
|
# check only if interface is administratively up
|
||||||
|
if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) {
|
||||||
|
|
||||||
|
# check only if interface type is not listed in %excluded
|
||||||
|
if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) {
|
||||||
|
if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;}
|
||||||
|
if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) {
|
||||||
|
$ifdown++ ;
|
||||||
|
if (defined $ifXTable) {
|
||||||
|
$ifmessage .= sprintf("%s: down -> %s<BR>",
|
||||||
|
$ifStatus{$key}{$snmpIfName},
|
||||||
|
$ifStatus{$key}{$snmpIfAlias});
|
||||||
|
}else{
|
||||||
|
$ifmessage .= sprintf("%s: down <BR>",
|
||||||
|
$ifStatus{$key}{$snmpIfDescr});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;}
|
||||||
|
}else{
|
||||||
|
$ifexclude++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$ifunused++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ifdown > 0) {
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
$answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d<BR>",
|
||||||
|
$hostname,
|
||||||
|
$ifup,
|
||||||
|
$ifdown,
|
||||||
|
$ifdormant,
|
||||||
|
$ifexclude,
|
||||||
|
$ifunused);
|
||||||
|
$answer = $answer . $ifmessage . "\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$state = 'OK';
|
||||||
|
$answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d",
|
||||||
|
$hostname,
|
||||||
|
$ifup,
|
||||||
|
$ifdown,
|
||||||
|
$ifdormant,
|
||||||
|
$ifexclude,
|
||||||
|
$ifunused);
|
||||||
|
}
|
||||||
|
my $perfdata = sprintf("up=%d,down=%d,dormant=%d,excluded=%d,unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused);
|
||||||
|
print ("$state: $answer |$perfdata\n");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
|
||||||
|
|
||||||
|
sub usage (){
|
||||||
|
printf "\nMissing arguments!\n";
|
||||||
|
printf "\n";
|
||||||
|
printf "check_ifstatus -C <READCOMMUNITY> -p <PORT> -H <HOSTNAME>\n";
|
||||||
|
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||||
|
printf "Updates 5/2002 Subhendu Ghosh\n";
|
||||||
|
printf "\n\n";
|
||||||
|
support();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help (){
|
||||||
|
printf "check_ifstatus plugin for Nagios monitors operational \n";
|
||||||
|
printf "status of each network interface on the target host\n";
|
||||||
|
printf "\nUsage:\n";
|
||||||
|
printf " -H (--hostname) Hostname to query - (required)\n";
|
||||||
|
printf " -C (--community) SNMP read community (defaults to public,\n";
|
||||||
|
printf " used with SNMP v1 and v2c\n";
|
||||||
|
printf " -v (--snmp_version) 1 for SNMP v1 (default)\n";
|
||||||
|
printf " 2 for SNMP v2c\n";
|
||||||
|
printf " SNMP v2c will use get_bulk for less overhead\n";
|
||||||
|
printf " 3 for SNMPv3 (requires -U option)";
|
||||||
|
printf " -p (--port) SNMP port (default 161)\n";
|
||||||
|
printf " -I (--ifmib) Agent supports IFMIB ifXTable. For Cisco - this will provide\n";
|
||||||
|
printf " the descriptive name. Do not use if you don't know what this is. \n";
|
||||||
|
printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n";
|
||||||
|
printf " from the report (default for an empty list is PPP(23).\n";
|
||||||
|
printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n";
|
||||||
|
printf " from the report (default is an empty exclusion list).\n";
|
||||||
|
printf " See the IANAifType-MIB for a list of interface types.\n";
|
||||||
|
printf " -L (--seclevel) choice of \"noAuthNoPriv\", \"authNoPriv\", or \"authPriv\"\n";
|
||||||
|
printf " -U (--secname) username for SNMPv3 context\n";
|
||||||
|
printf " -c (--context) SNMPv3 context name (default is empty string)";
|
||||||
|
printf " -A (--authpass) authentication password (cleartext ascii or localized key\n";
|
||||||
|
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
|
||||||
|
printf " auth password and authEngineID\n";
|
||||||
|
printf " -a (--authproto) Authentication protocol ( MD5 or SHA1)\n";
|
||||||
|
printf " -X (--privpass) privacy password (cleartext ascii or localized key\n";
|
||||||
|
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
|
||||||
|
printf " privacy password and authEngineID\n";
|
||||||
|
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
|
||||||
|
printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n";
|
||||||
|
printf " -V (--version) Plugin version\n";
|
||||||
|
printf " -h (--help) usage help \n\n";
|
||||||
|
print_revision($PROGNAME, '$Revision: 1.9 $');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
sub process_arguments() {
|
||||||
|
$status = GetOptions(
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version,
|
||||||
|
"C=s" => \$community,"community=s" => \$community,
|
||||||
|
"L=s" => \$seclevel, "seclevel=s" => \$seclevel,
|
||||||
|
"a=s" => \$authproto, "authproto=s" => \$authproto,
|
||||||
|
"U=s" => \$secname, "secname=s" => \$secname,
|
||||||
|
"A=s" => \$authpass, "authpass=s" => \$authpass,
|
||||||
|
"X=s" => \$privpass, "privpass=s" => \$privpass,
|
||||||
|
"c=s" => \$context, "context=s" => \$context,
|
||||||
|
"p=i" =>\$port, "port=i" => \$port,
|
||||||
|
"H=s" => \$hostname, "hostname=s" => \$hostname,
|
||||||
|
"I" => \$ifXTable, "ifmib" => \$ifXTable,
|
||||||
|
"x:s" => \$opt_x, "exclude:s" => \$opt_x,
|
||||||
|
"u=s" => \$opt_u, "unused_ports=s" => \$opt_u,
|
||||||
|
"M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
|
||||||
|
"t=i" => \$timeout, "timeout=i" => \$timeout,
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($status == 0){
|
||||||
|
print_help() ;
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.9 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (defined $timeout) {
|
||||||
|
$timeout = $TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($snmp_version =~ /3/ ) {
|
||||||
|
# Must define a security level even though default is noAuthNoPriv
|
||||||
|
# v3 requires a security username
|
||||||
|
if (defined $seclevel && defined $secname) {
|
||||||
|
|
||||||
|
# Must define a security level even though defualt is noAuthNoPriv
|
||||||
|
unless ($seclevel eq ('noAuthNoPriv' || 'authNoPriv' || 'authPriv' ) ) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Authentication wanted
|
||||||
|
if ($seclevel eq ('authNoPriv' || 'authPriv') ) {
|
||||||
|
|
||||||
|
unless ($authproto eq ('MD5' || 'SHA1') ) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !defined $authpass) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
if ($authpass =~ /^0x/ ) {
|
||||||
|
$auth = "-authkey => $authpass" ;
|
||||||
|
}else{
|
||||||
|
$auth = "-authpassword => $authpass";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Privacy (DES encryption) wanted
|
||||||
|
if ($seclevel eq 'authPriv' ) {
|
||||||
|
if (! defined $privpass) {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
if ($privpass =~ /^0x/){
|
||||||
|
$priv = "-privkey => $privpass";
|
||||||
|
}else{
|
||||||
|
$priv = "-privpassword => $privpass";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Context name defined or default
|
||||||
|
|
||||||
|
unless ( defined $context) {
|
||||||
|
$context = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else {
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'}; ;
|
||||||
|
}
|
||||||
|
} # end snmpv3
|
||||||
|
|
||||||
|
# for snmp v1 & v2c we default to community = "public"
|
||||||
|
|
||||||
|
# Excluded interfaces types (ifType) (backup interfaces, dial-on demand interfaces, PPP interfaces
|
||||||
|
if (defined $opt_x) {
|
||||||
|
my @x = split(/,/, $opt_x);
|
||||||
|
if ( @x) {
|
||||||
|
foreach $key (@x){
|
||||||
|
$excluded{$key} = 1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$excluded{23} = 1; # default PPP(23) if empty list - note (AIX seems to think PPP is 22 according to a post)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Excluded interface ports (ifIndex) - management reasons
|
||||||
|
if ($opt_u) {
|
||||||
|
@unused_ports = split(/,/,$opt_u);
|
||||||
|
foreach $key (@unused_ports) {
|
||||||
|
$ifStatus{$key}{'notInUse'}++ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! utils::is_hostname($hostname)){
|
||||||
|
usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
# create SNMP session handle based on options passed.
|
||||||
|
|
||||||
|
if ( ! $snmp_version ) {
|
||||||
|
$snmp_version =1 ;
|
||||||
|
}else{
|
||||||
|
if ( $snmp_version =~ /[12]/ ) {
|
||||||
|
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-community => $community,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-maxmsgsize => $maxmsgsize
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!defined($session)) {
|
||||||
|
$state='UNKNOWN';
|
||||||
|
$answer=$error;
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}elsif ( $snmp_version =~ /3/ ) {
|
||||||
|
|
||||||
|
if ($seclevel eq 'noAuthNoPriv') {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
);
|
||||||
|
|
||||||
|
}elsif ( $seclevel eq 'authNoPriv' ) {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
-authprotocol => $authproto,
|
||||||
|
$auth
|
||||||
|
);
|
||||||
|
}elsif ($seclevel eq 'authPriv' ) {
|
||||||
|
($session, $error) = Net::SNMP->session(
|
||||||
|
-hostname => $hostname,
|
||||||
|
-port => $port,
|
||||||
|
-version => $snmp_version,
|
||||||
|
-username => $secname,
|
||||||
|
-authprotocol => $authproto,
|
||||||
|
$auth,
|
||||||
|
$priv
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!defined($session)) {
|
||||||
|
$state='UNKNOWN';
|
||||||
|
$answer=$error;
|
||||||
|
print ("$state: $answer");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$state='UNKNOWN';
|
||||||
|
print ("$state: No support for SNMP v$snmp_version yet\n");
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ERRORS{"OK"};
|
||||||
|
|
||||||
|
}
|
1
checkers/check_imap
Symbolic link
1
checkers/check_imap
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
250
checkers/check_ircd
Executable file
250
checkers/check_ircd
Executable file
@@ -0,0 +1,250 @@
|
|||||||
|
#! /usr/bin/perl -wT
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# File Name: check_ircd.pl
|
||||||
|
#
|
||||||
|
# Author: Richard Mayhew - South Africa
|
||||||
|
#
|
||||||
|
# Date: 1999/09/20
|
||||||
|
#
|
||||||
|
# $Id: check_ircd.pl,v 1.3 2002/05/07 05:35:49 sghosh Exp $
|
||||||
|
#
|
||||||
|
# Description: This script will check to see if an IRCD is running
|
||||||
|
# about how many users it has
|
||||||
|
#
|
||||||
|
# Email: netsaint@splash.co.za
|
||||||
|
#
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Copyright 1999 (c) Richard Mayhew
|
||||||
|
#
|
||||||
|
# Credits go to Ethan Galstad for coding Nagios
|
||||||
|
#
|
||||||
|
# If any changes are made to this script, please mail me a copy of the
|
||||||
|
# changes :)
|
||||||
|
#
|
||||||
|
# Some code taken from Charlie Cook (check_disk.pl)
|
||||||
|
#
|
||||||
|
# License GPL
|
||||||
|
#
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# Date Author Reason
|
||||||
|
# ---- ------ ------
|
||||||
|
#
|
||||||
|
# 1999/09/20 RM Creation
|
||||||
|
#
|
||||||
|
# 1999/09/20 TP Changed script to use strict, more secure by
|
||||||
|
# specifying $ENV variables. The bind command is
|
||||||
|
# still insecure through. Did most of my work
|
||||||
|
# with perl -wT and 'use strict'
|
||||||
|
#
|
||||||
|
# test using check_ircd.pl (irc-2.mit.edu|irc.erols.com|irc.core.com)
|
||||||
|
# 2002/05/02 SG Fixed for Embedded Perl
|
||||||
|
#
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------[ Require ]--
|
||||||
|
|
||||||
|
require 5.004;
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------[ Uses ]--
|
||||||
|
|
||||||
|
use Socket;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose);
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||||
|
|
||||||
|
# ----------------------------------------------------[ Function Prototypes ]--
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
sub connection ($$$$);
|
||||||
|
sub bindRemote ($$$);
|
||||||
|
|
||||||
|
# -------------------------------------------------------------[ Enviroment ]--
|
||||||
|
|
||||||
|
$ENV{PATH} = "";
|
||||||
|
$ENV{ENV} = "";
|
||||||
|
$ENV{BASH_ENV} = "";
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------[ Global ]--
|
||||||
|
|
||||||
|
$PROGNAME = "check_ircd";
|
||||||
|
my $NICK="ircd$$";
|
||||||
|
my $USER_INFO="monitor localhost localhost : ";
|
||||||
|
|
||||||
|
# -------------------------------------------------------------[ connection ]--
|
||||||
|
sub connection ($$$$)
|
||||||
|
{
|
||||||
|
my ($in_remotehost,$in_users,$in_warn,$in_crit) = @_;
|
||||||
|
my $state;
|
||||||
|
my $answer;
|
||||||
|
|
||||||
|
print "connection(debug): users = $in_users\n" if $verbose;
|
||||||
|
$in_users =~ s/\ //g;
|
||||||
|
|
||||||
|
if ($in_users >= 0) {
|
||||||
|
|
||||||
|
if ($in_users > $in_crit) {
|
||||||
|
$state = "CRITICAL";
|
||||||
|
$answer = "Critical Number Of Clients Connected : $in_users (Limit = $in_crit)\n";
|
||||||
|
|
||||||
|
} elsif ($in_users > $in_warn) {
|
||||||
|
$state = "WARNING";
|
||||||
|
$answer = "Warning Number Of Clients Connected : $in_users (Limit = $in_warn)\n";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$state = "OK";
|
||||||
|
$answer = "IRCD ok - Current Local Users: $in_users\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$state = "UNKNOWN";
|
||||||
|
$answer = "Server $in_remotehost has less than 0 users! Something is Really WRONG!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print ClientSocket "quit\n";
|
||||||
|
print $answer;
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------[ print_usage ]--
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>] [-p <port>]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# -------------------------------------------------------------[ print_help ]--
|
||||||
|
|
||||||
|
sub print_help ()
|
||||||
|
{
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.3 $ ');
|
||||||
|
print "Copyright (c) 2000 Richard Mayhew/Karl DeBisschop
|
||||||
|
|
||||||
|
Perl Check IRCD plugin for Nagios
|
||||||
|
|
||||||
|
";
|
||||||
|
print_usage();
|
||||||
|
print "
|
||||||
|
-H, --hostname=HOST
|
||||||
|
Name or IP address of host to check
|
||||||
|
-w, --warning=INTEGER
|
||||||
|
Number of connected users which generates a warning state (Default: 50)
|
||||||
|
-c, --critical=INTEGER
|
||||||
|
Number of connected users which generates a critical state (Default: 100)
|
||||||
|
-p, --port=INTEGER
|
||||||
|
Port that the ircd daemon is running on <host> (Default: 6667)
|
||||||
|
-v, --verbose
|
||||||
|
Print extra debugging information
|
||||||
|
";
|
||||||
|
}
|
||||||
|
|
||||||
|
# -------------------------------------------------------------[ bindRemote ]--
|
||||||
|
|
||||||
|
sub bindRemote ($$$)
|
||||||
|
{
|
||||||
|
my ($in_remotehost, $in_remoteport, $in_hostname) = @_;
|
||||||
|
my $proto = getprotobyname('tcp');
|
||||||
|
my $sockaddr;
|
||||||
|
my $this;
|
||||||
|
my $that;
|
||||||
|
my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
|
||||||
|
# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname);
|
||||||
|
|
||||||
|
if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) {
|
||||||
|
print "IRCD UNKNOWN: Could not start socket ($!)\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
$sockaddr = 'S n a4 x8';
|
||||||
|
$this = pack($sockaddr, AF_INET, 0, INADDR_ANY);
|
||||||
|
$that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
|
||||||
|
if (!bind(ClientSocket, $this)) {
|
||||||
|
print "IRCD UNKNOWN: Could not bind socket ($!)\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
if (!connect(ClientSocket, $that)) {
|
||||||
|
print "IRCD UNKNOWN: Could not connect socket ($!)\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
select(ClientSocket); $| = 1; select(STDOUT);
|
||||||
|
return \*ClientSocket;
|
||||||
|
}
|
||||||
|
|
||||||
|
# ===================================================================[ MAIN ]==
|
||||||
|
|
||||||
|
MAIN:
|
||||||
|
{
|
||||||
|
my $hostname;
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v" => \$verbose,"verbose" => \$verbose,
|
||||||
|
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
|
||||||
|
"w=i" => \$opt_w, "warning=i" => \$opt_w,
|
||||||
|
"c=i" => \$opt_c, "critical=i" => \$opt_c,
|
||||||
|
"p=i" => \$opt_p, "port=i" => \$opt_p,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.3 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||||
|
|
||||||
|
($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n");
|
||||||
|
my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
|
||||||
|
($remotehost) || usage("Invalid host: $opt_H\n");
|
||||||
|
|
||||||
|
($opt_w) || ($opt_w = shift) || ($opt_w = 50);
|
||||||
|
my $warn = $1 if ($opt_w =~ /^([0-9]+)$/);
|
||||||
|
($warn) || usage("Invalid warning threshold: $opt_w\n");
|
||||||
|
|
||||||
|
($opt_c) || ($opt_c = shift) || ($opt_c = 100);
|
||||||
|
my $crit = $1 if ($opt_c =~ /^([0-9]+)$/);
|
||||||
|
($crit) || usage("Invalid critical threshold: $opt_c\n");
|
||||||
|
|
||||||
|
($opt_p) || ($opt_p = shift) || ($opt_p = 6667);
|
||||||
|
my $remoteport = $1 if ($opt_p =~ /^([0-9]+)$/);
|
||||||
|
($remoteport) || usage("Invalid port: $opt_p\n");
|
||||||
|
|
||||||
|
if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; }
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
|
||||||
|
alarm($TIMEOUT);
|
||||||
|
|
||||||
|
chomp($hostname = `/bin/hostname`);
|
||||||
|
$hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/);
|
||||||
|
my ($name, $alias, $proto) = getprotobyname('tcp');
|
||||||
|
print "MAIN(debug): hostname = $hostname\n" if $verbose;
|
||||||
|
|
||||||
|
print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose;
|
||||||
|
my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname);
|
||||||
|
|
||||||
|
print ClientSocket "NICK $NICK\nUSER $USER_INFO\n";
|
||||||
|
|
||||||
|
while (<ClientSocket>) {
|
||||||
|
print "MAIN(debug): default var = $_\n" if $verbose;
|
||||||
|
|
||||||
|
# DALnet,LagNet,UnderNet etc. Require this!
|
||||||
|
# Replies with a PONG when presented with a PING query.
|
||||||
|
# If a server doesn't require it, it will be ignored.
|
||||||
|
|
||||||
|
if (m/^PING (.*)/) {print ClientSocket "PONG $1\n";}
|
||||||
|
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
# Look for pattern in IRCD Output to gather Client Connections total.
|
||||||
|
connection($remotehost,$1,$warn,$crit) if (m/:I have\s+(\d+)/);
|
||||||
|
}
|
||||||
|
print "IRCD UNKNOWN: Unknown error - maybe could not authenticate\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
1
checkers/check_jabber
Symbolic link
1
checkers/check_jabber
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_ldap
Executable file
BIN
checkers/check_ldap
Executable file
Binary file not shown.
BIN
checkers/check_ldaps
Executable file
BIN
checkers/check_ldaps
Executable file
Binary file not shown.
BIN
checkers/check_load
Executable file
BIN
checkers/check_load
Executable file
Binary file not shown.
217
checkers/check_log
Executable file
217
checkers/check_log
Executable file
@@ -0,0 +1,217 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# Log file pattern detector plugin for Nagios
|
||||||
|
# Written by Ethan Galstad (nagios@nagios.org)
|
||||||
|
# Last Modified: 07-31-1999
|
||||||
|
#
|
||||||
|
# Usage: ./check_log <log_file> <old_log_file> <pattern>
|
||||||
|
#
|
||||||
|
# Description:
|
||||||
|
#
|
||||||
|
# This plugin will scan a log file (specified by the <log_file> option)
|
||||||
|
# for a specific pattern (specified by the <pattern> option). Successive
|
||||||
|
# calls to the plugin script will only report *new* pattern matches in the
|
||||||
|
# log file, since an copy of the log file from the previous run is saved
|
||||||
|
# to <old_log_file>.
|
||||||
|
#
|
||||||
|
# Output:
|
||||||
|
#
|
||||||
|
# On the first run of the plugin, it will return an OK state with a message
|
||||||
|
# of "Log check data initialized". On successive runs, it will return an OK
|
||||||
|
# state if *no* pattern matches have been found in the *difference* between the
|
||||||
|
# log file and the older copy of the log file. If the plugin detects any
|
||||||
|
# pattern matches in the log diff, it will return a CRITICAL state and print
|
||||||
|
# out a message is the following format: "(x) last_match", where "x" is the
|
||||||
|
# total number of pattern matches found in the file and "last_match" is the
|
||||||
|
# last entry in the log file which matches the pattern.
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
#
|
||||||
|
# If you use this plugin make sure to keep the following in mind:
|
||||||
|
#
|
||||||
|
# 1. The "max_attempts" value for the service should be 1, as this
|
||||||
|
# will prevent Nagios from retrying the service check (the
|
||||||
|
# next time the check is run it will not produce the same results).
|
||||||
|
#
|
||||||
|
# 2. The "notify_recovery" value for the service should be 0, so that
|
||||||
|
# Nagios does not notify you of "recoveries" for the check. Since
|
||||||
|
# pattern matches in the log file will only be reported once and not
|
||||||
|
# the next time, there will always be "recoveries" for the service, even
|
||||||
|
# though recoveries really don't apply to this type of check.
|
||||||
|
#
|
||||||
|
# 3. You *must* supply a different <old_file_log> for each service that
|
||||||
|
# you define to use this plugin script - even if the different services
|
||||||
|
# check the same <log_file> for pattern matches. This is necessary
|
||||||
|
# because of the way the script operates.
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# Check for login failures in the syslog...
|
||||||
|
#
|
||||||
|
# check_log /var/log/messages ./check_log.badlogins.old "LOGIN FAILURE"
|
||||||
|
#
|
||||||
|
# Check for port scan alerts generated by Psionic's PortSentry software...
|
||||||
|
#
|
||||||
|
# check_log /var/log/message ./check_log.portscan.old "attackalert"
|
||||||
|
#
|
||||||
|
|
||||||
|
# Paths to commands used in this script. These
|
||||||
|
# may have to be modified to match your system setup.
|
||||||
|
|
||||||
|
PATH=""
|
||||||
|
|
||||||
|
ECHO="/bin/echo"
|
||||||
|
GREP="/bin/grep"
|
||||||
|
DIFF="/usr/bin/diff"
|
||||||
|
TAIL="/usr/bin/tail"
|
||||||
|
CAT="/bin/cat"
|
||||||
|
RM="/bin/rm"
|
||||||
|
|
||||||
|
PROGNAME=`/usr/bin/basename $0`
|
||||||
|
PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||||
|
REVISION=`echo '$Revision: 1.4 $' | /bin/sed -e 's/[^0-9.]//g'`
|
||||||
|
|
||||||
|
. $PROGPATH/utils.sh
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo "Usage: $PROGNAME -F logfile -O oldlog -q query"
|
||||||
|
echo "Usage: $PROGNAME --help"
|
||||||
|
echo "Usage: $PROGNAME --version"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_help() {
|
||||||
|
print_revision $PROGNAME $REVISION
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
echo ""
|
||||||
|
echo "Log file pattern detector plugin for Nagios"
|
||||||
|
echo ""
|
||||||
|
support
|
||||||
|
}
|
||||||
|
|
||||||
|
# Make sure the correct number of command line
|
||||||
|
# arguments have been supplied
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
print_usage
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Grab the command line arguments
|
||||||
|
|
||||||
|
#logfile=$1
|
||||||
|
#oldlog=$2
|
||||||
|
#query=$3
|
||||||
|
exitstatus=$STATE_WARNING #default
|
||||||
|
while test -n "$1"; do
|
||||||
|
case "$1" in
|
||||||
|
--help)
|
||||||
|
print_help
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
-h)
|
||||||
|
print_help
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
--version)
|
||||||
|
print_revision $PROGNAME $VERSION
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
-V)
|
||||||
|
print_revision $PROGNAME $VERSION
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
--filename)
|
||||||
|
logfile=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-F)
|
||||||
|
logfile=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--oldlog)
|
||||||
|
oldlog=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-O)
|
||||||
|
oldlog=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--query)
|
||||||
|
query=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-q)
|
||||||
|
query=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-x)
|
||||||
|
exitstatus=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--exitstatus)
|
||||||
|
exitstatus=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown argument: $1"
|
||||||
|
print_usage
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# If the source log file doesn't exist, exit
|
||||||
|
|
||||||
|
if [ ! -e $logfile ]; then
|
||||||
|
$ECHO "Log check error: Log file $logfile does not exist!\n"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
elif [ ! -r $logfile ] ; then
|
||||||
|
$ECHO "Log check error: Log file $logfile is not readable!\n"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If the old log file doesn't exist, this must be the first time
|
||||||
|
# we're running this test, so copy the original log file over to
|
||||||
|
# the old diff file and exit
|
||||||
|
|
||||||
|
if [ ! -e $oldlog ]; then
|
||||||
|
$CAT $logfile > $oldlog
|
||||||
|
$ECHO "Log check data initialized...\n"
|
||||||
|
exit $STATE_OK
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The old log file exists, so compare it to the original log now
|
||||||
|
|
||||||
|
# The temporary file that the script should use while
|
||||||
|
# processing the log file.
|
||||||
|
if [ -x /bin/mktemp ]; then
|
||||||
|
tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX`
|
||||||
|
else
|
||||||
|
tempdiff=`/bin/date '+%H%M%S'`
|
||||||
|
tempdiff="/tmp/check_log.${tempdiff}"
|
||||||
|
/bin/touch $tempdiff
|
||||||
|
chmod 600 $tempdiff
|
||||||
|
fi
|
||||||
|
|
||||||
|
$DIFF $logfile $oldlog > $tempdiff
|
||||||
|
|
||||||
|
# Count the number of matching log entries we have
|
||||||
|
count=`$GREP -c "$query" $tempdiff`
|
||||||
|
|
||||||
|
# Get the last matching entry in the diff file
|
||||||
|
lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1`
|
||||||
|
|
||||||
|
$RM -f $tempdiff
|
||||||
|
$CAT $logfile > $oldlog
|
||||||
|
|
||||||
|
if [ "$count" = "0" ]; then # no matches, exit with no error
|
||||||
|
$ECHO "Log check ok - 0 pattern matches found\n"
|
||||||
|
exitstatus=$STATE_OK
|
||||||
|
else # Print total matche count and the last entry we found
|
||||||
|
$ECHO "($count) $lastentry"
|
||||||
|
exitstatus=$STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $exitstatus
|
610
checkers/check_mailq
Executable file
610
checkers/check_mailq
Executable file
@@ -0,0 +1,610 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
|
# check_mailq - check to see how many messages are in the smtp queue awating
|
||||||
|
# transmittal.
|
||||||
|
#
|
||||||
|
# Initial version support sendmail's mailq command
|
||||||
|
# Support for mutiple sendmail queues (Carlos Canau)
|
||||||
|
# Support for qmail (Benjamin Schmid)
|
||||||
|
|
||||||
|
# License Information:
|
||||||
|
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
|
# $Id: check_mailq.pl,v 1.6 2005/04/14 04:13:13 seanius Exp $
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
use POSIX;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t
|
||||||
|
$opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines
|
||||||
|
%srcdomains %dstdomains);
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw(%ERRORS &print_revision &support &usage );
|
||||||
|
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
sub process_arguments ();
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
$PROGNAME = "check_mailq";
|
||||||
|
$mailq = 'sendmail'; # default
|
||||||
|
$msg_q = 0 ;
|
||||||
|
$msg_p = 0 ;
|
||||||
|
$state = $ERRORS{'UNKNOWN'};
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
$status = process_arguments();
|
||||||
|
if ($status){
|
||||||
|
print "ERROR: processing arguments\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n");
|
||||||
|
exit $ERRORS{"WARNING"};
|
||||||
|
};
|
||||||
|
alarm($opt_t);
|
||||||
|
|
||||||
|
# switch based on MTA
|
||||||
|
|
||||||
|
if ($mailq eq "sendmail") {
|
||||||
|
|
||||||
|
## open mailq
|
||||||
|
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
|
||||||
|
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
|
||||||
|
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}elsif( defined $utils::PATH_TO_MAILQ){
|
||||||
|
unless (-x $utils::PATH_TO_MAILQ) {
|
||||||
|
print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
# single queue empty
|
||||||
|
##/var/spool/mqueue is empty
|
||||||
|
# single queue: 1
|
||||||
|
## /var/spool/mqueue (1 request)
|
||||||
|
##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------
|
||||||
|
##h32E30p01763 2782 Wed Apr 2 15:03 <silvaATkpnqwest.pt>
|
||||||
|
## 8BITMIME
|
||||||
|
## <silvaATeunet.pt>
|
||||||
|
|
||||||
|
# multi queue empty
|
||||||
|
##/var/spool/mqueue/q0/df is empty
|
||||||
|
##/var/spool/mqueue/q1/df is empty
|
||||||
|
##/var/spool/mqueue/q2/df is empty
|
||||||
|
##/var/spool/mqueue/q3/df is empty
|
||||||
|
##/var/spool/mqueue/q4/df is empty
|
||||||
|
##/var/spool/mqueue/q5/df is empty
|
||||||
|
##/var/spool/mqueue/q6/df is empty
|
||||||
|
##/var/spool/mqueue/q7/df is empty
|
||||||
|
##/var/spool/mqueue/q8/df is empty
|
||||||
|
##/var/spool/mqueue/q9/df is empty
|
||||||
|
##/var/spool/mqueue/qA/df is empty
|
||||||
|
##/var/spool/mqueue/qB/df is empty
|
||||||
|
##/var/spool/mqueue/qC/df is empty
|
||||||
|
##/var/spool/mqueue/qD/df is empty
|
||||||
|
##/var/spool/mqueue/qE/df is empty
|
||||||
|
##/var/spool/mqueue/qF/df is empty
|
||||||
|
## Total Requests: 0
|
||||||
|
# multi queue: 1
|
||||||
|
##/var/spool/mqueue/q0/df is empty
|
||||||
|
##/var/spool/mqueue/q1/df is empty
|
||||||
|
##/var/spool/mqueue/q2/df is empty
|
||||||
|
## /var/spool/mqueue/q3/df (1 request)
|
||||||
|
##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------
|
||||||
|
##h32De2f23534* 48 Wed Apr 2 14:40 nocol
|
||||||
|
## nouserATEUnet.pt
|
||||||
|
## canau
|
||||||
|
##/var/spool/mqueue/q4/df is empty
|
||||||
|
##/var/spool/mqueue/q5/df is empty
|
||||||
|
##/var/spool/mqueue/q6/df is empty
|
||||||
|
##/var/spool/mqueue/q7/df is empty
|
||||||
|
##/var/spool/mqueue/q8/df is empty
|
||||||
|
##/var/spool/mqueue/q9/df is empty
|
||||||
|
##/var/spool/mqueue/qA/df is empty
|
||||||
|
##/var/spool/mqueue/qB/df is empty
|
||||||
|
##/var/spool/mqueue/qC/df is empty
|
||||||
|
##/var/spool/mqueue/qD/df is empty
|
||||||
|
##/var/spool/mqueue/qE/df is empty
|
||||||
|
##/var/spool/mqueue/qF/df is empty
|
||||||
|
## Total Requests: 1
|
||||||
|
|
||||||
|
|
||||||
|
while (<MAILQ>) {
|
||||||
|
|
||||||
|
# match email addr on queue listing
|
||||||
|
if ( (/<.*@.*\.(\w+\.\w+)>/) || (/<.*@(\w+\.\w+)>/) ) {
|
||||||
|
my $domain = $1;
|
||||||
|
if (/^\w+/) {
|
||||||
|
print "$utils::PATH_TO_MAILQ = srcdomain = $domain \n" if $verbose ;
|
||||||
|
$srcdomains{$domain} ++;
|
||||||
|
}
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# ...
|
||||||
|
# sendmail considers a message with more than one destiny, say N, to the same MX
|
||||||
|
# to have N messages in queue.
|
||||||
|
# we will only consider one in this code
|
||||||
|
if (( /\s\(reply:\sread\serror\sfrom\s.*\.(\w+\.\w+)\.$/ ) || ( /\s\(reply:\sread\serror\sfrom\s(\w+\.\w+)\.$/ ) ||
|
||||||
|
( /\s\(timeout\swriting\smessage\sto\s.*\.(\w+\.\w+)\.:/ ) || ( /\s\(timeout\swriting\smessage\sto\s(\w+\.\w+)\.:/ ) ||
|
||||||
|
( /\s\(host\smap:\slookup\s\(.*\.(\w+\.\w+)\):/ ) || ( /\s\(host\smap:\slookup\s\((\w+\.\w+)\):/ ) ||
|
||||||
|
( /\s\(Deferred:\s.*\s.*\.(\w+\.\w+)\.\)/ ) || ( /\s\(Deferred:\s.*\s(\w+\.\w+)\.\)/ ) ) {
|
||||||
|
|
||||||
|
print "$utils::PATH_TO_MAILQ = dstdomain = $1 \n" if $verbose ;
|
||||||
|
$dstdomains{$1} ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/\s+\(I\/O\serror\)/) {
|
||||||
|
print "$utils::PATH_TO_MAILQ = dstdomain = UNKNOWN \n" if $verbose ;
|
||||||
|
$dstdomains{'UNKNOWN'} ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Finally look at the overall queue length
|
||||||
|
#
|
||||||
|
if (/mqueue/) {
|
||||||
|
print "$utils::PATH_TO_MAILQ = $_ "if $verbose ;
|
||||||
|
if (/ \((\d+) request/) {
|
||||||
|
#
|
||||||
|
# single queue: first line
|
||||||
|
# multi queue: one for each queue. overwrite on multi queue below
|
||||||
|
$msg_q = $1 ;
|
||||||
|
}
|
||||||
|
} elsif (/^\s+Total\sRequests:\s(\d+)$/i) {
|
||||||
|
print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ;
|
||||||
|
#
|
||||||
|
# multi queue: last line
|
||||||
|
$msg_q = $1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## close mailq
|
||||||
|
|
||||||
|
close (MAILQ);
|
||||||
|
# declare an error if we also get a non-zero return code from mailq
|
||||||
|
# unless already set to critical
|
||||||
|
if ( $? ) {
|
||||||
|
$state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
|
||||||
|
print "STDERR $?: $!\n" if $verbose;
|
||||||
|
$msg = "$state: (stderr)\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
## shut off the alarm
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## now check the queue length(s)
|
||||||
|
|
||||||
|
if ($msg_q == 0) {
|
||||||
|
$msg = "OK: mailq is empty";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
} else {
|
||||||
|
print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
|
||||||
|
|
||||||
|
# overall queue length
|
||||||
|
if ($msg_q < $opt_w) {
|
||||||
|
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
}elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||||
|
$msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}else {
|
||||||
|
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# check for domain specific queue lengths if requested
|
||||||
|
if (defined $opt_W) {
|
||||||
|
|
||||||
|
# Apply threshold to queue lengths FROM domain
|
||||||
|
my @srckeys = sort { $srcdomains{$b} <=> $srcdomains{$a} } keys %srcdomains;
|
||||||
|
my $srcmaxkey = $srckeys[0];
|
||||||
|
print "src max is $srcmaxkey with $srcdomains{$srcmaxkey} messages\n" if $verbose;
|
||||||
|
|
||||||
|
if ($srcdomains{$srcmaxkey} >= $opt_W && $srcdomains{$srcmaxkey} < $opt_C) {
|
||||||
|
if ($state == $ERRORS{'OK'}) {
|
||||||
|
$msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
} elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){
|
||||||
|
$msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
|
||||||
|
} else {
|
||||||
|
$msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}
|
||||||
|
} elsif ($srcdomains{$srcmaxkey} >= $opt_C) {
|
||||||
|
if ($state == $ERRORS{'OK'}) {
|
||||||
|
$msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
} elsif ($state == $ERRORS{'WARNING'}) {
|
||||||
|
$msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C) -and- " . $msg;
|
||||||
|
$msg =~ s/WARNING: //;
|
||||||
|
} elsif ($state == $ERRORS{'CRITICAL'}) {
|
||||||
|
$msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
|
||||||
|
} else {
|
||||||
|
$msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($srcdomains{$srcmaxkey} > 0) {
|
||||||
|
$msg .= " $srcdomains{$srcmaxkey} msgs. FROM $srcmaxkey is below threshold ($opt_W/$opt_C)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Apply threshold to queue lengths TO domain
|
||||||
|
my @dstkeys = sort { $dstdomains{$b} <=> $dstdomains{$a} } keys %dstdomains;
|
||||||
|
my $dstmaxkey = $dstkeys[0];
|
||||||
|
print "dst max is $dstmaxkey with $dstdomains{$dstmaxkey} messages\n" if $verbose;
|
||||||
|
|
||||||
|
if ($dstdomains{$dstmaxkey} >= $opt_W && $dstdomains{$dstmaxkey} < $opt_C) {
|
||||||
|
if ($state == $ERRORS{'OK'}) {
|
||||||
|
$msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
} elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){
|
||||||
|
$msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
|
||||||
|
} else {
|
||||||
|
$msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}
|
||||||
|
} elsif ($dstdomains{$dstmaxkey} >= $opt_C) {
|
||||||
|
if ($state == $ERRORS{'OK'}) {
|
||||||
|
$msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
} elsif ($state == $ERRORS{'WARNING'}) {
|
||||||
|
$msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C) -and- " . $msg;
|
||||||
|
$msg =~ s/WARNING: //;
|
||||||
|
} elsif ($state == $ERRORS{'CRITICAL'}) {
|
||||||
|
$msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
|
||||||
|
} else {
|
||||||
|
$msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($dstdomains{$dstmaxkey} > 0) {
|
||||||
|
$msg .= " $dstdomains{$dstmaxkey} msgs. TO $dstmaxkey is below threshold ($opt_W/$opt_C)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} # End of queue length thresholds
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} # end of ($mailq eq "sendmail")
|
||||||
|
elsif ( $mailq eq "postfix" ) {
|
||||||
|
|
||||||
|
## open mailq
|
||||||
|
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
|
||||||
|
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
|
||||||
|
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}elsif( defined $utils::PATH_TO_MAILQ){
|
||||||
|
unless (-x $utils::PATH_TO_MAILQ) {
|
||||||
|
print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@lines = reverse <MAILQ>;
|
||||||
|
|
||||||
|
# close qmail-qstat
|
||||||
|
close MAILQ;
|
||||||
|
# declare an error if we also get a non-zero return code from mailq
|
||||||
|
# unless already set to critical
|
||||||
|
if ( $? ) {
|
||||||
|
$state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
|
||||||
|
print "STDERR $?: $!\n" if $verbose;
|
||||||
|
$msg = "$state: (stderr)\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
## shut off the alarm
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
# check queue length
|
||||||
|
if ($lines[0]=~/Kbytes in (\d+)/) {
|
||||||
|
$msg_q = $1 ;
|
||||||
|
}elsif ($lines[0]=~/Mail queue is empty/) {
|
||||||
|
$msg_q = 0;
|
||||||
|
}else{
|
||||||
|
print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# check messages not processed
|
||||||
|
#if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
|
||||||
|
# my $msg_p = $1;
|
||||||
|
#}else{
|
||||||
|
# print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
|
||||||
|
# exit $ERRORS{'UNKNOWN'};
|
||||||
|
#}
|
||||||
|
|
||||||
|
# check queue length(s)
|
||||||
|
if ($msg_q == 0){
|
||||||
|
$msg = "OK: mailq reports queue is empty";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
} else {
|
||||||
|
print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
|
||||||
|
|
||||||
|
# overall queue length
|
||||||
|
if ($msg_q < $opt_w) {
|
||||||
|
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
}elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||||
|
$msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}else {
|
||||||
|
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# check messages not yet preprocessed (only compare is $opt_W and $opt_C
|
||||||
|
# are defined)
|
||||||
|
|
||||||
|
#if (defined $opt_W) {
|
||||||
|
# $msg .= "[Preprocessed = $msg_p]";
|
||||||
|
# if ($msg_p >= $opt_W && $msg_p < $opt_C ) {
|
||||||
|
# $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
|
||||||
|
# }elsif ($msg_p >= $opt_C ) {
|
||||||
|
# $state = $ERRORS{"CRITICAL"} ;
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
}
|
||||||
|
} # end of ($mailq eq "postfixl")
|
||||||
|
elsif ( $mailq eq "qmail" ) {
|
||||||
|
|
||||||
|
# open qmail-qstat
|
||||||
|
if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) {
|
||||||
|
if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) {
|
||||||
|
print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}elsif( defined $utils::PATH_TO_QMAIL_QSTAT){
|
||||||
|
unless (-x $utils::PATH_TO_QMAIL_QSTAT) {
|
||||||
|
print "ERROR: $utils::PATH_TO_QMAIL_QSTAT is not executable by (uid $>:gid($)))\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "ERROR: \$utils::PATH_TO_QMAIL_QSTAT is not defined\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
@lines = <MAILQ>;
|
||||||
|
|
||||||
|
# close qmail-qstat
|
||||||
|
close MAILQ;
|
||||||
|
# declare an error if we also get a non-zero return code from mailq
|
||||||
|
# unless already set to critical
|
||||||
|
if ( $? ) {
|
||||||
|
$state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
|
||||||
|
print "STDERR $?: $!\n" if $verbose;
|
||||||
|
$msg = "$state: (stderr)\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
## shut off the alarm
|
||||||
|
alarm(0);
|
||||||
|
|
||||||
|
# check queue length
|
||||||
|
if ($lines[0]=~/^messages in queue: (\d+)/) {
|
||||||
|
$msg_q = $1 ;
|
||||||
|
}else{
|
||||||
|
print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# check messages not processed
|
||||||
|
if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
|
||||||
|
my $msg_p = $1;
|
||||||
|
}else{
|
||||||
|
print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# check queue length(s)
|
||||||
|
if ($msg_q == 0){
|
||||||
|
$msg = "OK: qmail-qstat reports queue is empty";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
} else {
|
||||||
|
print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
|
||||||
|
|
||||||
|
# overall queue length
|
||||||
|
if ($msg_q < $opt_w) {
|
||||||
|
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
}elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||||
|
$msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}else {
|
||||||
|
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# check messages not yet preprocessed (only compare is $opt_W and $opt_C
|
||||||
|
# are defined)
|
||||||
|
|
||||||
|
if (defined $opt_W) {
|
||||||
|
$msg .= "[Preprocessed = $msg_p]";
|
||||||
|
if ($msg_p >= $opt_W && $msg_p < $opt_C ) {
|
||||||
|
$state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ;
|
||||||
|
}elsif ($msg_p >= $opt_C ) {
|
||||||
|
$state = $ERRORS{"CRITICAL"} ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} # end of ($mailq eq "qmail")
|
||||||
|
elsif ( $mailq eq "exim" ) {
|
||||||
|
## open mailq
|
||||||
|
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
|
||||||
|
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
|
||||||
|
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}elsif( defined $utils::PATH_TO_MAILQ){
|
||||||
|
unless (-x $utils::PATH_TO_MAILQ) {
|
||||||
|
print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
while (<MAILQ>) {
|
||||||
|
#22m 1.7K 19aEEr-0007hx-Dy <> *** frozen ***
|
||||||
|
#root@exlixams.glups.fr
|
||||||
|
|
||||||
|
if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy
|
||||||
|
$msg_q++ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(MAILQ) ;
|
||||||
|
if ($msg_q < $opt_w) {
|
||||||
|
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
}elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
|
||||||
|
$msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
}else {
|
||||||
|
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
}
|
||||||
|
} # end of ($mailq eq "exim")
|
||||||
|
|
||||||
|
# Perfdata support
|
||||||
|
print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
|
||||||
|
exit $state;
|
||||||
|
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
#### subs
|
||||||
|
|
||||||
|
|
||||||
|
sub process_arguments(){
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"v" => \$opt_v, "verbose" => \$opt_v,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail)
|
||||||
|
"w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number
|
||||||
|
"c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
|
||||||
|
"t=i" => \$opt_t, "timeout=i" => \$opt_t
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.6 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $opt_v ){
|
||||||
|
$verbose = $opt_v;
|
||||||
|
}
|
||||||
|
|
||||||
|
unless (defined $opt_t) {
|
||||||
|
$opt_t = $utils::TIMEOUT ; # default timeout
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ( defined $opt_w && defined $opt_c ) {
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $opt_w >= $opt_c) {
|
||||||
|
print "Warning (-w) cannot be greater than Critical (-c)!\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $opt_W && ! defined !$opt_C) {
|
||||||
|
print "Need -C if using -W\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}elsif(defined $opt_W && defined $opt_C) {
|
||||||
|
if ($opt_W >= $opt_C) {
|
||||||
|
print "Warning (-W) cannot be greater than Critical (-C)!\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $opt_M) {
|
||||||
|
if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) {
|
||||||
|
$mailq = $opt_M ;
|
||||||
|
}elsif( $opt_M eq ''){
|
||||||
|
$mailq = 'sendmail';
|
||||||
|
}else{
|
||||||
|
print "-M: $opt_M is not supported\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$mailq = 'sendmail' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.6 $');
|
||||||
|
print "Copyright (c) 2002 Subhendu Ghosh/Carlos Canau/Benjamin Schmid\n";
|
||||||
|
print "\n";
|
||||||
|
print_usage();
|
||||||
|
print "\n";
|
||||||
|
print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n";
|
||||||
|
print " Feedback/patches to support non-sendmail mailqueue welcome\n\n";
|
||||||
|
print "-w (--warning) = Min. number of messages in queue to generate warning\n";
|
||||||
|
print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n";
|
||||||
|
print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n";
|
||||||
|
print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
|
||||||
|
print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
|
||||||
|
print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n";
|
||||||
|
print "-h (--help)\n";
|
||||||
|
print "-V (--version)\n";
|
||||||
|
print "-v (--verbose) = debugging output\n";
|
||||||
|
print "\n\n";
|
||||||
|
print "Note: -w and -c are required arguments. -W and -C are optional.\n";
|
||||||
|
print " -W and -C are applied to domains listed on the queues - both FROM and TO. (sendmail)\n";
|
||||||
|
print " -W and -C are applied message not yet preproccessed. (qmail)\n";
|
||||||
|
print " This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)\n";
|
||||||
|
print " to look at the queues. Mailq can usually only be accessed by root or \n";
|
||||||
|
print " a TrustedUser. You will have to set appropriate permissions for the plugin to work.\n";
|
||||||
|
print "";
|
||||||
|
print "\n\n";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/check_mrtg
Executable file
BIN
checkers/check_mrtg
Executable file
Binary file not shown.
BIN
checkers/check_mrtgtraf
Executable file
BIN
checkers/check_mrtgtraf
Executable file
Binary file not shown.
BIN
checkers/check_mysql
Executable file
BIN
checkers/check_mysql
Executable file
Binary file not shown.
BIN
checkers/check_nagios
Executable file
BIN
checkers/check_nagios
Executable file
Binary file not shown.
1
checkers/check_nntp
Symbolic link
1
checkers/check_nntp
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
1
checkers/check_nntps
Symbolic link
1
checkers/check_nntps
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_nt
Executable file
BIN
checkers/check_nt
Executable file
Binary file not shown.
465
checkers/check_ntp
Executable file
465
checkers/check_ntp
Executable file
@@ -0,0 +1,465 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
|
# (c)1999 Ian Cass, Knowledge Matters Ltd.
|
||||||
|
# Read the GNU copyright stuff for all the legalese
|
||||||
|
#
|
||||||
|
# Check NTP time servers plugin. This plugin requires the ntpdate utility to
|
||||||
|
# be installed on the system, however since it's part of the ntp suite, you
|
||||||
|
# should already have it installed.
|
||||||
|
#
|
||||||
|
# $Id: check_ntp.pl,v 1.29 2005/05/25 14:05:41 sghosh Exp $
|
||||||
|
#
|
||||||
|
# Nothing clever done in this program - its a very simple bare basics hack to
|
||||||
|
# get the job done.
|
||||||
|
#
|
||||||
|
# Things to do...
|
||||||
|
# check @words[9] for time differences greater than +/- x secs & return a
|
||||||
|
# warning.
|
||||||
|
#
|
||||||
|
# (c) 1999 Mark Jewiss, Knowledge Matters Limited
|
||||||
|
# 22-9-1999, 12:45
|
||||||
|
#
|
||||||
|
# Modified script to accept 2 parameters or set defaults.
|
||||||
|
# Now issues warning or critical alert is time difference is greater than the
|
||||||
|
# time passed.
|
||||||
|
#
|
||||||
|
# These changes have not been tested completely due to the unavailability of a
|
||||||
|
# server with the incorrect time.
|
||||||
|
#
|
||||||
|
# (c) 1999 Bo Kersey, VirCIO - Managed Server Solutions <bo@vircio.com>
|
||||||
|
# 22-10-99, 12:17
|
||||||
|
#
|
||||||
|
# Modified the script to give useage if no parameters are input.
|
||||||
|
#
|
||||||
|
# Modified the script to check for negative as well as positive
|
||||||
|
# time differences.
|
||||||
|
#
|
||||||
|
# Modified the script to work with ntpdate 3-5.93e Wed Apr 14 20:23:03 EDT 1999
|
||||||
|
#
|
||||||
|
# Modified the script to work with ntpdate's that return adjust or offset...
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Script modified 2000 June 01 by William Pietri <william@bianca.com>
|
||||||
|
#
|
||||||
|
# Modified script to handle weird cases:
|
||||||
|
# o NTP server doesn't respond (e.g., has died)
|
||||||
|
# o Server has correct time but isn't suitable synchronization
|
||||||
|
# source. This happens while starting up and if contact
|
||||||
|
# with master has been lost.
|
||||||
|
#
|
||||||
|
# Modifed to run under Embedded Perl (sghosh@users.sf.net)
|
||||||
|
# - combined logic some blocks together..
|
||||||
|
#
|
||||||
|
# Added ntpdate check for stratum 16 desynch peer (James Fidell) Feb 03, 2003
|
||||||
|
#
|
||||||
|
# ntpdate - offset is in seconds
|
||||||
|
# changed ntpdc to ntpq - jitter/dispersion is in milliseconds
|
||||||
|
#
|
||||||
|
# Patch for for regex for stratum1 refid.
|
||||||
|
|
||||||
|
require 5.004;
|
||||||
|
use POSIX;
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_O $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6);
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
|
||||||
|
$PROGNAME="check_ntp";
|
||||||
|
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
|
||||||
|
# defaults in sec
|
||||||
|
my $DEFAULT_OFFSET_WARN = 60; # 1 minute
|
||||||
|
my $DEFAULT_OFFSET_CRIT = 120; # 2 minutes
|
||||||
|
# default in millisec
|
||||||
|
my $DEFAULT_JITTER_WARN = 5000; # 5 sec
|
||||||
|
my $DEFAULT_JITTER_CRIT = 10000; # 10 sec
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v" => \$verbose, "verbose" => \$verbose,
|
||||||
|
"4" => \$ipv4, "use-ipv4" => \$ipv4,
|
||||||
|
"6" => \$ipv6, "use-ipv6" => \$ipv6,
|
||||||
|
"w=f" => \$opt_w, "warning=f" => \$opt_w, # offset|adjust warning if above this number
|
||||||
|
"c=f" => \$opt_c, "critical=f" => \$opt_c, # offset|adjust critical if above this number
|
||||||
|
"O" => \$opt_O, "zero-offset" => \$opt_O, # zero-offset bad
|
||||||
|
"j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number
|
||||||
|
"k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number
|
||||||
|
"t=s" => \$opt_t, "timeout=i" => \$opt_t,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.29 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# jitter test params specified
|
||||||
|
if (defined $opt_j || defined $opt_k ) {
|
||||||
|
$def_jitter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt_H = shift unless ($opt_H);
|
||||||
|
my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/);
|
||||||
|
unless ($host) {
|
||||||
|
print "No target host specified\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
my ($timeout, $owarn, $ocrit, $jwarn, $jcrit);
|
||||||
|
|
||||||
|
$timeout = $TIMEOUT;
|
||||||
|
($opt_t) && ($opt_t =~ /^([0-9]+)$/) && ($timeout = $1);
|
||||||
|
|
||||||
|
$owarn = $DEFAULT_OFFSET_WARN;
|
||||||
|
($opt_w) && ($opt_w =~ /^([0-9.]+)$/) && ($owarn = $1);
|
||||||
|
|
||||||
|
$ocrit = $DEFAULT_OFFSET_CRIT;
|
||||||
|
($opt_c) && ($opt_c =~ /^([0-9.]+)$/) && ($ocrit = $1);
|
||||||
|
|
||||||
|
$jwarn = $DEFAULT_JITTER_WARN;
|
||||||
|
($opt_j) && ($opt_j =~ /^([0-9]+)$/) && ($jwarn = $1);
|
||||||
|
|
||||||
|
$jcrit = $DEFAULT_JITTER_CRIT;
|
||||||
|
($opt_k) && ($opt_k =~ /^([0-9]+)$/) && ($jcrit = $1);
|
||||||
|
|
||||||
|
if ($ocrit < $owarn ) {
|
||||||
|
print "Critical offset should be larger than warning offset\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($def_jitter) {
|
||||||
|
if ($opt_k < $opt_j) {
|
||||||
|
print "Critical jitter should be larger than warning jitter\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
my $stratum = -1;
|
||||||
|
my $ignoreret = 0;
|
||||||
|
my $answer = undef;
|
||||||
|
my $offset = undef;
|
||||||
|
my $jitter = undef;
|
||||||
|
my $syspeer = undef;
|
||||||
|
my $candidate = 0;
|
||||||
|
my @candidates;
|
||||||
|
my $msg; # first line of output to print if format is invalid
|
||||||
|
|
||||||
|
my $state = $ERRORS{'UNKNOWN'};
|
||||||
|
my $ntpdate_error = $ERRORS{'UNKNOWN'};
|
||||||
|
my $jitter_error = $ERRORS{'UNKNOWN'};
|
||||||
|
|
||||||
|
# some systems don't have a proper ntpq (migrated from ntpdc)
|
||||||
|
my $have_ntpq = undef;
|
||||||
|
if ($utils::PATH_TO_NTPQ && -x $utils::PATH_TO_NTPQ ) {
|
||||||
|
$have_ntpq = 1;
|
||||||
|
}else{
|
||||||
|
$have_ntpq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: No response from ntp server (alarm)\n");
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
alarm($timeout);
|
||||||
|
|
||||||
|
# Determine protocol to be used for ntpdate and ntpq
|
||||||
|
my $ntpdate = $utils::PATH_TO_NTPDATE;
|
||||||
|
my $ntpq = $utils::PATH_TO_NTPQ;
|
||||||
|
if ($ipv4) {
|
||||||
|
$ntpdate .= " -4";
|
||||||
|
$ntpq .= " -4";
|
||||||
|
}
|
||||||
|
elsif ($ipv6) {
|
||||||
|
$ntpdate .= " -6";
|
||||||
|
$ntpq .= " -6";
|
||||||
|
}
|
||||||
|
# else don't use any flags
|
||||||
|
|
||||||
|
###
|
||||||
|
###
|
||||||
|
### First, check ntpdate
|
||||||
|
###
|
||||||
|
###
|
||||||
|
|
||||||
|
if (!open (NTPDATE, $ntpdate . " -q $host 2>&1 |")) {
|
||||||
|
print "Could not open ntpdate\n";
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}
|
||||||
|
|
||||||
|
while (<NTPDATE>) {
|
||||||
|
#print if ($verbose); # noop
|
||||||
|
$msg = $_ unless ($msg);
|
||||||
|
|
||||||
|
if (/stratum\s(\d+)/) {
|
||||||
|
$stratum = $1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/(offset|adjust)\s+([-.\d]+)/i) {
|
||||||
|
$offset = $2;
|
||||||
|
|
||||||
|
# An offset of 0.000000 with an error is probably bogus. Actually,
|
||||||
|
# it's probably always bogus, but let's be paranoid here.
|
||||||
|
# Has been reported that 0.0000 happens in a production environment
|
||||||
|
# on Solaris 8 so this check should be taken out - SF tracker 1150777
|
||||||
|
if (defined $opt_O ) {
|
||||||
|
if ($offset == 0) { undef $offset;}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"};
|
||||||
|
print "ntperr = $ntpdate_error \n" if $verbose;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (/no server suitable for synchronization found/) {
|
||||||
|
if ($stratum == 16) {
|
||||||
|
$ntpdate_error = $ERRORS{"WARNING"};
|
||||||
|
$msg = "Desynchronized peer server found";
|
||||||
|
$ignoreret=1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ntpdate_error = $ERRORS{"CRITICAL"};
|
||||||
|
$msg = "No suitable peer server found - ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
close (NTPDATE);
|
||||||
|
# declare an error if we also get a non-zero return code from ntpdate
|
||||||
|
# unless already set to critical
|
||||||
|
if ( $? && !$ignoreret ) {
|
||||||
|
print "stderr = $? : $! \n" if $verbose;
|
||||||
|
$ntpdate_error = $ntpdate_error == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"UNKNOWN"} ;
|
||||||
|
print "ntperr = $ntpdate_error : $!\n" if $verbose;
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
###
|
||||||
|
### Then scan xntpq/ntpq if it exists
|
||||||
|
### and look in the 11th column for jitter
|
||||||
|
###
|
||||||
|
# Field 1: Tally Code ( Space, 'x','.','-','+','#','*','o')
|
||||||
|
# Only match for '*' which implies sys.peer
|
||||||
|
# or 'o' which implies pps.peer
|
||||||
|
# If both exist, the last one is picked.
|
||||||
|
# Field 2: address of the remote peer
|
||||||
|
# Field 3: Refid of the clock (0.0.0.0 if unknown, WWWV/PPS/GPS/ACTS/USNO/PCS/... if Stratum1)
|
||||||
|
# Field 4: stratum (0-15)
|
||||||
|
# Field 5: Type of the peer: local (l), unicast (u), multicast (m)
|
||||||
|
# broadcast (b); not sure about multicast/broadcast
|
||||||
|
# Field 6: last packet receive (in seconds)
|
||||||
|
# Field 7: polling interval
|
||||||
|
# Field 8: reachability resgister (octal)
|
||||||
|
# Field 9: delay
|
||||||
|
# Field 10: offset
|
||||||
|
# Field 11: dispersion/jitter
|
||||||
|
#
|
||||||
|
# According to bug 773588 Some solaris xntpd implementations seemto match on
|
||||||
|
# "#" even though the docs say it exceeds maximum distance. Providing patch
|
||||||
|
# here which will generate a warining.
|
||||||
|
|
||||||
|
if ($have_ntpq) {
|
||||||
|
|
||||||
|
if ( open(NTPQ, $ntpq . " -np $host 2>&1 |") ) {
|
||||||
|
while (<NTPQ>) {
|
||||||
|
print $_ if ($verbose);
|
||||||
|
if ( /timed out/ ){
|
||||||
|
$have_ntpq = 0 ;
|
||||||
|
last ;
|
||||||
|
}
|
||||||
|
# number of candidates on <host> for sys.peer
|
||||||
|
if (/^(\*|\+|\#|o])/) {
|
||||||
|
++$candidate;
|
||||||
|
push (@candidates, $_);
|
||||||
|
print "Candidate count= $candidate\n" if ($verbose);
|
||||||
|
}
|
||||||
|
|
||||||
|
# match sys.peer or pps.peer
|
||||||
|
if (/^(\*|o)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
|
||||||
|
$syspeer = $2;
|
||||||
|
$stratum = $4;
|
||||||
|
$jitter = $11;
|
||||||
|
print "match $_ \n" if $verbose;
|
||||||
|
if ($jitter > $jcrit) {
|
||||||
|
print "Jitter_crit = $11 :$jcrit\n" if ($verbose);
|
||||||
|
$jitter_error = $ERRORS{'CRITICAL'};
|
||||||
|
} elsif ($jitter > $jwarn ) {
|
||||||
|
print "Jitter_warn = $11 :$jwarn\n" if ($verbose);
|
||||||
|
$jitter_error = $ERRORS{'WARNING'};
|
||||||
|
} else {
|
||||||
|
$jitter_error = $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print "No match!\n" if $verbose;
|
||||||
|
$jitter = '(not parsed)';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
close NTPQ;
|
||||||
|
|
||||||
|
# if we did not match sys.peer or pps.peer but matched # candidates only
|
||||||
|
# generate a warning
|
||||||
|
# based on bug id 773588
|
||||||
|
unless (defined $syspeer) {
|
||||||
|
if ($#candidates >=0) {
|
||||||
|
foreach my $c (@candidates) {
|
||||||
|
$c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/;
|
||||||
|
$syspeer = $2;
|
||||||
|
$stratum = $4;
|
||||||
|
$jitter = $11;
|
||||||
|
print "candidate match $c \n" if $verbose;
|
||||||
|
if ($jitter > $jcrit) {
|
||||||
|
print "Candidate match - Jitter_crit = $11 :$jcrit\n" if ($verbose);
|
||||||
|
$jitter_error = $ERRORS{'CRITICAL'};
|
||||||
|
}elsif ($jitter > $jwarn ) {
|
||||||
|
print "Candidate match - Jitter_warn = $11 :$jwarn \n" if ($verbose);
|
||||||
|
$jitter_error = $ERRORS{'WARNING'};
|
||||||
|
} else {
|
||||||
|
$jitter_error = $ERRORS{'WARNING'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($ntpdate_error != $ERRORS{'OK'}) {
|
||||||
|
$state = $ntpdate_error;
|
||||||
|
if ($ntpdate_error == $ERRORS{'WARNING'} ) {
|
||||||
|
$answer = $msg;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$answer = $msg . "Server for ntp probably down";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined($offset) && abs($offset) > $ocrit) {
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
$answer = "Server Error and offset $offset sec > +/- $ocrit sec";
|
||||||
|
} elsif (defined($offset) && abs($offset) > $owarn) {
|
||||||
|
$answer = "Server error and offset $offset sec > +/- $owarn sec";
|
||||||
|
} elsif (defined($jitter) && abs($jitter) > $jcrit) {
|
||||||
|
$answer = "Server error and jitter $jitter msec > +/- $jcrit msec";
|
||||||
|
} elsif (defined($jitter) && abs($jitter) > $jwarn) {
|
||||||
|
$answer = "Server error and jitter $jitter msec > +/- $jwarn msec";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) {
|
||||||
|
$state = $jitter_error;
|
||||||
|
$answer = "Jitter $jitter too high";
|
||||||
|
if (defined($offset) && abs($offset) > $ocrit) {
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
$answer = "Jitter error and offset $offset sec > +/- $ocrit sec";
|
||||||
|
} elsif (defined($offset) && abs($offset) > $owarn) {
|
||||||
|
$answer = "Jitter error and offset $offset sec > +/- $owarn sec";
|
||||||
|
} elsif (defined($jitter) && abs($jitter) > $jcrit) {
|
||||||
|
$answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec";
|
||||||
|
} elsif (defined($jitter) && abs($jitter) > $jwarn) {
|
||||||
|
$answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec";
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out
|
||||||
|
if (abs($offset) > $ocrit) {
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
$answer = "Offset $offset sec > +/- $ocrit sec";
|
||||||
|
} elsif (abs($offset) > $owarn) {
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
$answer = "Offset $offset sec > +/- $owarn sec";
|
||||||
|
} elsif (( abs($offset) > $owarn) && $def_jitter ) {
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
$answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out";
|
||||||
|
} elsif ( $def_jitter ) {
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
$answer = "Offset $offset secs, ntpq timed out";
|
||||||
|
} else{
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
$answer = "Offset $offset secs";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else { # no errors from ntpdate or ntpq
|
||||||
|
if (abs($offset) > $ocrit) {
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
$answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec";
|
||||||
|
} elsif (abs($jitter) > $jcrit ) {
|
||||||
|
$state = $ERRORS{'CRITICAL'};
|
||||||
|
$answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec";
|
||||||
|
} elsif (abs($offset) > $owarn) {
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
$answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec";
|
||||||
|
} elsif (abs($jitter) > $jwarn ) {
|
||||||
|
$state = $ERRORS{'WARNING'};
|
||||||
|
$answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$state = $ERRORS{'OK'};
|
||||||
|
$answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $key (keys %ERRORS) {
|
||||||
|
if ($state==$ERRORS{$key}) {
|
||||||
|
# print ("NTP $key: $answer");
|
||||||
|
print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n");
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit $state;
|
||||||
|
|
||||||
|
|
||||||
|
####
|
||||||
|
#### subs
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -H <host> [-46] [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.29 $');
|
||||||
|
print "Copyright (c) 2003 Bo Kersey/Karl DeBisschop\n";
|
||||||
|
print "\n";
|
||||||
|
print_usage();
|
||||||
|
print "
|
||||||
|
Checks the local timestamp offset versus <host> with ntpdate
|
||||||
|
Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n
|
||||||
|
-O (--zero-offset)
|
||||||
|
A zero offset on \"ntpdate\" will generate a CRITICAL.\n
|
||||||
|
-w (--warning)
|
||||||
|
Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN.
|
||||||
|
-c (--critical)
|
||||||
|
Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT.
|
||||||
|
-j (--jwarn)
|
||||||
|
Clock jitter in milliseconds at which a warning message will be generated.\n Defaults to $DEFAULT_JITTER_WARN.
|
||||||
|
-k (--jcrit)
|
||||||
|
Clock jitter in milliseconds at which a critical message will be generated.\n Defaults to $DEFAULT_JITTER_CRIT.
|
||||||
|
|
||||||
|
If jitter/dispersion is specified with -j or -k and ntpq times out, then a
|
||||||
|
warning is returned.\n
|
||||||
|
-4 (--use-ipv4)
|
||||||
|
Use IPv4 connection
|
||||||
|
-6 (--use-ipv6)
|
||||||
|
Use IPv6 connection
|
||||||
|
\n";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/check_nwstat
Executable file
BIN
checkers/check_nwstat
Executable file
Binary file not shown.
284
checkers/check_oracle
Executable file
284
checkers/check_oracle
Executable file
@@ -0,0 +1,284 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# latigid010@yahoo.com
|
||||||
|
# 01/06/2000
|
||||||
|
#
|
||||||
|
# This Nagios plugin was created to check Oracle status
|
||||||
|
#
|
||||||
|
|
||||||
|
PROGNAME=`basename $0`
|
||||||
|
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||||
|
REVISION=`echo '$Revision: 1.14 $' | sed -e 's/[^0-9.]//g'`
|
||||||
|
|
||||||
|
. $PROGPATH/utils.sh
|
||||||
|
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo "Usage:"
|
||||||
|
echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
|
||||||
|
echo " $PROGNAME --db <ORACLE_SID>"
|
||||||
|
echo " $PROGNAME --login <ORACLE_SID>"
|
||||||
|
echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>"
|
||||||
|
echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>"
|
||||||
|
echo " $PROGNAME --oranames <Hostname>"
|
||||||
|
echo " $PROGNAME --help"
|
||||||
|
echo " $PROGNAME --version"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_help() {
|
||||||
|
print_revision $PROGNAME $REVISION
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
echo ""
|
||||||
|
echo "Check Oracle status"
|
||||||
|
echo ""
|
||||||
|
echo "--tns SID/IP Address"
|
||||||
|
echo " Check remote TNS server"
|
||||||
|
echo "--db SID"
|
||||||
|
echo " Check local database (search /bin/ps for PMON process) and check"
|
||||||
|
echo " filesystem for sgadefORACLE_SID.dbf"
|
||||||
|
echo "--login SID"
|
||||||
|
echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password"
|
||||||
|
echo "--cache"
|
||||||
|
echo " Check local database for library and buffer cache hit ratios"
|
||||||
|
echo " ---> Requires Oracle user/password and SID specified."
|
||||||
|
echo " ---> Requires select on v_$sysstat and v_$librarycache"
|
||||||
|
echo "--tablespace"
|
||||||
|
echo " Check local database for tablespace capacity in ORACLE_SID"
|
||||||
|
echo " ---> Requires Oracle user/password specified."
|
||||||
|
echo " ---> Requires select on dba_data_files and dba_free_space"
|
||||||
|
echo "--oranames Hostname"
|
||||||
|
echo " Check remote Oracle Names server"
|
||||||
|
echo "--help"
|
||||||
|
echo " Print this help screen"
|
||||||
|
echo "--version"
|
||||||
|
echo " Print version and license information"
|
||||||
|
echo ""
|
||||||
|
echo "If the plugin doesn't work, check that the ORACLE_HOME environment"
|
||||||
|
echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the"
|
||||||
|
echo "tnsnames.ora file is locatable and is properly configured."
|
||||||
|
echo ""
|
||||||
|
echo "When checking local database status your ORACLE_SID is case sensitive."
|
||||||
|
echo ""
|
||||||
|
echo "If you want to use a default Oracle home, add in your oratab file:"
|
||||||
|
echo "*:/opt/app/oracle/product/7.3.4:N"
|
||||||
|
echo ""
|
||||||
|
support
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
1)
|
||||||
|
cmd='--tns'
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
cmd='--db'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cmd="$1"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Information options
|
||||||
|
case "$cmd" in
|
||||||
|
--help)
|
||||||
|
print_help
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
-h)
|
||||||
|
print_help
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
--version)
|
||||||
|
print_revision $PLUGIN $REVISION
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
-V)
|
||||||
|
print_revision $PLUGIN $REVISION
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Hunt down a reasonable ORACLE_HOME
|
||||||
|
if [ -z "$ORACLE_HOME" ] ; then
|
||||||
|
# Adjust to taste
|
||||||
|
for oratab in /var/opt/oracle/oratab /etc/oratab
|
||||||
|
do
|
||||||
|
[ ! -f $oratab ] && continue
|
||||||
|
ORACLE_HOME=`IFS=:
|
||||||
|
while read SID ORACLE_HOME junk;
|
||||||
|
do
|
||||||
|
if [ "$SID" = "$2" -o "$SID" = "*" ] ; then
|
||||||
|
echo $ORACLE_HOME;
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
done < $oratab`
|
||||||
|
[ -n "$ORACLE_HOME" ] && break
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# Last resort
|
||||||
|
[ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle
|
||||||
|
|
||||||
|
if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then
|
||||||
|
echo "Cannot determine ORACLE_HOME for sid $2"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
PATH=$PATH:$ORACLE_HOME/bin
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
|
||||||
|
export ORACLE_HOME PATH LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
case "$cmd" in
|
||||||
|
--tns)
|
||||||
|
tnschk=` tnsping $2`
|
||||||
|
tnschk2=` echo $tnschk | grep -c OK`
|
||||||
|
if [ ${tnschk2} -eq 1 ] ; then
|
||||||
|
tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'`
|
||||||
|
echo "OK - reply time ${tnschk3} from $2"
|
||||||
|
exit $STATE_OK
|
||||||
|
else
|
||||||
|
echo "No TNS Listener on $2"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--oranames)
|
||||||
|
namesctl status $2 | awk '
|
||||||
|
/Server has been running for:/ {
|
||||||
|
msg = "OK: Up"
|
||||||
|
for (i = 6; i <= NF; i++) {
|
||||||
|
msg = msg " " $i
|
||||||
|
}
|
||||||
|
status = '$STATE_OK'
|
||||||
|
}
|
||||||
|
/error/ {
|
||||||
|
msg = "CRITICAL: " $0
|
||||||
|
status = '$STATE_CRITICAL'
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
print msg
|
||||||
|
exit status
|
||||||
|
}'
|
||||||
|
;;
|
||||||
|
--db)
|
||||||
|
pmonchk=`ps -ef | grep -v grep | grep -c "ora_pmon_${2}$"`
|
||||||
|
if [ ${pmonchk} -ge 1 ] ; then
|
||||||
|
echo "${2} OK - ${pmonchk} PMON process(es) running"
|
||||||
|
exit $STATE_OK
|
||||||
|
#if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then
|
||||||
|
#if [ ${pmonchk} -eq 1 ] ; then
|
||||||
|
#utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55`
|
||||||
|
#echo "${2} OK - running since ${utime}"
|
||||||
|
#exit $STATE_OK
|
||||||
|
#fi
|
||||||
|
else
|
||||||
|
echo "${2} Database is DOWN"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--login)
|
||||||
|
loginchk=`sqlplus dummy/user@$2 < /dev/null`
|
||||||
|
loginchk2=` echo $loginchk | grep -c ORA-01017`
|
||||||
|
if [ ${loginchk2} -eq 1 ] ; then
|
||||||
|
echo "OK - dummy login connected"
|
||||||
|
exit $STATE_OK
|
||||||
|
else
|
||||||
|
loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
|
||||||
|
echo "CRITICAL - $loginchk3"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--cache)
|
||||||
|
if [ ${5} -gt ${6} ] ; then
|
||||||
|
echo "UNKNOWN - Warning level is less then Crit"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
result=`sqlplus -s ${3}/${4}@${2} << EOF
|
||||||
|
set pagesize 0
|
||||||
|
set numf '9999999.99'
|
||||||
|
select (1-(pr.value/(dbg.value+cg.value)))*100
|
||||||
|
from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg
|
||||||
|
where pr.name='physical reads'
|
||||||
|
and dbg.name='db block gets'
|
||||||
|
and cg.name='consistent gets';
|
||||||
|
EOF`
|
||||||
|
|
||||||
|
if [ -n "`echo $result | grep ORA-`" ] ; then
|
||||||
|
error=` echo "$result" | grep "ORA-" | head -1`
|
||||||
|
echo "CRITICAL - $error"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
|
||||||
|
buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'`
|
||||||
|
result=`sqlplus -s ${3}/${4}@${2} << EOF
|
||||||
|
set pagesize 0
|
||||||
|
set numf '9999999.99'
|
||||||
|
select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100
|
||||||
|
from v\\$librarycache lc;
|
||||||
|
EOF`
|
||||||
|
|
||||||
|
if [ -n "`echo $result | grep ORA-`" ] ; then
|
||||||
|
error=` echo "$result" | grep "ORA-" | head -1`
|
||||||
|
echo "CRITICAL - $error"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
|
||||||
|
lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'`
|
||||||
|
|
||||||
|
if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
|
||||||
|
echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then
|
||||||
|
echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
|
||||||
|
exit $STATE_WARNING
|
||||||
|
fi
|
||||||
|
echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
|
||||||
|
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
--tablespace)
|
||||||
|
if [ ${6} -lt ${7} ] ; then
|
||||||
|
echo "UNKNOWN - Warning level is more then Crit"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
result=`sqlplus -s ${3}/${4}@${2} << EOF
|
||||||
|
set pagesize 0
|
||||||
|
set numf '9999999.99'
|
||||||
|
select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc
|
||||||
|
from (
|
||||||
|
select tablespace_name,sum(bytes)/1024/1024 total
|
||||||
|
from dba_data_files group by tablespace_name) A,
|
||||||
|
( select tablespace_name,sum(bytes)/1024/1024 free
|
||||||
|
from dba_free_space group by tablespace_name) B
|
||||||
|
where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}';
|
||||||
|
EOF`
|
||||||
|
|
||||||
|
if [ -n "`echo $result | grep ORA-`" ] ; then
|
||||||
|
error=` echo "$result" | grep "ORA-" | head -1`
|
||||||
|
echo "CRITICAL - $error"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
|
||||||
|
ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'`
|
||||||
|
ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'`
|
||||||
|
ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'`
|
||||||
|
ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'`
|
||||||
|
if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then
|
||||||
|
echo "No data returned by Oracle - tablespace $5 not found?"
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
if [ "$ts_pct" -ge ${6} ] ; then
|
||||||
|
echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
|
||||||
|
exit $STATE_CRITICAL
|
||||||
|
fi
|
||||||
|
if [ "$ts_pct" -ge ${7} ] ; then
|
||||||
|
echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
|
||||||
|
exit $STATE_WARNING
|
||||||
|
fi
|
||||||
|
echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
|
||||||
|
exit $STATE_OK
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
print_usage
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
esac
|
BIN
checkers/check_overcr
Executable file
BIN
checkers/check_overcr
Executable file
Binary file not shown.
BIN
checkers/check_pgsql
Executable file
BIN
checkers/check_pgsql
Executable file
Binary file not shown.
BIN
checkers/check_ping
Executable file
BIN
checkers/check_ping
Executable file
Binary file not shown.
1
checkers/check_pop
Symbolic link
1
checkers/check_pop
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_procs
Executable file
BIN
checkers/check_procs
Executable file
Binary file not shown.
BIN
checkers/check_radius
Executable file
BIN
checkers/check_radius
Executable file
Binary file not shown.
BIN
checkers/check_real
Executable file
BIN
checkers/check_real
Executable file
Binary file not shown.
377
checkers/check_rpc
Executable file
377
checkers/check_rpc
Executable file
@@ -0,0 +1,377 @@
|
|||||||
|
#! /usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# check_rpc plugin for nagios
|
||||||
|
#
|
||||||
|
# usage:
|
||||||
|
# check_rpc host service
|
||||||
|
#
|
||||||
|
# Check if an rpc serice is registered and running
|
||||||
|
# using rpcinfo - $proto $host $prognum 2>&1 |";
|
||||||
|
#
|
||||||
|
# Use these hosts.cfg entries as examples
|
||||||
|
#
|
||||||
|
# command[check_nfs]=/some/path/libexec/check_rpc $HOSTADDRESS$ nfs
|
||||||
|
# service[check_nfs]=NFS;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_rpc
|
||||||
|
#
|
||||||
|
# initial version: 3 May 2000 by Truongchinh Nguyen and Karl DeBisschop
|
||||||
|
# Modified May 2002 Subhendu Ghosh - support for ePN and patches
|
||||||
|
# current status: $Revision: 1.8 $
|
||||||
|
#
|
||||||
|
# Copyright Notice: GPL
|
||||||
|
# $Id: check_rpc.pl,v 1.8 2003/08/10 12:11:49 kdebisschop Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state);
|
||||||
|
my ($array_ref,$test,$element,@progkeys,$proto,$a,$b);
|
||||||
|
my ($opt_V,$opt_h,$opt_C,$opt_p,$opt_H,$opt_c,$opt_u,$opt_t);
|
||||||
|
my ($line, @progvers, $response2,$response3);
|
||||||
|
$opt_V = $opt_h = $opt_C = $opt_p = $opt_H = $opt_u = $opt_t ='';
|
||||||
|
$state = 'UNKNOWN';
|
||||||
|
$progver = $response=$response2= $response3 ='';
|
||||||
|
|
||||||
|
$PROGNAME = "check_rpc";
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
sub in ($$);
|
||||||
|
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'LC_ALL'}='C';
|
||||||
|
|
||||||
|
#Initialise protocol for each progname number
|
||||||
|
# 'u' for UDP, 't' for TCP
|
||||||
|
$proto[10003]='u';
|
||||||
|
$proto[10004]='u';
|
||||||
|
$proto[10007]='u';
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions(
|
||||||
|
"V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"C=s" => \$opt_C, "command=s" => \$opt_C,
|
||||||
|
"p=i" => \$opt_p, "port=i" => \$opt_p,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||||
|
"c=s" => \$opt_c, "progver=s" => \$opt_c,
|
||||||
|
"v+" => \$verbose, "verbose+" => \$verbose,
|
||||||
|
"u" => \$opt_u, "udp" => \$opt_u,
|
||||||
|
"t" => \$opt_t, "tcp" => \$opt_t
|
||||||
|
);
|
||||||
|
|
||||||
|
# -h means display verbose help screen
|
||||||
|
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
|
||||||
|
|
||||||
|
# -V means display version number
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.8 $ ');
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hash containing all RPC program names and numbers
|
||||||
|
# Add to the hash if support for new RPC program is required
|
||||||
|
|
||||||
|
%prognum = (
|
||||||
|
"portmapper" => 100000 ,
|
||||||
|
"portmap" => 100000 ,
|
||||||
|
"sunrpc" => 100000 ,
|
||||||
|
"rpcbind" => 100000 ,
|
||||||
|
"rstatd" => 100001 ,
|
||||||
|
"rstat" => 100001 ,
|
||||||
|
"rup" => 100001 ,
|
||||||
|
"perfmeter" => 100001 ,
|
||||||
|
"rstat_svc" => 100001 ,
|
||||||
|
"rusersd" => 100002 ,
|
||||||
|
"rusers" => 100002 ,
|
||||||
|
"nfs" => 100003 ,
|
||||||
|
"nfsprog" => 100003 ,
|
||||||
|
"ypserv" => 100004 ,
|
||||||
|
"ypprog" => 100004 ,
|
||||||
|
"mountd" => 100005 ,
|
||||||
|
"mount" => 100005 ,
|
||||||
|
"showmount" => 100005 ,
|
||||||
|
"ypbind" => 100007 ,
|
||||||
|
"walld" => 100008 ,
|
||||||
|
"rwall" => 100008 ,
|
||||||
|
"shutdown" => 100008 ,
|
||||||
|
"yppasswdd" => 100009 ,
|
||||||
|
"yppasswd" => 100009 ,
|
||||||
|
"etherstatd" => 100010 ,
|
||||||
|
"etherstat" => 100010 ,
|
||||||
|
"rquotad" => 100011 ,
|
||||||
|
"rquotaprog" => 100011 ,
|
||||||
|
"quota" => 100011 ,
|
||||||
|
"rquota" => 100011 ,
|
||||||
|
"sprayd" => 100012 ,
|
||||||
|
"spray" => 100012 ,
|
||||||
|
"3270_mapper" => 100013 ,
|
||||||
|
"rje_mapper" => 100014 ,
|
||||||
|
"selection_svc" => 100015 ,
|
||||||
|
"selnsvc" => 100015 ,
|
||||||
|
"database_svc" => 100016 ,
|
||||||
|
"rexd" => 100017 ,
|
||||||
|
"rex" => 100017 ,
|
||||||
|
"alis" => 100018 ,
|
||||||
|
"sched" => 100019 ,
|
||||||
|
"llockmgr" => 100020 ,
|
||||||
|
"nlockmgr" => 100021 ,
|
||||||
|
"x25_inr" => 100022 ,
|
||||||
|
"statmon" => 100023 ,
|
||||||
|
"status" => 100024 ,
|
||||||
|
"bootparam" => 100026 ,
|
||||||
|
"ypupdated" => 100028 ,
|
||||||
|
"ypupdate" => 100028 ,
|
||||||
|
"keyserv" => 100029 ,
|
||||||
|
"keyserver" => 100029 ,
|
||||||
|
"sunlink_mapper" => 100033 ,
|
||||||
|
"tfsd" => 100037 ,
|
||||||
|
"nsed" => 100038 ,
|
||||||
|
"nsemntd" => 100039 ,
|
||||||
|
"showfhd" => 100043 ,
|
||||||
|
"showfh" => 100043 ,
|
||||||
|
"ioadmd" => 100055 ,
|
||||||
|
"rpc.ioadmd" => 100055 ,
|
||||||
|
"NETlicense" => 100062 ,
|
||||||
|
"sunisamd" => 100065 ,
|
||||||
|
"debug_svc" => 100066 ,
|
||||||
|
"dbsrv" => 100066 ,
|
||||||
|
"ypxfrd" => 100069 ,
|
||||||
|
"rpc.ypxfrd" => 100069 ,
|
||||||
|
"bugtraqd" => 100071 ,
|
||||||
|
"kerbd" => 100078 ,
|
||||||
|
"event" => 100101 ,
|
||||||
|
"na.event" => 100101 ,
|
||||||
|
"logger" => 100102 ,
|
||||||
|
"na.logger" => 100102 ,
|
||||||
|
"sync" => 100104 ,
|
||||||
|
"na.sync" => 100104 ,
|
||||||
|
"hostperf" => 100107 ,
|
||||||
|
"na.hostperf" => 100107 ,
|
||||||
|
"activity" => 100109 ,
|
||||||
|
"na.activity" => 100109 ,
|
||||||
|
"hostmem" => 100112 ,
|
||||||
|
"na.hostmem" => 100112 ,
|
||||||
|
"sample" => 100113 ,
|
||||||
|
"na.sample" => 100113 ,
|
||||||
|
"x25" => 100114 ,
|
||||||
|
"na.x25" => 100114 ,
|
||||||
|
"ping" => 100115 ,
|
||||||
|
"na.ping" => 100115 ,
|
||||||
|
"rpcnfs" => 100116 ,
|
||||||
|
"na.rpcnfs" => 100116 ,
|
||||||
|
"hostif" => 100117 ,
|
||||||
|
"na.hostif" => 100117 ,
|
||||||
|
"etherif" => 100118 ,
|
||||||
|
"na.etherif" => 100118 ,
|
||||||
|
"iproutes" => 100120 ,
|
||||||
|
"na.iproutes" => 100120 ,
|
||||||
|
"layers" => 100121 ,
|
||||||
|
"na.layers" => 100121 ,
|
||||||
|
"snmp" => 100122 ,
|
||||||
|
"na.snmp" => 100122 ,
|
||||||
|
"snmp-cmc" => 100122 ,
|
||||||
|
"snmp-synoptics" => 100122 ,
|
||||||
|
"snmp-unisys" => 100122 ,
|
||||||
|
"snmp-utk" => 100122 ,
|
||||||
|
"traffic" => 100123 ,
|
||||||
|
"na.traffic" => 100123 ,
|
||||||
|
"nfs_acl" => 100227 ,
|
||||||
|
"sadmind" => 100232 ,
|
||||||
|
"nisd" => 100300 ,
|
||||||
|
"rpc.nisd" => 100300 ,
|
||||||
|
"nispasswd" => 100303 ,
|
||||||
|
"rpc.nispasswdd" => 100303 ,
|
||||||
|
"ufsd" => 100233 ,
|
||||||
|
"ufsd" => 100233 ,
|
||||||
|
"pcnfsd" => 150001 ,
|
||||||
|
"pcnfs" => 150001 ,
|
||||||
|
"amd" => 300019 ,
|
||||||
|
"amq" => 300019 ,
|
||||||
|
"bwnfsd" => 545580417 ,
|
||||||
|
"fypxfrd" => 600100069 ,
|
||||||
|
"freebsd-ypxfrd" => 600100069 ,
|
||||||
|
);
|
||||||
|
|
||||||
|
# -v means verbose, -v-v means verbose twice = print above hash
|
||||||
|
if (defined $verbose && ($verbose > 1) ){
|
||||||
|
my $key;
|
||||||
|
print "Supported programs:\n";
|
||||||
|
print " name\t=>\tnumber\n";
|
||||||
|
print " ===============================\n";
|
||||||
|
foreach $key (sort keys %prognum) {
|
||||||
|
print " $key \t=>\t$prognum{$key} \n";
|
||||||
|
}
|
||||||
|
print "\n\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# -H means host name
|
||||||
|
unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; }
|
||||||
|
|
||||||
|
if (! utils::is_hostname($opt_H)){
|
||||||
|
print "$opt_H is not a valid host name\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
}else{
|
||||||
|
$host = $opt_H;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_t && $opt_u) {
|
||||||
|
print "Cannot define tcp AND udp\n";
|
||||||
|
print_usage();
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# -C means command name or number
|
||||||
|
$opt_C = shift unless ($opt_C);
|
||||||
|
unless ($opt_C) { print_usage(); exit -1; }
|
||||||
|
@progkeys = keys %prognum;
|
||||||
|
if ($opt_C =~ m/^([0-9]+)$/){
|
||||||
|
# $response = "RPC ok: program $opt_C (version ";
|
||||||
|
$prognum = $1;
|
||||||
|
} elsif ( in( \@progkeys, $opt_C)) {
|
||||||
|
# $response = "RPC ok: $opt_C (version ";
|
||||||
|
$prognum = $prognum{$opt_C};
|
||||||
|
} else {
|
||||||
|
print "Program $opt_C is not defined\n";
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
# -p means port number
|
||||||
|
if($opt_p =~ /^([0-9]+)$/){
|
||||||
|
$port = "-n $1";
|
||||||
|
} else {
|
||||||
|
$port = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$proto = 'u';
|
||||||
|
$proto = $proto[$prognum] if ($proto[$prognum]);
|
||||||
|
$proto = 't' if ($opt_t);
|
||||||
|
$proto = 'u' if ($opt_u);
|
||||||
|
|
||||||
|
|
||||||
|
# Just in case of problems, let's not hang Nagios
|
||||||
|
$SIG{'ALRM'} = sub {
|
||||||
|
print ("ERROR: No response from RPC server (alarm)\n");
|
||||||
|
exit $ERRORS{"UNKNOWN"};
|
||||||
|
};
|
||||||
|
alarm($TIMEOUT);
|
||||||
|
|
||||||
|
# -c is progver - if we need to check multiple specified versions.
|
||||||
|
if (defined $opt_c ) {
|
||||||
|
my $vers;
|
||||||
|
@progvers = split(/,/ ,$opt_c );
|
||||||
|
foreach $vers (sort @progvers) {
|
||||||
|
if($vers =~ /^([0-9]+)$/){
|
||||||
|
$progver = "$1";
|
||||||
|
print "Checking $opt_C version $progver proto $proto\n" if $verbose;
|
||||||
|
get_rpcinfo();
|
||||||
|
}else{
|
||||||
|
print "Version $vers is not an integer\n" if $verbose;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
get_rpcinfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## translate proto for output
|
||||||
|
if ($proto eq "u" ){
|
||||||
|
$proto = "udp";
|
||||||
|
}else{
|
||||||
|
$proto = "tcp";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($state eq 'OK') {
|
||||||
|
print "$state: RPC program $opt_C".$response." $proto running\n";
|
||||||
|
}else{
|
||||||
|
if($response){
|
||||||
|
print "$state: RPC program $opt_C".$response2." $proto is not running,".$response." $proto is running\n";
|
||||||
|
}else{
|
||||||
|
print "$state: RPC program $opt_C $response2 $proto is not running\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit $ERRORS{$state};
|
||||||
|
|
||||||
|
|
||||||
|
######## Subroutines ==========================
|
||||||
|
|
||||||
|
sub get_rpcinfo {
|
||||||
|
$cmd = "$utils::PATH_TO_RPCINFO $port -" . "$proto $host $prognum $progver 2>&1 |";
|
||||||
|
print "$cmd\n" if ($verbose);
|
||||||
|
open CMD, $cmd or die "Can't fork for rpcinfo: $!\n" ;
|
||||||
|
|
||||||
|
while ( $line = <CMD> ) {
|
||||||
|
printf "$line " if $verbose;
|
||||||
|
chomp $line;
|
||||||
|
|
||||||
|
if ( $line =~ /program $prognum version ([0-9]*) ready and waiting/ ) {
|
||||||
|
$response .= " version $1";
|
||||||
|
$state = 'OK' unless $state ne 'UNKNOWN';
|
||||||
|
print "1:$response \n" if $verbose;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $line =~ /program $prognum version ([0-9]*) is not available/ ) {
|
||||||
|
$response2 .= " version $1";
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
print "2:$response2 \n" if $verbose;
|
||||||
|
}
|
||||||
|
if ( $line =~ /program $prognum is not available/ ) {
|
||||||
|
$response3 = "";
|
||||||
|
$response3 = "tcp" if $opt_t;
|
||||||
|
$response3 = "udp" if $opt_u;
|
||||||
|
$state = 'CRITICAL';
|
||||||
|
print "3:$response3 \n" if $verbose;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close CMD;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub print_help() {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.8 $ ');
|
||||||
|
print "Copyright (c) 2002 Karl DeBisschop/Truongchinh Nguyen/Subhendu Ghosh\n";
|
||||||
|
print "\n";
|
||||||
|
print "Check if a rpc service is registered and running using\n";
|
||||||
|
print " rpcinfo -H host -C rpc_command \n";
|
||||||
|
print "\n";
|
||||||
|
print_usage();
|
||||||
|
print "\n";
|
||||||
|
print " <host> The server providing the rpc service\n";
|
||||||
|
print " <rpc_command> The program name (or number).\n";
|
||||||
|
print " <program_version> The version you want to check for (one or more)\n";
|
||||||
|
print " Should prevent checks of unknown versions being syslogged\n";
|
||||||
|
print " e.g. 2,3,6 to check v2, v3, and v6\n";
|
||||||
|
print " [-u | -t] Test UDP or TCP\n";
|
||||||
|
print " [-v] Verbose \n";
|
||||||
|
print " [-v -v] Verbose - will print supported programs and numbers \n";
|
||||||
|
print "\n";
|
||||||
|
support();
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: \n";
|
||||||
|
print " $PROGNAME -H host -C rpc_command [-p port] [-c program_version] [-u|-t] [-v]\n";
|
||||||
|
print " $PROGNAME [-h | --help]\n";
|
||||||
|
print " $PROGNAME [-V | --version]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub in ($$) {
|
||||||
|
$array_ref = shift;
|
||||||
|
$test = shift;
|
||||||
|
|
||||||
|
while ( $element = shift @{$array_ref} ) {
|
||||||
|
if ($test eq $element) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
65
checkers/check_sensors
Executable file
65
checkers/check_sensors
Executable file
@@ -0,0 +1,65 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||||
|
|
||||||
|
PROGNAME=`basename $0`
|
||||||
|
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
|
||||||
|
REVISION=`echo '$Revision: 1.2 $' | sed -e 's/[^0-9.]//g'`
|
||||||
|
|
||||||
|
. $PROGPATH/utils.sh
|
||||||
|
|
||||||
|
|
||||||
|
print_usage() {
|
||||||
|
echo "Usage: $PROGNAME"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_help() {
|
||||||
|
print_revision $PROGNAME $REVISION
|
||||||
|
echo ""
|
||||||
|
print_usage
|
||||||
|
echo ""
|
||||||
|
echo "This plugin checks hardware status using the lm_sensors package."
|
||||||
|
echo ""
|
||||||
|
support
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
--help)
|
||||||
|
print_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-h)
|
||||||
|
print_help
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--version)
|
||||||
|
print_revision $PROGNAME $REVISION
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-V)
|
||||||
|
print_revision $PROGNAME $REVISION
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
sensordata=`sensors 2>&1`
|
||||||
|
status=$?
|
||||||
|
if test "$1" = "-v" -o "$1" = "--verbose"; then
|
||||||
|
echo ${sensordata}
|
||||||
|
fi
|
||||||
|
if test ${status} -eq 127; then
|
||||||
|
echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
|
||||||
|
exit -1
|
||||||
|
elif test ${status} -ne 0 ; then
|
||||||
|
echo "WARNING - sensors returned state $status"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if echo ${sensordata} | egrep ALARM > /dev/null; then
|
||||||
|
echo SENSOR CRITICAL - Sensor alarm detected!
|
||||||
|
exit 2
|
||||||
|
else
|
||||||
|
echo sensor ok
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
1
checkers/check_simap
Symbolic link
1
checkers/check_simap
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_smtp
Executable file
BIN
checkers/check_smtp
Executable file
Binary file not shown.
BIN
checkers/check_snmp
Executable file
BIN
checkers/check_snmp
Executable file
Binary file not shown.
1
checkers/check_spop
Symbolic link
1
checkers/check_spop
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_ssh
Executable file
BIN
checkers/check_ssh
Executable file
Binary file not shown.
1
checkers/check_ssmtp
Symbolic link
1
checkers/check_ssmtp
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_swap
Executable file
BIN
checkers/check_swap
Executable file
Binary file not shown.
BIN
checkers/check_tcp
Executable file
BIN
checkers/check_tcp
Executable file
Binary file not shown.
BIN
checkers/check_time
Executable file
BIN
checkers/check_time
Executable file
Binary file not shown.
BIN
checkers/check_udp
Executable file
BIN
checkers/check_udp
Executable file
Binary file not shown.
1
checkers/check_udp2
Symbolic link
1
checkers/check_udp2
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
check_tcp
|
BIN
checkers/check_ups
Executable file
BIN
checkers/check_ups
Executable file
Binary file not shown.
BIN
checkers/check_users
Executable file
BIN
checkers/check_users
Executable file
Binary file not shown.
123
checkers/check_wave
Executable file
123
checkers/check_wave
Executable file
@@ -0,0 +1,123 @@
|
|||||||
|
#! /usr/bin/perl -wT
|
||||||
|
#
|
||||||
|
# $Id: check_wave.pl,v 1.4 2002/10/28 13:05:08 kdebisschop Exp $
|
||||||
|
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use lib "/usr/lib/nagios/plugins";
|
||||||
|
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||||
|
use vars qw($PROGNAME);
|
||||||
|
use Getopt::Long;
|
||||||
|
use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H);
|
||||||
|
my (@test, $low1, $med1, $high1, $snr, $low2, $med2, $high2);
|
||||||
|
my ($low, $med, $high, $lowavg, $medavg, $highavg, $tot, $ss);
|
||||||
|
|
||||||
|
$PROGNAME = "check_wave";
|
||||||
|
sub print_help ();
|
||||||
|
sub print_usage ();
|
||||||
|
|
||||||
|
$ENV{'PATH'}='';
|
||||||
|
$ENV{'BASH_ENV'}='';
|
||||||
|
$ENV{'ENV'}='';
|
||||||
|
|
||||||
|
Getopt::Long::Configure('bundling');
|
||||||
|
GetOptions
|
||||||
|
("V" => \$opt_V, "version" => \$opt_V,
|
||||||
|
"h" => \$opt_h, "help" => \$opt_h,
|
||||||
|
"v" => \$verbose, "verbose" => \$verbose,
|
||||||
|
"w=s" => \$opt_w, "warning=s" => \$opt_w,
|
||||||
|
"c=s" => \$opt_c, "critical=s" => \$opt_c,
|
||||||
|
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||||
|
|
||||||
|
if ($opt_V) {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.4 $'); #'
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opt_h) {
|
||||||
|
print_help();
|
||||||
|
exit $ERRORS{'OK'};
|
||||||
|
}
|
||||||
|
|
||||||
|
$opt_H = shift unless ($opt_H);
|
||||||
|
print_usage() unless ($opt_H);
|
||||||
|
my $host = $1 if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0]+(\.[a-zA-Z][-a-zA-Z0]+)*)$/);
|
||||||
|
print_usage() unless ($host);
|
||||||
|
|
||||||
|
($opt_c) || ($opt_c = shift) || ($opt_c = 120);
|
||||||
|
my $critical = $1 if ($opt_c =~ /([0-9]+)/);
|
||||||
|
|
||||||
|
($opt_w) || ($opt_w = shift) || ($opt_w = 60);
|
||||||
|
my $warning = $1 if ($opt_w =~ /([0-9]+)/);
|
||||||
|
|
||||||
|
$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
||||||
|
@test = split(/ /,$low1);
|
||||||
|
$low1 = $test[2];
|
||||||
|
|
||||||
|
$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
||||||
|
@test = split(/ /,$med1);
|
||||||
|
$med1 = $test[2];
|
||||||
|
|
||||||
|
$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
||||||
|
@test = split(/ /,$high1);
|
||||||
|
$high1 = $test[2];
|
||||||
|
|
||||||
|
sleep(2);
|
||||||
|
|
||||||
|
$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`;
|
||||||
|
@test = split(/ /,$snr);
|
||||||
|
$snr = $test[2];
|
||||||
|
$snr = int($snr*25);
|
||||||
|
|
||||||
|
$low2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
|
||||||
|
@test = split(/ /,$low2);
|
||||||
|
$low2 = $test[2];
|
||||||
|
|
||||||
|
$med2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
|
||||||
|
@test = split(/ /,$med2);
|
||||||
|
$med2 = $test[2];
|
||||||
|
|
||||||
|
$high2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
|
||||||
|
@test = split(/ /,$high2);
|
||||||
|
$high2 = $test[2];
|
||||||
|
|
||||||
|
$low = $low2 - $low1;
|
||||||
|
$med = $med2 - $med1;
|
||||||
|
$high = $high2 - $high1;
|
||||||
|
|
||||||
|
$tot = $low + $med + $high;
|
||||||
|
|
||||||
|
if ($tot==0) {
|
||||||
|
$ss = 0;
|
||||||
|
} else {
|
||||||
|
$lowavg = $low / $tot;
|
||||||
|
$medavg = $med / $tot;
|
||||||
|
$highavg = $high / $tot;
|
||||||
|
$ss = ($medavg*50) + ($highavg*100);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Signal Strength at: %3.0f%, SNR at $snr%",$ss);
|
||||||
|
|
||||||
|
if ($ss<$critical) {
|
||||||
|
exit(2);
|
||||||
|
} elsif ($ss<$warning) {
|
||||||
|
exit(1);
|
||||||
|
} else {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub print_usage () {
|
||||||
|
print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub print_help () {
|
||||||
|
print_revision($PROGNAME,'$Revision: 1.4 $');
|
||||||
|
print "Copyright (c) 2000 Jeffery Blank/Karl DeBisschop\n";
|
||||||
|
print "\n";
|
||||||
|
print_usage();
|
||||||
|
print "\n";
|
||||||
|
print "<warn> = Signal strength at which a warning message will be generated.\n";
|
||||||
|
print "<crit> = Signal strength at which a critical message will be generated.\n\n";
|
||||||
|
support();
|
||||||
|
}
|
BIN
checkers/negate
Executable file
BIN
checkers/negate
Executable file
Binary file not shown.
BIN
checkers/urlize
Executable file
BIN
checkers/urlize
Executable file
Binary file not shown.
83
checkers/utils.pm
Normal file
83
checkers/utils.pm
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
# Utility drawer for Nagios plugins.
|
||||||
|
# $Id: utils.pm.in,v 1.7 2003/04/13 04:25:36 sghosh Exp $
|
||||||
|
#
|
||||||
|
# $Log: utils.pm.in,v $
|
||||||
|
# Revision 1.7 2003/04/13 04:25:36 sghosh
|
||||||
|
# update for check_mailq - qmail support
|
||||||
|
#
|
||||||
|
# Revision 1.6 2003/02/03 20:29:55 sghosh
|
||||||
|
# change ntpdc to ntpq (Jonathan Rozes,Thomas Schimpke, bug-656237 )
|
||||||
|
#
|
||||||
|
# Revision 1.5 2002/10/30 05:07:29 sghosh
|
||||||
|
# monitor mailq
|
||||||
|
#
|
||||||
|
# Revision 1.4 2002/05/27 02:01:09 sghosh
|
||||||
|
# new var - smbclient
|
||||||
|
#
|
||||||
|
# Revision 1.3 2002/05/10 03:49:22 sghosh
|
||||||
|
# added programs to autoconf
|
||||||
|
#
|
||||||
|
# Revision 1.2 2002/05/08 05:10:35 sghosh
|
||||||
|
# is_hostname added, update CODES to POSIX
|
||||||
|
#
|
||||||
|
#
|
||||||
|
package utils;
|
||||||
|
|
||||||
|
require Exporter;
|
||||||
|
@ISA = qw(Exporter);
|
||||||
|
@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||||
|
|
||||||
|
#use strict;
|
||||||
|
#use vars($TIMEOUT %ERRORS);
|
||||||
|
sub print_revision ($$);
|
||||||
|
sub usage;
|
||||||
|
sub support();
|
||||||
|
sub is_hostname;
|
||||||
|
|
||||||
|
## updated by autoconf
|
||||||
|
$PATH_TO_RPCINFO = "/usr/bin/rpcinfo";
|
||||||
|
$PATH_TO_NTPDATE = "/usr/sbin/ntpdate";
|
||||||
|
$PATH_TO_NTPDC = "/usr/bin/ntpdc";
|
||||||
|
$PATH_TO_NTPQ = "/usr/bin/ntpq";
|
||||||
|
$PATH_TO_LMSTAT = "" ;
|
||||||
|
$PATH_TO_SMBCLIENT = "/usr/bin/smbclient";
|
||||||
|
$PATH_TO_MAILQ = "/usr/bin/mailq";
|
||||||
|
$PATH_TO_QMAIL_QSTAT = "";
|
||||||
|
|
||||||
|
## common variables
|
||||||
|
$TIMEOUT = 15;
|
||||||
|
%ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
|
||||||
|
|
||||||
|
## utility subroutines
|
||||||
|
sub print_revision ($$) {
|
||||||
|
my $commandName = shift;
|
||||||
|
my $pluginRevision = shift;
|
||||||
|
$pluginRevision =~ s/^\$Revision: //;
|
||||||
|
$pluginRevision =~ s/ \$\s*$//;
|
||||||
|
print "$commandName (nagios-plugins 1.4.2) $pluginRevision\n";
|
||||||
|
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub support () {
|
||||||
|
my $support='Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n';
|
||||||
|
$support =~ s/@/\@/g;
|
||||||
|
$support =~ s/\\n/\n/g;
|
||||||
|
print $support;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub usage {
|
||||||
|
my $format=shift;
|
||||||
|
printf($format,@_);
|
||||||
|
exit $ERRORS{'UNKNOWN'};
|
||||||
|
}
|
||||||
|
|
||||||
|
sub is_hostname {
|
||||||
|
my $host1 = shift;
|
||||||
|
if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/) {
|
||||||
|
return 1;
|
||||||
|
}else{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
23
checkers/utils.sh
Executable file
23
checkers/utils.sh
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
STATE_OK=0
|
||||||
|
STATE_WARNING=1
|
||||||
|
STATE_CRITICAL=2
|
||||||
|
STATE_UNKNOWN=3
|
||||||
|
STATE_DEPENDENT=4
|
||||||
|
|
||||||
|
if test -x /usr/bin/printf; then
|
||||||
|
ECHO=/usr/bin/printf
|
||||||
|
else
|
||||||
|
ECHO=echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
print_revision() {
|
||||||
|
echo "$1 (nagios-plugins 1.4.2) $2"
|
||||||
|
$ECHO "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n" | /bin/sed -e 's/\n/ /g'
|
||||||
|
}
|
||||||
|
|
||||||
|
support() {
|
||||||
|
$ECHO "Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n" | /bin/sed -e 's/\n/ /g'
|
||||||
|
}
|
||||||
|
|
78
cleanup.php
Executable file
78
cleanup.php
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
|
||||||
|
### Clean up the database removing old IPs and links
|
||||||
|
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$query = "SELECT *,A.id as id FROM ipaddr AS A, interfaces as I, devices as D
|
||||||
|
WHERE A.interface_id = I.id AND I.host = D.id AND D.status = '1' AND I.id LIKE '%$argv[1]'";
|
||||||
|
|
||||||
|
$data = mysql_query($query);
|
||||||
|
while($row = mysql_fetch_array($data)) {
|
||||||
|
|
||||||
|
$mask = trim(`$ipcalc $row[addr]/$row[cidr] | grep Netmask: | cut -d " " -f 4`);
|
||||||
|
$response = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname] ipAdEntIfIndex.$row[addr] | cut -d " " -f 2`);
|
||||||
|
$maskcheck = trim(`snmpget -v2c -Osq -c $row[community] $row[hostname] ipAdEntNetMask.$row[addr] | cut -d " " -f 2`);
|
||||||
|
if($response == $row['ifIndex'] && $mask == $maskcheck) {
|
||||||
|
} else {
|
||||||
|
mysql_query("delete from ipaddr where id = '$row[id]'");
|
||||||
|
echo("Deleted $row[addr] from $row[hostname]\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "SELECT *, I.id as id FROM interfaces AS I, devices as D
|
||||||
|
WHERE I.host = D.id AND D.status = '1'";
|
||||||
|
$data = mysql_query($query);
|
||||||
|
while($row = mysql_fetch_array($data)) {
|
||||||
|
$id = $row['id'];
|
||||||
|
$index = $row[ifIndex];
|
||||||
|
$hostname = $row['hostname'];
|
||||||
|
$community = $row['community'];
|
||||||
|
$response = trim(`snmpget -v2c -Osq -c $community $hostname ifIndex.$index | cut -d " " -f 2`);
|
||||||
|
if($response != $index) {
|
||||||
|
mysql_query("delete from interfaces where id = '$id'");
|
||||||
|
echo("Deleted $row[if] from $hostname\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces`"), 0) . " interfaces at start\n");
|
||||||
|
$interface_query = mysql_query("SELECT id,host FROM `interfaces`");
|
||||||
|
while ($interface = mysql_fetch_array($interface_query)) {
|
||||||
|
$host = $interface['host'];
|
||||||
|
$id = $interface['id'];
|
||||||
|
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `id` = '$host'"), 0) == '0') {
|
||||||
|
mysql_query("delete from interfaces where `id` = '$id'");
|
||||||
|
echo("Deleting if $id \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces`"), 0) . " interfaces at end\n");
|
||||||
|
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at start\n");
|
||||||
|
$link_query = mysql_query("SELECT id,src_if,dst_if FROM `links`");
|
||||||
|
while ($link = mysql_fetch_array($link_query)) {
|
||||||
|
$id = $link['id'];
|
||||||
|
$src = $link['src_if'];
|
||||||
|
$dst = $link['dst_if'];
|
||||||
|
if(mysql_result(mysql_query("SELECT COUNT(id) FROM `interfaces` WHERE `id` = '$src'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(id) FROM `interfaces` WHERE `id` = '$dst'"), 0) == '0') {
|
||||||
|
mysql_query("delete from links where `id` = '$id'");
|
||||||
|
echo("Deleting link $id \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(id) FROM `links`"), 0) . " links at end\n");
|
||||||
|
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(adj_id) FROM `adjacencies`"), 0) . " adjacencies at start\n");
|
||||||
|
$link_query = mysql_query("SELECT * FROM `adjacencies`");
|
||||||
|
while ($link = mysql_fetch_array($link_query)) {
|
||||||
|
$id = $link['adj_id'];
|
||||||
|
$netid = $link['network_id'];
|
||||||
|
$ifid = $link['interface_id'];
|
||||||
|
if(mysql_result(mysql_query("SELECT COUNT(id) FROM `interfaces` WHERE `id` = '$ifid'"), 0) == '0' || mysql_result(mysql_query("SELECT COUNT(id) FROM `networks` WHERE `id` = '$netid'"), 0) == '0') {
|
||||||
|
mysql_query("delete from adjacencies where `adj_id` = '$id'");
|
||||||
|
echo("Deleting link $id \n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo(mysql_result(mysql_query("SELECT COUNT(adj_id) FROM `adjacencies`"), 0) . " adjacencies at end\n");
|
||||||
|
|
||||||
|
?>
|
83
config.php.default
Executable file
83
config.php.default
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
### Database config
|
||||||
|
$db_host = "localhost";
|
||||||
|
$db_user = "observer";
|
||||||
|
$db_pass = "";
|
||||||
|
$db_name = "observer";
|
||||||
|
|
||||||
|
### Installation Location
|
||||||
|
$installdir = "/var/sites/network.vostron.net/";
|
||||||
|
|
||||||
|
### Default community
|
||||||
|
$community = "public";
|
||||||
|
|
||||||
|
### File containing syslog
|
||||||
|
$syslogfile = "";
|
||||||
|
|
||||||
|
### Location of executables
|
||||||
|
$rrdtool = "/usr/bin/rrdtool";
|
||||||
|
$fping = "/usr/sbin/fping";
|
||||||
|
$ipcalc = "/usr/bin/ipcalc";
|
||||||
|
|
||||||
|
$snmpwalk = "/usr/bin/snmpwalk";
|
||||||
|
$snmpget = "/usr/bin/snmpget";
|
||||||
|
|
||||||
|
|
||||||
|
### List of networks to allow scanning-based discovery
|
||||||
|
$nets = array ("172.22.0.0/16", "10.0.0.0/8");
|
||||||
|
|
||||||
|
$mydomain = "project-observer.net";
|
||||||
|
|
||||||
|
$page_title = "Project Observer Network Monitoring";
|
||||||
|
$title_image = "/images/logo.gif";
|
||||||
|
|
||||||
|
### Which special sections should we show?
|
||||||
|
$show_if_customers = 0;
|
||||||
|
$show_if_transit = 0;
|
||||||
|
$show_if_peering = 0;
|
||||||
|
$show_locations = 1;
|
||||||
|
|
||||||
|
### Interface name strings to ignore
|
||||||
|
$bif = array("null", "virtual-", "unrouted", "eobc", "mpls", "sl0", "lp0", "faith0",
|
||||||
|
"-atm layer", "-atm subif", "-shdsl", "-adsl",
|
||||||
|
"async", "plip", "-physical", "-signalling", "control plane",
|
||||||
|
"bri", "-bearer", "ng", "bluetooth", "isatap", "ras", "qos", "miniport");
|
||||||
|
|
||||||
|
### Mountpoints to ignore
|
||||||
|
|
||||||
|
$ignore_mount = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts");
|
||||||
|
|
||||||
|
### Valis OSes
|
||||||
|
$valid_os = array("IOS", "Linux", "OpenBSD", "FreeBSD", "NetBSD", "ProCurve", "m0n0wall", "pfSense", "Snom", "Voswall", "DragonFly");
|
||||||
|
|
||||||
|
### Style Options
|
||||||
|
|
||||||
|
$list_colour_a = "#ffffff";
|
||||||
|
$list_colour_b = "#eeeeee";
|
||||||
|
|
||||||
|
$warn_colour_a = "#ffeeee";
|
||||||
|
$warn_colour_b = "#ffcccc";
|
||||||
|
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# No changes below this line #
|
||||||
|
##############################
|
||||||
|
|
||||||
|
$observer_version = "0.2.4";
|
||||||
|
|
||||||
|
### Connect to database
|
||||||
|
if (!@mysql_connect($db_host, $db_user, $db_pass)) {
|
||||||
|
echo "<h2>MySQL Error</h2>";
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
mysql_select_db($db_name);
|
||||||
|
|
||||||
|
$now = time();
|
||||||
|
$day = time() - (24 * 60 * 60);
|
||||||
|
$twoday = time() - (2 * 24 * 60 * 60);
|
||||||
|
$week = time() - (7 * 24 * 60 * 60);
|
||||||
|
$month = time() - (31 * 24 * 60 * 60);
|
||||||
|
$year = time() - (365 * 24 * 60 * 60);
|
||||||
|
|
||||||
|
?>
|
11
cron-hourly.sh
Executable file
11
cron-hourly.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
./cdp.php
|
||||||
|
./poll-reachability.php
|
||||||
|
./poll-os.php
|
||||||
|
./discover-ifs.php
|
||||||
|
./discover-nets.php
|
||||||
|
./ips.php
|
||||||
|
./discover-storage.php
|
||||||
|
./cleanup.php
|
||||||
|
./discover-temperatures.php
|
||||||
|
./discover-cisco-temp.php
|
26
cron-minute.sh
Executable file
26
cron-minute.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
./process-syslog.php
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
sleep 5
|
||||||
|
./process-syslog.php &
|
||||||
|
|
14
cron.sh
Executable file
14
cron.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
./poll-reachability.php
|
||||||
|
./poll-device.php &
|
||||||
|
./poll-interface.php &
|
||||||
|
./poll-temperatures.php &
|
||||||
|
./ips.php &
|
||||||
|
./check-services.php
|
||||||
|
./alerts.php
|
||||||
|
|
||||||
|
wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-mail_virus.rrd http://dill.vostron.net/rrd/mailgraph_virus.rrd
|
||||||
|
wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-mail.rrd http://dill.vostron.net/rrd/mailgraph.rrd
|
||||||
|
wget -O /var/sites/network.vostron.net/rrd/dill.vostron.net-courier.rrd http://dill.vostron.net/rrd/couriergraph.rrd
|
||||||
|
|
35
discover-cisco-temp.php
Executable file
35
discover-cisco-temp.php
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE `os` = 'IOS' AND `status` = '1'");
|
||||||
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
$id = $device['id'];
|
||||||
|
$hostname = $device['hostname'];
|
||||||
|
$community = $device['community'];
|
||||||
|
echo("Detecting IOS temperature sensors for $hostname\n");
|
||||||
|
$oids = `snmpwalk -v2c -Osqn -c $community $hostname .1.3.6.1.4.1.9.9.13.1.3.1.2 | sed s/.1.3.6.1.4.1.9.9.13.1.3.1.2.//g`;
|
||||||
|
$oids = trim($oids);
|
||||||
|
foreach(explode("\n", $oids) as $data) {
|
||||||
|
$data = trim($data);
|
||||||
|
list($oid) = explode(" ", $data);
|
||||||
|
$temp_oid = ".1.3.6.1.4.1.9.9.13.1.3.1.3.$oid";
|
||||||
|
$descr_oid = ".1.3.6.1.4.1.9.9.13.1.3.1.2.$oid";
|
||||||
|
$descr = `snmpget -O qv -v2c -c $community $hostname $descr_oid`;
|
||||||
|
$temp = `snmpget -O qv -v2c -c $community $hostname $temp_oid`;
|
||||||
|
if(!strstr($descr, "No") && !strstr($temp, "No") && $descr != "" ) {
|
||||||
|
$descr = `snmpget -O qv -v2c -c $community $hostname $descr_oid`;
|
||||||
|
$descr = str_replace("\"", "", $descr);
|
||||||
|
$descr = str_replace("temperature", "", $descr);
|
||||||
|
$descr = str_replace("temp", "", $descr);
|
||||||
|
$descr = trim($descr);
|
||||||
|
if(mysql_result(mysql_query("SELECT count(temp_id) FROM `temperature` WHERE temp_oid = '.1.3.6.1.4.1.9.9.13.1.3.1.3.$oid' AND temp_host = '$id'"),0) == '0') {
|
||||||
|
$query = "INSERT INTO temperature (`temp_host`, `temp_oid`, `temp_descr`) values ('$id', '$temp_oid', '$descr')";
|
||||||
|
echo("$query -> $descr : $temp\n");
|
||||||
|
mysql_query($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
45
discover-ifs.php
Executable file
45
discover-ifs.php
Executable file
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
# Discover interfaces
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT id,hostname,community,snmpver FROM `devices` WHERE `id` LIKE '%" . $argv[1] . "' AND status = '1' AND os != 'Snom' ORDER BY id DESC");
|
||||||
|
while ($device = mysql_fetch_row($device_query)) {
|
||||||
|
|
||||||
|
$id = $device['0'];
|
||||||
|
$hostname = $device['1'];
|
||||||
|
$community = $device['2'];
|
||||||
|
$snmpver = $device['3'];
|
||||||
|
$interfaces = `snmpwalk -O nsq -v2c -c $community $hostname ".1.3.6.1.2.1.2.2.1.2" | sed s/ifDescr.//g | sed s/\ \"/\|\|\"/g | sed s/\ /\|\|/g`;
|
||||||
|
$interfaces = trim($interfaces);
|
||||||
|
echo("Polling $hostname\n");
|
||||||
|
foreach(explode("\n", $interfaces) as $entry){
|
||||||
|
$entry = trim($entry);
|
||||||
|
list($ifIndex, $ifName) = explode("||", $entry);
|
||||||
|
if(!strstr($entry, "irtual")) {
|
||||||
|
$ifName = trim(str_replace("\"", "", $ifName));
|
||||||
|
$if = trim(strtolower($ifName));
|
||||||
|
$nullintf = 0;
|
||||||
|
foreach($bif as $bi) {
|
||||||
|
if (strstr($if, $bi)) {
|
||||||
|
$nullintf = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preg_match('/serial[0-9]:/', $if)) { $nullintf = '1'; }
|
||||||
|
if (preg_match('/ng[0-9]+$/', $if)) { }
|
||||||
|
if ($nullintf == 0) {
|
||||||
|
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `host` = '$id' AND `ifIndex` = '$ifIndex'"), 0) == '0') {
|
||||||
|
echo "Adding port $ifName \n";
|
||||||
|
mysql_query("INSERT INTO `interfaces` (`host`,`ifIndex`,`if`) VALUES ('$id','$ifIndex','$ifName')");
|
||||||
|
} else {
|
||||||
|
# echo("Already have $ifName \n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# echo("Invalid $ifName\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
11
discover-ifs.sh
Executable file
11
discover-ifs.sh
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
./discover-ifs.php 1 &
|
||||||
|
./discover-ifs.php 2 &
|
||||||
|
./discover-ifs.php 3 &
|
||||||
|
./discover-ifs.php 4 &
|
||||||
|
./discover-ifs.php 5 &
|
||||||
|
./discover-ifs.php 6 &
|
||||||
|
./discover-ifs.php 7 &
|
||||||
|
./discover-ifs.php 8 &
|
||||||
|
./discover-ifs.php 9 &
|
||||||
|
./discover-ifs.php 0 &
|
||||||
|
|
31
discover-storage.php
Executable file
31
discover-storage.php
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE os = 'Linux' OR os = 'FreeBSD' OR os = 'NetBSD' OR os = 'OpenBSD' OR os = 'DragonFly' AND monowall = '0' AND status = '1'");
|
||||||
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
$id = $device['id'];
|
||||||
|
$hostname = $device['hostname'];
|
||||||
|
$community = $device['community'];
|
||||||
|
echo("\n***$hostname***\n");
|
||||||
|
$oids = `snmpwalk -v2c -Osq -c $community $hostname hrStorageIndex | sed s/hrStorageIndex.//g`;
|
||||||
|
$oids = trim($oids);
|
||||||
|
foreach(explode("\n", $oids) as $data) {
|
||||||
|
$data = trim($data);
|
||||||
|
list($oid,$ifIndex) = explode(" ", $data);
|
||||||
|
$temp = `snmpget -O qv -v2c -c $community $hostname hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid`;
|
||||||
|
$temp = trim($temp);
|
||||||
|
list($descr, $units, $size, $type) = explode("\n", $temp);
|
||||||
|
list($units) = explode(" ", $units);
|
||||||
|
if(strstr($type, "FixedDisk") && $size > '0') {
|
||||||
|
echo("$oid,$descr,$units,$size\n");
|
||||||
|
if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$ifIndex' AND host_id = '$id'"),0) == '0') {
|
||||||
|
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) values ('$id', '$ifIndex', '$descr', '$size', '$units')";
|
||||||
|
echo("$query \n");
|
||||||
|
mysql_query($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
34
discover-temperatures.php
Executable file
34
discover-temperatures.php
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
|
||||||
|
### Discovery Observer-style temperature sensors
|
||||||
|
|
||||||
|
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' AND os != 'IOS' AND os != 'ProCurve'");
|
||||||
|
while ($device = mysql_fetch_array($device_query)) {
|
||||||
|
$id = $device['id'];
|
||||||
|
$hostname = $device['hostname'];
|
||||||
|
$community = $device['community'];
|
||||||
|
$snmpver = $device['snmpver'];
|
||||||
|
echo("\n***$hostname***\n");
|
||||||
|
$oids = `snmpwalk -$snmpver -Osqn -c $community $hostname .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep ".1.1 " | grep -v ".101." | cut -d"." -f 1`;
|
||||||
|
#$oids = `snmpwalk -v2c -Osqn -c $community $hostname .1.3.6.1.4.1.2021.7891 | sed s/.1.3.6.1.4.1.2021.7891.// | grep '1.1.1' | grep -v 0 | cut -d " " -f 2`;
|
||||||
|
$oids = trim($oids);
|
||||||
|
if(strstr($oids, "no")) { unset ($oids); }
|
||||||
|
foreach(explode("\n",$oids) as $oid) {
|
||||||
|
$oid = trim($oid);
|
||||||
|
if($oid != "") {
|
||||||
|
$descr = trim(str_replace("\"", "", `snmpget -v2c -Osqn -c $community $hostname .1.3.6.1.4.1.2021.7891.$oid.2.1 | sed s/.1.3.6.1.4.1.2021.7891.$oid.2.1\ //`));
|
||||||
|
$fulloid = ".1.3.6.1.4.1.2021.7891.$oid.101.1";
|
||||||
|
echo("Detected : $fulloid ($descr)\n");
|
||||||
|
if(!mysql_result(mysql_query("SELECT count(temp_id) FROM temperature WHERE `temp_host` = '$id' AND `temp_oid` = '$fulloid'"), 0)) {
|
||||||
|
mysql_query("INSERT INTO `temperature` (`temp_host`,`temp_oid`,`temp_descr`) VALUES ('$id', '$fulloid', '$descr');");
|
||||||
|
echo("Created $fulloid on $hostname\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
30
generate-iplist.php
Executable file
30
generate-iplist.php
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
`rm ips.txt && touch ips.txt`;
|
||||||
|
|
||||||
|
$handle = fopen("ips.txt", "w+");
|
||||||
|
|
||||||
|
$query = mysql_query("SELECT * FROM `networks`");
|
||||||
|
while ($data = mysql_fetch_array($query)) {
|
||||||
|
$cidr = $data['cidr'];
|
||||||
|
list ($network, $bits) = split("/", $cidr);
|
||||||
|
if($bits != '32' && $bits != '32' && $bits > '22') {
|
||||||
|
$broadcast = trim(`$ipcalc $cidr | grep Broadcast | cut -d" " -f 2`);
|
||||||
|
$ip = ip2long($network) + '1';
|
||||||
|
$end = ip2long($broadcast);
|
||||||
|
while($ip < $end) {
|
||||||
|
$ipdotted = long2ip($ip);
|
||||||
|
if(mysql_result(mysql_query("SELECT count(id) FROM ipaddr WHERE addr = '$ipdotted'"),0) == '0' && match_network($nets, $ipdotted)) {
|
||||||
|
fputs($handle, $ipdotted . "\n");
|
||||||
|
}
|
||||||
|
$ip++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
`fping -t 100 -f ips.txt > ips-scanned.txt`;
|
||||||
|
|
||||||
|
?>
|
3
generate-map.sh
Executable file
3
generate-map.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
./map.php > map.dot && unflatten -l4 -f map.dot | dot -Tpng -o html/network-big.png && convert -resize 400x300 html/network-big.png html/network.png
|
||||||
|
|
43
get-apache.sh
Executable file
43
get-apache.sh
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
# depends on availability of status and extended status info from your
|
||||||
|
# Apache webserver -- your httpd.conf needs to include something like the
|
||||||
|
# following: (uncommented)
|
||||||
|
#<Location /server-status>
|
||||||
|
# SetHandler server-status
|
||||||
|
# Order allow,deny
|
||||||
|
# Allow from localhost
|
||||||
|
#</Location>
|
||||||
|
#ExtendedStatus On
|
||||||
|
|
||||||
|
# can return hits or bytes (counters)
|
||||||
|
|
||||||
|
@res = `/usr/bin/lynx -dump http://$ARGV[0]:80/server-status`;
|
||||||
|
|
||||||
|
foreach $res (@res) {
|
||||||
|
if ($res =~ /Server uptime: (.*)$/) { $up = $1; last } else { next }
|
||||||
|
if ($res =~ /Server at/) { $server = $res; last } else { next }
|
||||||
|
}
|
||||||
|
|
||||||
|
@res = `/usr/bin/lynx -dump http://$ARGV[0]:80/server-status?auto`;
|
||||||
|
|
||||||
|
foreach $res (@res) {
|
||||||
|
if ($res =~ /Total Accesses: (\d+)/) { $d1 = $1; next }
|
||||||
|
if ($res =~ /Total kBytes: (\d+)/) { $d2 = $1 * 1024; next }
|
||||||
|
}
|
||||||
|
|
||||||
|
$d1 = int($d1);
|
||||||
|
$d2 = int($d2);
|
||||||
|
|
||||||
|
#if ($ARGV[1] eq "hits") {
|
||||||
|
print "$d1\n";
|
||||||
|
# print "$d1\n";
|
||||||
|
#} elsif ($ARGV[1] eq "bytes") {
|
||||||
|
print "$d2\n";
|
||||||
|
# print "$d2\n";
|
||||||
|
#}
|
||||||
|
|
||||||
|
print "$up\n";
|
||||||
|
print "$server";
|
||||||
|
|
||||||
|
|
22
host-add.php
Executable file
22
host-add.php
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php"); include("includes/functions.php");
|
||||||
|
|
||||||
|
if($argv[1] && $argv[2] && $argv[3]) {
|
||||||
|
$host = strtolower($argv[1]);
|
||||||
|
$community = $argv[2];
|
||||||
|
$snmpver = strtolower($argv[3]);
|
||||||
|
list($hostshort) = explode(".", $host);
|
||||||
|
if ( isDomainResolves($argv[1])){
|
||||||
|
if ( isPingable($argv[1])) {
|
||||||
|
if ( mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `hostname` = '$host'"), 0) == '0' ) {
|
||||||
|
$snmphost = trim(`snmpget -Oqv -$snmpver -c $community $host sysName.0 | sed s/\"//g`);
|
||||||
|
if ($snmphost == $host || $hostshort = $host) {
|
||||||
|
createHost ($host, $community, $snmpver);
|
||||||
|
} else { echo("Given hostname does not match SNMP-read hostname!\n"); }
|
||||||
|
} else { echo("Already got host $host\n"); }
|
||||||
|
} else { echo("Could not ping $host\n"); }
|
||||||
|
} else { echo("Could not resolve $host\n"); }
|
||||||
|
} else { echo("Usage: ./host-add.php <hostname> <community> <snmpversion>"); }
|
||||||
|
|
||||||
|
?>
|
20
host-del.php
Executable file
20
host-del.php
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
include("config.php");
|
||||||
|
include("includes/functions.php");
|
||||||
|
|
||||||
|
# Remove a host and all related data from the system
|
||||||
|
|
||||||
|
if($argv[1]) {
|
||||||
|
$host = strtolower($argv[1]);
|
||||||
|
$id = getidbyname($host);
|
||||||
|
mysql_query("DELETE FROM `devices` WHERE `id` = '$id'");
|
||||||
|
mysql_query("DELETE FROM `interfaces` WHERE `host` = '$id'");
|
||||||
|
`rm -f rrd/$host-*.rrd`;
|
||||||
|
`./cleanup.php`;
|
||||||
|
echo("Removed $host");
|
||||||
|
} else {
|
||||||
|
echo("Need host to remove!\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
11
html/.htaccess
Normal file
11
html/.htaccess
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Options FollowSymlinks Multiviews
|
||||||
|
|
||||||
|
RewriteBase /
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteCond %{REQUEST_URI} !^(.*)\.php$
|
||||||
|
RewriteCond %{REQUEST_URI} !^(.*)\.css$
|
||||||
|
RewriteCond %{REQUEST_URI} !^(.*)\.jpg$
|
||||||
|
RewriteCond %{REQUEST_URI} !^(.*)\.gif$
|
||||||
|
RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
||||||
|
|
||||||
|
RewriteRule ^([a-z]+)$ ?page=$1
|
812
html/css/styles.css
Normal file
812
html/css/styles.css
Normal file
@@ -0,0 +1,812 @@
|
|||||||
|
img { border: 0; }
|
||||||
|
|
||||||
|
A { text-decoration: none; }
|
||||||
|
A:link { color: #0000cc; }
|
||||||
|
A:visited { color: #0000cc; }
|
||||||
|
A:hover { color: #990099; }
|
||||||
|
A:active { color: #00000; }
|
||||||
|
|
||||||
|
A.red:visited, a.red, .red {color: #CC0000;}
|
||||||
|
A.grey:visited, A.grey, .gray {color: #36393D;}
|
||||||
|
A.black:visited, A.black, .black {color: #000000;}
|
||||||
|
A.green:visited, A.green, .green {color: #008C00;}
|
||||||
|
A.blue:visited, A.blue, .blue {color: #0000ff;}
|
||||||
|
A.orange:visited, a.orange, .orange {color: #FF7400;}
|
||||||
|
|
||||||
|
|
||||||
|
.pinkbg { background-color: #ffbbbb; }
|
||||||
|
.redbg { background-color: #ff8585; }
|
||||||
|
.bluebg { background-color: #aaaaff; }
|
||||||
|
.greenbg { background-color: #aaffaa; }
|
||||||
|
.greybg { background-color: #dddddd; }
|
||||||
|
|
||||||
|
.page-h2 {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-header {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 20px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graphhead, .sectionhead {
|
||||||
|
font-size: 15px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tablehead {
|
||||||
|
font-family: Verdana, arial, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-desc {
|
||||||
|
font-family: "Verdana", Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-desc {
|
||||||
|
font-family: "Verdana", Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 11px;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.syslog {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: normal;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header, .device-header {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-subtitle {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-header {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-head {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-device, .list-device-ignored, .list-device-down, .list-device-ignored-up {
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-head, .list-device {
|
||||||
|
color: #000cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-device-down, a.list-device-down, a.list-device-down:visited {
|
||||||
|
color: #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.list-device-ignored-up {
|
||||||
|
color: #009900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-text {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-text-3 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-1 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-date-1 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-2 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-field-1 {
|
||||||
|
font-family: verdana, font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-head-1 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-head {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 32px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-head-2, .table-head-2 {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 14px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-head-2 {
|
||||||
|
background-color: #cccccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.text-more {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body-blue {
|
||||||
|
color: #0000CC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-menu:link {
|
||||||
|
color: #dddddd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.top-menu:visited {
|
||||||
|
color: #dddddd;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.top-menu:hover {
|
||||||
|
color: #CC0000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
.top-menu:active {
|
||||||
|
color: #000000;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-box-dash-off {
|
||||||
|
border: 1px dashed #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copyright {
|
||||||
|
bottom: 0px;
|
||||||
|
margin: 10px auto;
|
||||||
|
position: relative;
|
||||||
|
background-color: #eeeeee;
|
||||||
|
text-align: center;
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: normal;
|
||||||
|
color: #000000;
|
||||||
|
width: 360px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0px; padding: 0px 0px 0px 0px;
|
||||||
|
background-color: #fff; color: #666;
|
||||||
|
font: 10pt Verdana;
|
||||||
|
line-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
<table { border-collapse: collapse; margin: 0px; }
|
||||||
|
<table tr td { border: 0px solid #ddd; vertical-align: top; }
|
||||||
|
form { margin: 0px; padding: 0px; }
|
||||||
|
hr { border: 0px; height: 1px; background-color: #ccc; color: #ccc; }
|
||||||
|
p { margin: 0px; padding: 0px; }
|
||||||
|
|
||||||
|
ul { margin: 0px 24px; padding: 0px; list-style: disc outside; }
|
||||||
|
ul ul { margin-top: 0px; padding-top: 0px; list-style: circle outside; }
|
||||||
|
ul ul ul { margin-top: 0px; padding-top: 0px; list-style: square outside; }
|
||||||
|
|
||||||
|
a { text-decoration:none; color: #00f; }
|
||||||
|
a:visited { text-decoration:none; color: #00f; }
|
||||||
|
a:hover { text-decoration:underline; color: #00f; }
|
||||||
|
a:active { color: #00f; }
|
||||||
|
|
||||||
|
.vspace { margin-top: 4px; margin-bottom: 4px; }
|
||||||
|
p.vspace { padding-top: 3px; padding-bottom: 3px; }
|
||||||
|
.content-mat { padding: 0px; margin: auto; background: none; }
|
||||||
|
|
||||||
|
.clearer { clear: both; display: block; padding: 0px; height: 0px; line-height: 1px; font-size: 0px; }
|
||||||
|
|
||||||
|
.borderless-table tr td { border: none }
|
||||||
|
|
||||||
|
#header { width: 100%; margin: 0px 0px 0px 0px; background-color: #fff; }
|
||||||
|
#header #page-title { color: #555; font: 18pt Arial; font-weight: bold; }
|
||||||
|
#header #page-subtitle { color: #555; font: 12pt Arial; font-weight: bold; }
|
||||||
|
#header a { color: #eeeeee; }
|
||||||
|
|
||||||
|
#main h1 { font-size: 12pt; margin: 0px; padding: 0px; }
|
||||||
|
#main h2 { font-size: 11pt; margin: 0px; padding: 0px; }
|
||||||
|
#main h3 { font-size: 10pt; margin: 0px; padding: 0px; }
|
||||||
|
#main h4 { font-size: 9pt; margin: 0px; padding: 0px; }
|
||||||
|
|
||||||
|
#content { margin: 0px; text-align: left; padding: 0px; }
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
width: 100%; height: 40px;
|
||||||
|
border: 1px none #ccc;
|
||||||
|
margin: 0px 0px 0px 0px; padding: 0px 0px 8px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#copyright { margin: 0px 12px 0px 11px; padding: 2px 0px; border-top: 1px solid #ddd; font-size: 8pt; }
|
||||||
|
|
||||||
|
#topnav {
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 11px; font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#topnav ul { margin: 5px 0px 0px 0px; padding: 0px; }
|
||||||
|
#topnav ul li { list-style: none; display: text-indent: 0px; display: inline; padding-right: 10px;}
|
||||||
|
#topnav a { color: #000; text-decoration: none;}
|
||||||
|
#topnav a:hover { color: #a00;}
|
||||||
|
|
||||||
|
#menubar {
|
||||||
|
margin: 0px 0px 0px 0px;
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
border-bottom: 1px solid #a8a8a8;
|
||||||
|
border-top: 1px solid #a8a8a8;
|
||||||
|
background-color: #e8e8e8;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 10px; font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#text { width: 1100px; }
|
||||||
|
|
||||||
|
#menubar ul { margin: 0px 10px; padding: 0px; }
|
||||||
|
#menubar ul li { list-style: none; display: inline; text-indent: 0px; text-align: left; padding-right: 15px; }
|
||||||
|
#menubar a { color: #666; }
|
||||||
|
|
||||||
|
#popupmenu a { color: #aaa; }
|
||||||
|
#popupmenu a:hover { color: #fff; }
|
||||||
|
#popupmenu li:hover { background: #444; color: #eec; }
|
||||||
|
#popupmenu li:hover ul { display: block; }
|
||||||
|
#popupmenu ul { padding: 0px; margin: 0px; list-style: none; }
|
||||||
|
#popupmenu ul li { padding: 0px 8px; float: left; position: relative; }
|
||||||
|
|
||||||
|
#popupmenu li ul {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
left: 5px;
|
||||||
|
width: 150px;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-top: 1px solid #888;
|
||||||
|
border-bottom: 1px solid #888;
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
background: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
#popupmenu li ul li {
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
#popupmenu li ul li:hover { color: #aaa; }
|
||||||
|
|
||||||
|
#toext { margin-top: 12px; margin-bottom: 12px; font-family: monospace; }
|
||||||
|
|
||||||
|
.list-large {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.graphcell, .ifcell, .devicecell, .datacell { margin: 0px 0px 7px 0px; left; padding: 7px; border: 0px; background: #e8e8e8; float: left; }
|
||||||
|
.ifcell { float: left; clear:right; background:none; }
|
||||||
|
|
||||||
|
.datacell { clear: both; }
|
||||||
|
.devicecell { margin: 2px auto; };
|
||||||
|
|
||||||
|
|
||||||
|
.sidepane { clear: left; background:none;}
|
||||||
|
.mainpane { float: none; clear: right; background:none; }
|
||||||
|
|
||||||
|
.nofloat { clear: left; }
|
||||||
|
|
||||||
|
.interface, .interface-admindown, a.interface-admindown, a.interface-admindown:visited, .interface-updown, a.interface-updown, a.interface-updown:visited, .interface-upup, a.interface-upup {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-updown, a.interface-updown, a.interface-updown:visited {
|
||||||
|
color: #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-upup, a.interface-upup {
|
||||||
|
color: #0000cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.interface-upup:hover, a.interface-updown:hover, a.interface-admindown:hover {
|
||||||
|
color: #990099;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-admindown, a.list-device-ignored, a.interface-admindown, a.interface-admindown:visited {
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
### Stuff for DNS
|
||||||
|
|
||||||
|
td {
|
||||||
|
text-decoration: none;
|
||||||
|
font-family: Verdana,Helvetica,sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
text-align: left;
|
||||||
|
margin: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
text-decoration: none;
|
||||||
|
font-family: Verdana,Helvetica,sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
color: red;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
font-family: Verdana,Helvetica,sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
input {
|
||||||
|
color: black;
|
||||||
|
text-decoration: none;
|
||||||
|
font-family: Verdana,Helvetica,sans-serif;
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
## For Mail Admin
|
||||||
|
|
||||||
|
.button {
|
||||||
|
border: 1px solid #aaaaaa;
|
||||||
|
color: #777777;
|
||||||
|
background: #dddddd;
|
||||||
|
padding: 3px 3px 3px 3px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flat {
|
||||||
|
border: 1px solid #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error_msg {
|
||||||
|
color: #d01313;
|
||||||
|
}
|
||||||
|
|
||||||
|
.standout {
|
||||||
|
color: maroon;
|
||||||
|
padding: 3px 3px 3px 3px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
background: #A10925;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu {
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
margin: 5px auto;
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li {
|
||||||
|
display: inline;
|
||||||
|
background: #efefef;
|
||||||
|
padding: 10px 5px 5px 5px;
|
||||||
|
margin-right: 3px;
|
||||||
|
border-top: 4px solid #aaaaaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li:hover {
|
||||||
|
background: #A10925;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li a {
|
||||||
|
color: #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu ul li a:hover {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#main_menu, #edit_form {
|
||||||
|
width: 850px;
|
||||||
|
margin: 0px auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#main_menu table {
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: left;
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main_menu table td {
|
||||||
|
padding-left: 30px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main_menu a {
|
||||||
|
color: #888888;
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main_menu a:hover {
|
||||||
|
color: #CD6A6A;
|
||||||
|
text-decoration: none;
|
||||||
|
padding-left: 4px;
|
||||||
|
border-bottom: 1px solid #40B33C;
|
||||||
|
border-left: 4px solid #40B33C;
|
||||||
|
}
|
||||||
|
|
||||||
|
#edit_form table {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-top: 10px;
|
||||||
|
text-align: left;
|
||||||
|
width: 100%;
|
||||||
|
border: 1px solid #efefef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#edit_form h3 {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
margin: 0;
|
||||||
|
background: #cdcdcd;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
line-height: 25px;
|
||||||
|
color: #555555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hlp_center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.help_text{
|
||||||
|
background: #efefef;
|
||||||
|
border-left: 1px solid #bbbbbb;
|
||||||
|
border-right: 1px solid #bbbbbb;
|
||||||
|
text-align: center;
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#overview, #admin_domains, #admin_virtual {
|
||||||
|
margin: auto;
|
||||||
|
background: #cdcdcd;
|
||||||
|
border: 0px solid #bbb;
|
||||||
|
padding: 0px 8px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#overview h4, #overview P, #overview FORM, #admin_virtual h4, #admin_virtual P, #admin_virtual FORM {
|
||||||
|
display: inline;
|
||||||
|
padding-right: 20px;
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav_bar {
|
||||||
|
text-align: right;
|
||||||
|
width: 750px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#alias_table, #mailbox_table, #overview_table, #log_table, #admin_table {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0px auto;
|
||||||
|
border: 1px solid #efefef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#alias_table .header, #mailbox_table .header, #overview_table .header, #log_table .header, #admin_table .header {
|
||||||
|
line-height: 20px;
|
||||||
|
background: #efefef;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#alias_table .hilightoff, #mailbox_table .hilightoff, #overview_table .hilightoff, #log_table .hilightoff, #admin_table .hilighoff {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
#alias_table .hilighton, #mailbox_table .hilighton, #overview_table .hilighton, #log_table .hilighton, #admin_table .hilighton {
|
||||||
|
background: #ffdddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
#alias_table h3, #mailbox_table h3, #overview_table h3, #log_table h3, #admin_table h3 {
|
||||||
|
background: silver;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-left: 20px;
|
||||||
|
line-height: 25px;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top{
|
||||||
|
height:17px;
|
||||||
|
padding:2px 21px 0px 21px;
|
||||||
|
background:#A20927;
|
||||||
|
font:normal 11px arial;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
#top A {
|
||||||
|
color: #aaaaaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
#center{
|
||||||
|
width:1200px;
|
||||||
|
margin:0px auto 0px auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo{
|
||||||
|
padding-left:21px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.errorbox {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
border: 2px dashed #CC0000;
|
||||||
|
background-color: #FFCCCC;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: small;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messagebox {
|
||||||
|
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||||
|
border: thin dashed #009900;
|
||||||
|
background-color: #ccffaa;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: small;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Fancy menu */
|
||||||
|
|
||||||
|
|
||||||
|
.menu2 { float:left; width:100%; font-family: Verdana, arial, sans-serif; font-weight: bold ; font-size: 11px; border:1px solid #aaaaaa;
|
||||||
|
background:#ddd url(/images/menu2.gif) repeat-x;
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
.menu2 ul {
|
||||||
|
padding:0;margin:0;list-style-type:none;
|
||||||
|
}
|
||||||
|
.menu2 ul li {
|
||||||
|
float:left; position:relative;
|
||||||
|
}
|
||||||
|
.menu2 ul li.group {display:block; text-indent:10px; background:#666; color:#cc0000; width:152px; padding:4px 0;}
|
||||||
|
|
||||||
|
.menu2 ul li a, .menu2 ul li a:visited {
|
||||||
|
float:left; display:block; text-decoration:none; color:#666; padding:0px 16px; line-height:25px; height:25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu2 ul li:hover {width:auto;}
|
||||||
|
|
||||||
|
.menu2 ul li a:hover {background:#aaa url(/images/sub2a.gif); color:#356AA0;}
|
||||||
|
|
||||||
|
.menu2 ul li:hover a {background:#aaa url(/images/sub2a.gif); color:#356AA0;}
|
||||||
|
|
||||||
|
.menu2 ul li ul {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.menu2 table {
|
||||||
|
margin:0; border-collapse:collapse; font-size:11px; position:absolute; top:0; left:0; font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* specific to non IE browsers */
|
||||||
|
.menu2 ul li:hover ul {
|
||||||
|
display:block; position:absolute;top:24px; background:#aaa; margin-top:1px; left:0; width:140px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu2 ul li:hover ul.scroller {
|
||||||
|
height:138px; width:172px; overflow:auto;}
|
||||||
|
|
||||||
|
.menu2 ul li:hover ul.endstop {
|
||||||
|
left:-90px;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li ul {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li a {
|
||||||
|
display:block; background:#aaa; color:#fff;height:auto;line-height:15px;padding:4px 10px; width:120px;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li a.drop {
|
||||||
|
background:#888;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li a:hover {
|
||||||
|
color:#ff0; background: #888;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li a:hover.drop {
|
||||||
|
background: #888; color:#ff0;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li:hover ul {
|
||||||
|
display:block; position:absolute; left:153px; top:-70px; color:#000; left:152px; height:138px; width:172px; overflow:auto; background:#888;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li:hover ul li a {background:#888;}
|
||||||
|
.menu2 ul li:hover ul li:hover ul li.group {width:152px; padding:5px 0;}
|
||||||
|
|
||||||
|
|
||||||
|
.menu2 ul li:hover ul li:hover ul.left {
|
||||||
|
left:-172px;
|
||||||
|
}
|
||||||
|
.menu2 ul li:hover ul li:hover ul li a:hover {background:#666; color:#0ff;}
|
||||||
|
|
||||||
|
/* specific to IE5.5 and IE6 browsers */
|
||||||
|
.menu2 ul li a:hover ul {
|
||||||
|
display:block;position:absolute;top:30px; t\op:29px; background:#aaa;left:0; marg\in-top:1px;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul.scroller {
|
||||||
|
height:138px; overflow:auto;}
|
||||||
|
|
||||||
|
.menu2 ul li a:hover ul.endstop {
|
||||||
|
left: -90px;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a {
|
||||||
|
display:block; color:#fff; height:1px; line-height:15px; padding:4px 16px; width:152px; w\idth:120px;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a.drop {
|
||||||
|
background:#888; padding-bottom:5px;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a ul {
|
||||||
|
visibility:hidden; position:absolute; height:0; width:0;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a:hover {
|
||||||
|
color:#ff0; background: #888;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a:hover.drop {
|
||||||
|
background: #888; color:#ff0;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a:hover ul {
|
||||||
|
visibility:visible; position:absolute; top:-69px; t\op:-70px; color:#000; left:152px; height:138px; width:172px; overflow:auto; background:#888;
|
||||||
|
}
|
||||||
|
.menu2 ul li a:hover ul li a:hover ul.left { left:-170px; }
|
||||||
|
|
||||||
|
.menu2 ul li a:hover ul li a:hover ul li a:hover {background:#666; color:#0ff;}
|
||||||
|
|
||||||
|
.left {clear:both;}
|
||||||
|
|
||||||
|
|
||||||
|
#### For fancy tabs
|
||||||
|
|
||||||
|
.shadetabs {
|
||||||
|
padding: 3px 3px;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 1px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
font-family: Verdana, arial, sans-serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 12px;
|
||||||
|
list-style-type: none;
|
||||||
|
text-align: left; /*set to left, center, or right to align the menu as desired*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li{
|
||||||
|
display: inline;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.shadetabs li a{
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 2px 7px;
|
||||||
|
margin-right: 3px;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
color: #2d2b2b;
|
||||||
|
background: white url(/images/menu2.gif) top left repeat-x;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li a:visited{
|
||||||
|
color: #2d2b2b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li a:hover{
|
||||||
|
text-decoration: none;
|
||||||
|
color: #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li.selected{
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li.selected a{ /*selected main tab style */
|
||||||
|
background-image: url(/images/shadeactive.gif);
|
||||||
|
border-bottom-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shadetabs li.selected a:hover{ /*selected main tab style */
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentstyle{
|
||||||
|
border: 1px solid #aaaaaa;
|
||||||
|
width: 1175px;
|
||||||
|
margin-bottom: 1em;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
17
html/delete.php
Normal file
17
html/delete.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
# ini_set('display_errors', 1);
|
||||||
|
# ini_set('display_startup_errors', 1);
|
||||||
|
# ini_set('log_errors', 1);
|
||||||
|
ini_set('allow_url_fopen', 0);
|
||||||
|
# ini_set('error_reporting', E_ALL);
|
||||||
|
|
||||||
|
include("../config.php");
|
||||||
|
include("../includes/functions.php");
|
||||||
|
include("includes/authenticate.inc");
|
||||||
|
$start = utime();
|
||||||
|
$id = $_GET['device']
|
||||||
|
?>
|
||||||
|
|
||||||
|
Really Delete?
|
||||||
|
<a href="javascript:;" onclick="opener.location='/?page=list&delete=<?php echo("$id"); ?>';self.close()">Yes!</a>
|
||||||
|
<a href=\"javascript:;" onclick="self.close()">No!</a>
|
158
html/graph.php
Normal file
158
html/graph.php
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
# ini_set('display_errors', 1);
|
||||||
|
# ini_set('display_startup_errors', 1);
|
||||||
|
# ini_set('log_errors', 1);
|
||||||
|
ini_set('allow_url_fopen', 0);
|
||||||
|
# ini_set('error_reporting', E_ALL);
|
||||||
|
|
||||||
|
include("../config.php");
|
||||||
|
include("../includes/functions.php");
|
||||||
|
include("includes/authenticate.inc");
|
||||||
|
|
||||||
|
if($_GET['host']) {
|
||||||
|
$hostid = $_GET['host'];
|
||||||
|
} else {
|
||||||
|
$hostid = getifhost($_GET['if']);
|
||||||
|
$ifIndex = getifindexbyid($_GET['if']);
|
||||||
|
}
|
||||||
|
$hostname = gethostbyid($hostid);
|
||||||
|
$from = $_GET['from'];
|
||||||
|
$to = $_GET['to'];
|
||||||
|
$width = $_GET['width'];
|
||||||
|
$height = $_GET['height'];
|
||||||
|
$title = $_GET['title'];
|
||||||
|
$vertical = $_GET['vertical'];
|
||||||
|
|
||||||
|
$type = $_GET['type'];
|
||||||
|
|
||||||
|
$graphfile = $hostname . ".". $ifIndex . "-" . $type . ".png";
|
||||||
|
|
||||||
|
$os = gethostosbyid($hostid);
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
|
||||||
|
case 'bits':
|
||||||
|
$graph = trafgraph ($hostname . ".". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'pkts':
|
||||||
|
$graph = pktsgraph ($hostname . ".". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'errors':
|
||||||
|
$graph = errorgraph ($hostname . ".". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'nupkts':
|
||||||
|
$graph = nucastgraph ($hostname . ".". $ifIndex . ".rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'uptime':
|
||||||
|
$graph = uptimegraph ($hostname . "-uptime.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'unixfs':
|
||||||
|
$graph = unixfsgraph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'calls':
|
||||||
|
$graph = callsgraphSNOM ($hostname . "-data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'ip_graph':
|
||||||
|
$graph = ip_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'icmp_graph':
|
||||||
|
$graph = icmp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'tcp_graph':
|
||||||
|
$graph = tcp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'udp_graph':
|
||||||
|
$graph = udp_graph ($hostname . "-netinfo.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'cpu':
|
||||||
|
if($os == "Linux" || $os == "NetBSD" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "Windows" || $os == "m0n0wall" || $os == "Voswall" || $os == "pfSense" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = cpugraphUnix ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "IOS") {
|
||||||
|
$graph = cpugraph ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Windows") {
|
||||||
|
$graph = cpugraphwin ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "ProCurve") {
|
||||||
|
$graph = cpugraphHP ($hostname . "-cpu.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Snom") {
|
||||||
|
$graph = callsgraphSNOM ($hostname . "-data.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'temp':
|
||||||
|
$graph = temp_graph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
break;
|
||||||
|
case 'mem':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
|
||||||
|
$graph = memgraphUnix ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "IOS") {
|
||||||
|
$graph = memgraph ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Windows") {
|
||||||
|
} elseif($os == "ProCurve") {
|
||||||
|
$graph = memgraphHP ($hostname . "-mem.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'load':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
|
||||||
|
$graph = loadgraphUnix ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "IOS") {
|
||||||
|
$graph = loadgraph ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Windows") {
|
||||||
|
$graph = loadgraphwin ($hostname . "-load.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'users':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
|
||||||
|
$graph = usersgraphUnix ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Windows") {
|
||||||
|
$graph = usersgraphwin ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'procs':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
|
||||||
|
$graph = procsgraphUnix ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
} elseif($os == "Windows") {
|
||||||
|
$graph = procsgraphwin ($hostname . "-sys.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'unixfs':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD" || $os == "NetBSD" ) {
|
||||||
|
$graph = unixfsgraph ($hostid, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'postfix':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = mailsgraphUnix ($hostname . "-mail.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'postfixerrors':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = mailerrorgraphUnix ($hostname, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'courier':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = couriergraphUnix ($hostname . "-courier.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'apachehits':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = apachehitsgraphUnix ($hostname . "-apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'apachebits':
|
||||||
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
|
$graph = apachebitsgraphUnix ($hostname . "-apache.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if($graph) {
|
||||||
|
echo(`cat graphs/$graphfile`);
|
||||||
|
} else {
|
||||||
|
# echo(`cat images/no-graph.png`);
|
||||||
|
}
|
||||||
|
|
||||||
|
$delete = `rm graphs/$graphfile`;
|
||||||
|
|
||||||
|
?>
|
1
html/graphs
Symbolic link
1
html/graphs
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../graphs/
|
BIN
html/images/16/Thumbs.db
Executable file
BIN
html/images/16/Thumbs.db
Executable file
Binary file not shown.
BIN
html/images/16/accept.png
Executable file
BIN
html/images/16/accept.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 781 B |
BIN
html/images/16/add.png
Executable file
BIN
html/images/16/add.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 733 B |
BIN
html/images/16/anchor.png
Executable file
BIN
html/images/16/anchor.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 523 B |
BIN
html/images/16/application.png
Executable file
BIN
html/images/16/application.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 464 B |
BIN
html/images/16/application_add.png
Executable file
BIN
html/images/16/application_add.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 619 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user