mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-06-18 21:18:56 -04:00
Compare commits
No commits in common. "master" and "release-1.4.3" have entirely different histories.
master
...
release-1.
1140 changed files with 73509 additions and 215710 deletions
|
|
@ -1,12 +0,0 @@
|
|||
UseTab: ForContinuationAndIndentation
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
BreakBeforeBraces: Attach
|
||||
AlignConsecutiveMacros: true
|
||||
ColumnLimit: 100
|
||||
IndentPPDirectives: AfterHash
|
||||
SortIncludes: Never
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
BinPackArguments: true
|
||||
InsertBraces: true
|
||||
18
.cvsignore
Normal file
18
.cvsignore
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
configure
|
||||
debian
|
||||
Makefile
|
||||
Makefile.in
|
||||
config.*
|
||||
test.pl
|
||||
command.cfg
|
||||
Cache.pm
|
||||
build-*
|
||||
intl
|
||||
ABOUT-NLS
|
||||
aclocal.m4
|
||||
autom4te*.cache
|
||||
install-sh
|
||||
mkinstalldirs
|
||||
missing
|
||||
depcomp
|
||||
THANKS
|
||||
62
.github/NPTest.cache
vendored
62
.github/NPTest.cache
vendored
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
'NP_ALLOW_SUDO' => 'yes',
|
||||
'NP_DNS_SERVER' => '8.8.8.8',
|
||||
'NP_GOOD_NTP_SERVICE' => '',
|
||||
'NP_HOST_DHCP_RESPONSIVE' => '',
|
||||
'NP_HOST_HPJD_PORT_INVALID' => '161',
|
||||
'NP_HOST_HPJD_PORT_VALID' => '',
|
||||
'NP_HOSTNAME_INVALID_CIDR' => '130.133.8.39/30',
|
||||
'NP_HOSTNAME_INVALID' => 'nosuchhost',
|
||||
'NP_HOSTNAME_VALID_CIDR' => '130.133.8.41/30',
|
||||
'NP_HOSTNAME_VALID_IP' => '130.133.8.40',
|
||||
'NP_HOSTNAME_VALID' => 'monitoring-plugins.org',
|
||||
'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.',
|
||||
'NP_HOST_NONRESPONSIVE' => '192.168.1.2',
|
||||
'NP_HOST_RESPONSIVE' => 'localhost',
|
||||
'NP_HOST_SMB' => '',
|
||||
'NP_HOST_SNMP' => '',
|
||||
'NP_HOST_TCP_FTP' => '',
|
||||
'NP_HOST_TCP_HPJD' => '',
|
||||
'NP_HOST_TCP_HTTP2' => 'test.monitoring-plugins.org',
|
||||
'NP_HOST_TCP_HTTP' => 'localhost',
|
||||
'NP_HOST_TCP_HTTP_IPV4' => '127.0.0.1',
|
||||
'NP_HOST_TCP_HTTP_IPV4_CIDR_1' => '127.0.0.0/28',
|
||||
'NP_HOST_TCP_HTTP_IPV4_CIDR_2' => '127.0.0.1/32',
|
||||
'NP_HOST_TCP_HTTP_IPV6' => '::1',
|
||||
'NP_HOST_TCP_HTTP_IPV6_CIDR_1' => '0000:0000:0000::0000:0000:0000/16',
|
||||
'NP_HOST_TCP_HTTP_IPV6_CIDR_2' => '::1234:5678/16',
|
||||
'NP_HOST_TCP_HTTP_SUBDOMAIN' => 'subdomain1.localhost',
|
||||
'NP_HOST_TCP_IMAP' => 'imap.web.de',
|
||||
'NP_HOST_TCP_JABBER' => 'jabber.org',
|
||||
'NP_HOST_TCP_LDAP' => 'localhost',
|
||||
'NP_HOST_TCP_POP' => 'pop.web.de',
|
||||
'NP_HOST_TCP_PROXY' => 'localhost',
|
||||
'NP_HOST_TCP_SMTP' => 'localhost',
|
||||
'NP_HOST_TCP_SMTP_NOSTARTTLS' => '',
|
||||
'NP_HOST_TCP_SMTP_STARTTLS' => 'localhost',
|
||||
'NP_HOST_TCP_SMTP_TLS' => 'localhost',
|
||||
'NP_HOST_TLS_CERT' => 'localhost',
|
||||
'NP_HOST_TLS_HTTP' => 'localhost',
|
||||
'NP_HOST_UDP_TIME' => 'none',
|
||||
'NP_INTERNET_ACCESS' => 'yes',
|
||||
'NP_LDAP_BASE_DN' => 'dc=nodomain',
|
||||
'NP_MOUNTPOINT2_VALID' => '/media/ramdisk1',
|
||||
'NP_MOUNTPOINT_VALID' => '/',
|
||||
'NP_MYSQL_LOGIN_DETAILS' => '-u root -d test',
|
||||
'NP_MYSQL_SERVER' => 'localhost',
|
||||
'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
|
||||
'NP_MYSQL_WITH_REPLICA' => '',
|
||||
'NP_MYSQL_WITH_REPLICA_LOGIN' => '',
|
||||
'NP_NO_NTP_SERVICE' => 'localhost',
|
||||
'NP_PORT_TCP_PROXY' => '3128',
|
||||
'NP_SMB_SHARE' => '',
|
||||
'NP_SMB_SHARE_DENY' => '',
|
||||
'NP_SMB_SHARE_SPC' => '',
|
||||
'NP_SMB_VALID_USER' => '',
|
||||
'NP_SMB_VALID_USER_PASS' => '',
|
||||
'NP_SNMP_COMMUNITY' => '',
|
||||
'NP_SNMP_USER' => '',
|
||||
'NP_SSH_CONFIGFILE' => '~/.ssh/config',
|
||||
'NP_SSH_HOST' => 'localhost',
|
||||
'NP_SSH_IDENTITY' => '~/.ssh/id_rsa'
|
||||
}
|
||||
11
.github/dependabot.yml
vendored
11
.github/dependabot.yml
vendored
|
|
@ -1,11 +0,0 @@
|
|||
---
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: "04:00"
|
||||
pull-request-branch-name:
|
||||
separator: "-"
|
||||
open-pull-requests-limit: 10
|
||||
67
.github/mock.sh
vendored
67
.github/mock.sh
vendored
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
BASE_PATH="/src"
|
||||
|
||||
ls -la ${BASE_PATH}/.github/os_detect.sh
|
||||
. ${BASE_PATH}/.github/os_detect.sh
|
||||
|
||||
SRCRPM_DIR="/tmp/result-srcrpm"
|
||||
RPM_DIR="/tmp/result-rpm"
|
||||
SPEC_DIR="${BASE_PATH}/.github/"
|
||||
SOURCE_DIR="."
|
||||
SPEC_FILE="${SPEC_DIR}monitoring-plugins.spec"
|
||||
|
||||
cd ${BASE_PATH}
|
||||
|
||||
dnf -y --setopt="tsflags=nodocs" update && \
|
||||
if [ "${distro_id}" != "fedora" ]; then
|
||||
dnf -y --setopt="tsflags=nodocs" install epel-release;
|
||||
else
|
||||
platform_id="$(echo "${platform_id}" | sed s/^f/fc/)";
|
||||
fi && \
|
||||
case ${distro_id} in
|
||||
ol)
|
||||
case ${platform_id} in
|
||||
el9)
|
||||
dnf config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/mock/mock-stable/repo/epel-9/group_mock-mock-stable-epel-9.repo
|
||||
;;
|
||||
el8)
|
||||
dnf config-manager --add-repo https://copr.fedorainfracloud.org/coprs/g/mock/mock-stable/repo/epel-8/group_mock-mock-stable-epel-8.repo
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
dnf -y --setopt="tsflags=nodocs" install mock rpm-build git-core && \
|
||||
usermod -a -G mock "$(whoami)"
|
||||
|
||||
SRC_RPM="monitoring-plugins-*-1.${platform_id}.src.rpm"
|
||||
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
git config --global --add safe.directory ${BASE_PATH}
|
||||
SHA="$(git rev-parse HEAD)"
|
||||
sed "s/^%global commit.*/%global commit ${SHA}/" ${SPEC_FILE} > ${SPEC_DIR}monitoring-plugins-git.spec
|
||||
sed -i "s/^%global fromgit.*/%global fromgit 1/" ${SPEC_DIR}monitoring-plugins-git.spec
|
||||
SPEC_FILE="${SPEC_DIR}monitoring-plugins-git.spec"
|
||||
SRC_RPM="monitoring-plugins-*git.${SHA:0:7}*.${platform_id}.src.rpm"
|
||||
fi
|
||||
|
||||
mkdir -p "${SRCRPM_DIR}" "${RPM_DIR}"
|
||||
|
||||
# Run mock below
|
||||
# No idea what happens here to be honest
|
||||
# mock seems to run more containers to build the package
|
||||
dnf -y --setopt="tsflags=nodocs" install rpmdevtools && \
|
||||
spectool -g -C ${SOURCE_DIR} ${SPEC_FILE} && \
|
||||
mock --init && \
|
||||
{ mock --no-clean --spec ${SPEC_FILE} --sources=${SOURCE_DIR} --result=${SRCRPM_DIR} --buildsrpm || \
|
||||
{ cat ${SRCRPM_DIR}/{root,build}.log; exit 1; } } && \
|
||||
{ mock --no-clean --sources=${SOURCE_DIR} --result=${RPM_DIR} --rebuild "${SRCRPM_DIR}"/${SRC_RPM} || \
|
||||
{ cat ${RPM_DIR}/{root,build}.log; exit 1; } }
|
||||
|
||||
ls -la ${SOURCE_DIR} ${SRCRPM_DIR} ${RPM_DIR}
|
||||
928
.github/monitoring-plugins.spec
vendored
928
.github/monitoring-plugins.spec
vendored
|
|
@ -1,928 +0,0 @@
|
|||
%global upstream_name monitoring-plugins
|
||||
%global version 2.3.3
|
||||
%global plugindir %{_libdir}/monitoring/plugins
|
||||
%global commit 72dd0a308130b9778828d143d1b9d9906218d6ac
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
%global fromgit 0
|
||||
|
||||
%define _unpackaged_files_terminate_build 0
|
||||
|
||||
Name: %{upstream_name}
|
||||
Version: %{version}
|
||||
Summary: Monitoring Plugins from the Monitoring Plugins Team
|
||||
|
||||
License: GPLv3
|
||||
URL: https://www.monitoring-plugins.org
|
||||
## When using checkouts from git, use the following
|
||||
%if 0%{?fromgit}
|
||||
Release: git.%{?shortcommit}.1%{?dist}
|
||||
Source0: https://github.com/monitoring-plugins/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
|
||||
%else
|
||||
Release: 1%{?dist}
|
||||
Source0: https://www.monitoring-plugins.org/download/monitoring-plugins-%{version}.tar.gz
|
||||
%endif
|
||||
Conflicts: nagios-plugins
|
||||
|
||||
|
||||
|
||||
|
||||
##### BUILD REQUIREMENTS #####
|
||||
# Needed for the git code
|
||||
%if 0%{?fromgit}
|
||||
BuildRequires: automake
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: gettext-devel
|
||||
%endif
|
||||
### General build requirements
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
BuildRequires: automake
|
||||
|
||||
### Check Plugin specific build requirements
|
||||
# check_by_ssh
|
||||
BuildRequires: openssh-clients
|
||||
|
||||
# check_curl
|
||||
BuildRequires: libcurl-devel >= 7.15.2
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: uriparser-devel >= 0.7.5
|
||||
|
||||
# check_dbi
|
||||
%if 0%{?rhel} != 9
|
||||
BuildRequires: libdbi-devel
|
||||
%endif
|
||||
|
||||
# check_dig check_dns
|
||||
BuildRequires: bind-utils
|
||||
|
||||
# check_disk_smb
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: samba-client
|
||||
%endif
|
||||
|
||||
# check_fping
|
||||
BuildRequires: fping
|
||||
|
||||
# check_game
|
||||
%if 0%{?rhel} != 8
|
||||
BuildRequires: qstat
|
||||
%endif
|
||||
|
||||
# check_hpjd
|
||||
BuildRequires: net-snmp-utils
|
||||
|
||||
# check_ldap check_ldaps
|
||||
BuildRequires: openldap-devel
|
||||
|
||||
# check_load
|
||||
BuildRequires: procps-ng
|
||||
|
||||
# check_mysql check_mysql_query
|
||||
%if 0%{?rhel} == 7
|
||||
BuildRequires: mariadb-devel
|
||||
%endif
|
||||
|
||||
# check_pgsql
|
||||
BuildRequires: postgresql-devel
|
||||
|
||||
# check_radius
|
||||
BuildRequires: radcli-devel
|
||||
|
||||
# check_snmp
|
||||
BuildRequires: net-snmp-devel
|
||||
|
||||
%description
|
||||
Common files for Monitoring Plugins
|
||||
|
||||
%files
|
||||
%{plugindir}/negate
|
||||
%{plugindir}/urlize
|
||||
%{plugindir}/utils.pm
|
||||
%{plugindir}/utils.sh
|
||||
%doc ABOUT-NLS
|
||||
%doc ACKNOWLEDGEMENTS
|
||||
%doc AUTHORS
|
||||
%doc CODING
|
||||
%doc FAQ
|
||||
%doc NEWS
|
||||
%doc README
|
||||
%doc REQUIREMENTS
|
||||
%doc SUPPORT
|
||||
%license COPYING
|
||||
|
||||
|
||||
|
||||
|
||||
##### ACTUAL BUILD #####
|
||||
%prep
|
||||
%if 0%{?fromgit}
|
||||
%autosetup -n %{upstream_name}-%{commit}
|
||||
%else
|
||||
%autosetup -n %{upstream_name}-%{version}
|
||||
%endif
|
||||
|
||||
|
||||
%build
|
||||
%if 0%{?fromgit}
|
||||
./tools/setup
|
||||
%endif
|
||||
%configure \
|
||||
--prefix=%{_prefix} \
|
||||
--libexecdir=%{plugindir} \
|
||||
--with-openssl=/usr \
|
||||
--with-ping-command="/usr/bin/ping -4 -n -U -w %d -c %d %s" \
|
||||
--with-ping6-command="/usr/bin/ping -6 -n -U -w %d -c %d %s"
|
||||
%make_build
|
||||
|
||||
%if 0%{?fromgit}
|
||||
make THANKS
|
||||
%endif
|
||||
|
||||
%install
|
||||
%make_install
|
||||
%{__make} install-root DESTDIR=%{buildroot} INSTALL="%{__install} -p"
|
||||
|
||||
|
||||
|
||||
|
||||
##### SUB PACKAGES #####
|
||||
# all
|
||||
%package all
|
||||
Summary: Monitoring Plugins - All Check Plugins
|
||||
Requires: %{name}
|
||||
Requires: %{name}-apt
|
||||
Requires: %{name}-breeze
|
||||
Requires: %{name}-by_ssh
|
||||
Requires: %{name}-cluster
|
||||
Requires: %{name}-curl
|
||||
%if 0%{?rhel} != 9
|
||||
Requires: %{name}-dbi
|
||||
%endif
|
||||
Requires: %{name}-dhcp
|
||||
Requires: %{name}-dig
|
||||
Requires: %{name}-disk
|
||||
%if 0%{?rhel} == 7
|
||||
Requires: %{name}-disk_smb
|
||||
%endif
|
||||
Requires: %{name}-dns
|
||||
Requires: %{name}-dummy
|
||||
Requires: %{name}-file_age
|
||||
Requires: %{name}-flexlm
|
||||
Requires: %{name}-fping
|
||||
%if 0%{?rhel} != 8
|
||||
Requires: %{name}-game
|
||||
%endif
|
||||
Requires: %{name}-hpjd
|
||||
Requires: %{name}-http
|
||||
Requires: %{name}-icmp
|
||||
Requires: %{name}-ide_smart
|
||||
Requires: %{name}-ifoperstatus
|
||||
Requires: %{name}-ifstatus
|
||||
Requires: %{name}-ircd
|
||||
Requires: %{name}-ldap
|
||||
Requires: %{name}-load
|
||||
Requires: %{name}-log
|
||||
Requires: %{name}-mailq
|
||||
Requires: %{name}-mrtg
|
||||
Requires: %{name}-mrtgtraf
|
||||
%if 0%{?rhel} == 7
|
||||
Requires: %{name}-mysql
|
||||
Requires: %{name}-mysql_query
|
||||
%endif
|
||||
Requires: %{name}-nagios
|
||||
Requires: %{name}-nt
|
||||
Requires: %{name}-ntp
|
||||
Requires: %{name}-ntp_peer
|
||||
Requires: %{name}-ntp_time
|
||||
Requires: %{name}-oracle
|
||||
Requires: %{name}-pgsql
|
||||
Requires: %{name}-ping
|
||||
Requires: %{name}-procs
|
||||
Requires: %{name}-radius
|
||||
Requires: %{name}-real
|
||||
Requires: %{name}-rpc
|
||||
Requires: %{name}-sensors
|
||||
Requires: %{name}-smtp
|
||||
Requires: %{name}-snmp
|
||||
Requires: %{name}-ssh
|
||||
Requires: %{name}-swap
|
||||
Requires: %{name}-tcp
|
||||
Requires: %{name}-time
|
||||
Requires: %{name}-ups
|
||||
Requires: %{name}-uptime
|
||||
Requires: %{name}-users
|
||||
Requires: %{name}-wave
|
||||
|
||||
%description all
|
||||
Meta package that requires all the check plugins of the Monitoring Plugins
|
||||
|
||||
%files all
|
||||
|
||||
|
||||
|
||||
# check_apt
|
||||
%package apt
|
||||
Summary: Monitoring Plugins - check_apt
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description apt
|
||||
Provides check_apt of the Monitoring Plugins.
|
||||
|
||||
%files apt
|
||||
%{plugindir}/check_apt
|
||||
|
||||
|
||||
|
||||
# check_breeze
|
||||
%package breeze
|
||||
Summary: Monitoring Plugins - check_breeze
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description breeze
|
||||
Provides check_breeze of the Monitoring Plugins.
|
||||
|
||||
%files breeze
|
||||
%{plugindir}/check_breeze
|
||||
|
||||
|
||||
|
||||
# check_by_ssh
|
||||
%package by_ssh
|
||||
Summary: Monitoring Plugins - check_by_ssh
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description by_ssh
|
||||
Provides check_by_ssh of the Monitoring Plugins.
|
||||
|
||||
%files by_ssh
|
||||
%{plugindir}/check_by_ssh
|
||||
|
||||
|
||||
|
||||
# check_cluster
|
||||
%package cluster
|
||||
Summary: Monitoring Plugins - check_cluster
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description cluster
|
||||
Provides check_cluster of the Monitoring Plugins.
|
||||
|
||||
%files cluster
|
||||
%{plugindir}/check_cluster
|
||||
|
||||
|
||||
|
||||
# check_curl
|
||||
%package curl
|
||||
Summary: Monitoring Plugins - check_curl
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description curl
|
||||
Provides check_curl of the Monitoring Plugins.
|
||||
|
||||
%files curl
|
||||
%{plugindir}/check_curl
|
||||
|
||||
|
||||
|
||||
# check_dbi
|
||||
%if 0%{?rhel} != 9
|
||||
%package dbi
|
||||
Summary: Monitoring Plugins - check_dbi
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description dbi
|
||||
Provides check_dbi of the Monitoring Plugins.
|
||||
|
||||
%files dbi
|
||||
%{plugindir}/check_dbi
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
# check_dhcp
|
||||
%package dhcp
|
||||
Summary: Monitoring Plugins - check_dhcp
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description dhcp
|
||||
Provides check_dhcp of the Monitoring Plugins.
|
||||
|
||||
%files dhcp
|
||||
%{plugindir}/check_dhcp
|
||||
|
||||
|
||||
|
||||
# check_dig
|
||||
%package dig
|
||||
Summary: Monitoring Plugins - check_dig
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: bind-utils
|
||||
|
||||
%description dig
|
||||
Provides check_dig of the Monitoring Plugins.
|
||||
|
||||
%files dig
|
||||
%{plugindir}/check_dig
|
||||
|
||||
|
||||
|
||||
# check_disk
|
||||
%package disk
|
||||
Summary: Monitoring Plugins - check_disk
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description disk
|
||||
Provides check_disk of the Monitoring Plugins.
|
||||
|
||||
%files disk
|
||||
%{plugindir}/check_disk
|
||||
|
||||
|
||||
|
||||
# check_disk_smb
|
||||
%if 0%{?rhel} == 7
|
||||
%package disk_smb
|
||||
Summary: Monitoring Plugins - check_disk_smb
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: samba-client
|
||||
|
||||
%description disk_smb
|
||||
Provides check_disk_smb of the Monitoring Plugins.
|
||||
|
||||
%files disk_smb
|
||||
%{plugindir}/check_disk_smb
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
# check_dns
|
||||
%package dns
|
||||
Summary: Monitoring Plugins - check_dns
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: bind-utils
|
||||
|
||||
%description dns
|
||||
Provides check_dns of the Monitoring Plugins.
|
||||
|
||||
%files dns
|
||||
%{plugindir}/check_dns
|
||||
|
||||
|
||||
|
||||
# check_dummy
|
||||
%package dummy
|
||||
Summary: Monitoring Plugins - check_dummy
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description dummy
|
||||
Provides check_dummy of the Monitoring Plugins.
|
||||
|
||||
%files dummy
|
||||
%{plugindir}/check_dummy
|
||||
|
||||
|
||||
|
||||
# check_file_age
|
||||
%package file_age
|
||||
Summary: Monitoring Plugins - check_file_age
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description file_age
|
||||
Provides check_file_age of the Monitoring Plugins.
|
||||
|
||||
%files file_age
|
||||
%{plugindir}/check_file_age
|
||||
|
||||
|
||||
|
||||
# check_flexlm
|
||||
%package flexlm
|
||||
Summary: Monitoring Plugins - check_flexlm
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description flexlm
|
||||
Provides check_flexlm of the Monitoring Plugins.
|
||||
|
||||
%files flexlm
|
||||
%{plugindir}/check_flexlm
|
||||
|
||||
|
||||
|
||||
# check_fping
|
||||
%package fping
|
||||
Summary: Monitoring Plugins - check_fping
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: fping
|
||||
|
||||
%description fping
|
||||
Provides check_fping of the Monitoring Plugins.
|
||||
|
||||
%files fping
|
||||
%{plugindir}/check_fping
|
||||
|
||||
|
||||
|
||||
# check_game
|
||||
%if 0%{?rhel} != 8
|
||||
%package game
|
||||
Summary: Monitoring Plugins - check_fping
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: qstat
|
||||
|
||||
%description game
|
||||
Provides check_game of the Monitoring Plugins.
|
||||
|
||||
%files game
|
||||
%{plugindir}/check_game
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
# check_hpjd
|
||||
%package hpjd
|
||||
Summary: Monitoring Plugins - check_hpjd
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description hpjd
|
||||
Provides check_hpjd of the Monitoring Plugins.
|
||||
|
||||
%files hpjd
|
||||
%{plugindir}/check_hpjd
|
||||
|
||||
|
||||
|
||||
# check_http
|
||||
%package http
|
||||
Summary: Monitoring Plugins - check_http
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description http
|
||||
Provides check_http of the Monitoring Plugins.
|
||||
|
||||
%files http
|
||||
%{plugindir}/check_http
|
||||
|
||||
|
||||
|
||||
# check_icmp
|
||||
%package icmp
|
||||
Summary: Monitoring Plugins - check_icmp
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description icmp
|
||||
Provides check_icmp of the Monitoring Plugins.
|
||||
|
||||
%files icmp
|
||||
%{plugindir}/check_icmp
|
||||
|
||||
|
||||
|
||||
# check_ide_smart
|
||||
%package ide_smart
|
||||
Summary: Monitoring Plugins - check_ide_smart
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ide_smart
|
||||
Provides check_ide_smart of the Monitoring Plugins.
|
||||
|
||||
%files ide_smart
|
||||
%{plugindir}/check_ide_smart
|
||||
|
||||
|
||||
|
||||
# check_ifoperstatus
|
||||
%package ifoperstatus
|
||||
Summary: Monitoring Plugins - check_ifoperstatus
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: perl(Net::SNMP)
|
||||
|
||||
%description ifoperstatus
|
||||
Provides check_ifoperstatus of the Monitoring Plugins.
|
||||
|
||||
%files ifoperstatus
|
||||
%{plugindir}/check_ifoperstatus
|
||||
|
||||
|
||||
|
||||
# check_ifstatus
|
||||
%package ifstatus
|
||||
Summary: Monitoring Plugins - check_ifstatus
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ifstatus
|
||||
Provides check_ifstatus of the Monitoring Plugins.
|
||||
|
||||
%files ifstatus
|
||||
%{plugindir}/check_ifstatus
|
||||
|
||||
|
||||
|
||||
# check_ircd
|
||||
%package ircd
|
||||
Summary: Monitoring Plugins - check_ircd
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ircd
|
||||
Provides check_ircd of the Monitoring Plugins.
|
||||
|
||||
%files ircd
|
||||
%{plugindir}/check_ircd
|
||||
|
||||
|
||||
|
||||
# check_ldap
|
||||
%package ldap
|
||||
Summary: Monitoring Plugins - check_ldap
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ldap
|
||||
Provides check_ldap of the Monitoring Plugins.
|
||||
|
||||
%files ldap
|
||||
%{plugindir}/check_ldap
|
||||
%{plugindir}/check_ldaps
|
||||
|
||||
|
||||
|
||||
# check_load
|
||||
%package load
|
||||
Summary: Monitoring Plugins - check_load
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: procps-ng
|
||||
|
||||
%description load
|
||||
Provides check_load of the Monitoring Plugins.
|
||||
|
||||
%files load
|
||||
%{plugindir}/check_load
|
||||
|
||||
|
||||
|
||||
# check_log
|
||||
%package log
|
||||
Summary: Monitoring Plugins - check_log
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description log
|
||||
Provides check_log of the Monitoring Plugins.
|
||||
|
||||
%files log
|
||||
%{plugindir}/check_log
|
||||
|
||||
|
||||
|
||||
# check_mailq
|
||||
%package mailq
|
||||
Summary: Monitoring Plugins - check_mailq
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description mailq
|
||||
Provides check_mailq of the Monitoring Plugins.
|
||||
|
||||
%files mailq
|
||||
%{plugindir}/check_mailq
|
||||
|
||||
|
||||
|
||||
# check_mrtg
|
||||
%package mrtg
|
||||
Summary: Monitoring Plugins - check_mrtg
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description mrtg
|
||||
Provides check_mrtg of the Monitoring Plugins.
|
||||
|
||||
%files mrtg
|
||||
%{plugindir}/check_mrtg
|
||||
|
||||
|
||||
|
||||
# check_mrtgtraf
|
||||
%package mrtgtraf
|
||||
Summary: Monitoring Plugins - check_mrtgtraf
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description mrtgtraf
|
||||
Provides check_mrtgtraf of the Monitoring Plugins.
|
||||
|
||||
%files mrtgtraf
|
||||
%{plugindir}/check_mrtgtraf
|
||||
|
||||
|
||||
|
||||
%if 0%{?rhel} == 7
|
||||
# check_mysql
|
||||
%package mysql
|
||||
Summary: Monitoring Plugins - check_mysql
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description mysql
|
||||
Provides check_mysql of the Monitoring Plugins.
|
||||
|
||||
%files mysql
|
||||
%{plugindir}/check_mysql
|
||||
|
||||
|
||||
|
||||
# check_mysql_query
|
||||
%package mysql_query
|
||||
Summary: Monitoring Plugins - check_mysql_query
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description mysql_query
|
||||
Provides check_mysql_query of the Monitoring Plugins.
|
||||
|
||||
%files mysql_query
|
||||
%{plugindir}/check_mysql_query
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
# check_nagios
|
||||
%package nagios
|
||||
Summary: Monitoring Plugins - check_nagios
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description nagios
|
||||
Provides check_nagios of the Monitoring Plugins.
|
||||
|
||||
%files nagios
|
||||
%{plugindir}/check_nagios
|
||||
|
||||
|
||||
|
||||
# check_ntp_peer
|
||||
%package ntp_peer
|
||||
Summary: Monitoring Plugins - check_ntp_peer
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ntp_peer
|
||||
Provides check_ntp_peer of the Monitoring Plugins.
|
||||
|
||||
%files ntp_peer
|
||||
%{plugindir}/check_ntp_peer
|
||||
|
||||
|
||||
|
||||
# check_ntp_time
|
||||
%package ntp_time
|
||||
Summary: Monitoring Plugins - check_ntp_time
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ntp_time
|
||||
Provides check_ntp_time of the Monitoring Plugins.
|
||||
|
||||
%files ntp_time
|
||||
%{plugindir}/check_ntp_time
|
||||
|
||||
|
||||
|
||||
# check_oracle
|
||||
%package oracle
|
||||
Summary: Monitoring Plugins - check_oracle
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description oracle
|
||||
Provides check_oracle of the Monitoring Plugins.
|
||||
|
||||
%files oracle
|
||||
%{plugindir}/check_oracle
|
||||
|
||||
|
||||
|
||||
# check_pgsql
|
||||
%package pgsql
|
||||
Summary: Monitoring Plugins - check_pgsql
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description pgsql
|
||||
Provides check_pgsql of the Monitoring Plugins.
|
||||
|
||||
%files pgsql
|
||||
%{plugindir}/check_pgsql
|
||||
|
||||
|
||||
|
||||
# check_ping
|
||||
%package ping
|
||||
Summary: Monitoring Plugins - check_ping
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ping
|
||||
Provides check_ping of the Monitoring Plugins.
|
||||
|
||||
%files ping
|
||||
%{plugindir}/check_ping
|
||||
|
||||
|
||||
|
||||
# check_procs
|
||||
%package procs
|
||||
Summary: Monitoring Plugins - check_procs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description procs
|
||||
Provides check_procs of the Monitoring Plugins.
|
||||
|
||||
%files procs
|
||||
%{plugindir}/check_procs
|
||||
|
||||
|
||||
|
||||
# check_radius
|
||||
%package radius
|
||||
Summary: Monitoring Plugins - check_radius
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description radius
|
||||
Provides check_radius of the Monitoring Plugins.
|
||||
|
||||
%files radius
|
||||
%{plugindir}/check_radius
|
||||
|
||||
|
||||
|
||||
# check_real
|
||||
%package real
|
||||
Summary: Monitoring Plugins - check_real
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description real
|
||||
Provides check_real of the Monitoring Plugins.
|
||||
|
||||
%files real
|
||||
%{plugindir}/check_real
|
||||
|
||||
|
||||
|
||||
# check_rpc
|
||||
%package rpc
|
||||
Summary: Monitoring Plugins - check_rpc
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description rpc
|
||||
Provides check_rpc of the Monitoring Plugins.
|
||||
|
||||
%files rpc
|
||||
%{plugindir}/check_rpc
|
||||
|
||||
|
||||
|
||||
# check_sensors
|
||||
%package sensors
|
||||
Summary: Monitoring Plugins - check_sensors
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: lm_sensors
|
||||
|
||||
%description sensors
|
||||
Provides check_sensors of the Monitoring Plugins.
|
||||
|
||||
%files sensors
|
||||
%{plugindir}/check_sensors
|
||||
|
||||
|
||||
|
||||
# check_smtp
|
||||
%package smtp
|
||||
Summary: Monitoring Plugins - check_smtp
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description smtp
|
||||
Provides check_smtp of the Monitoring Plugins.
|
||||
|
||||
%files smtp
|
||||
%{plugindir}/check_smtp
|
||||
|
||||
|
||||
|
||||
# check_snmp
|
||||
%package snmp
|
||||
Summary: Monitoring Plugins - check_snmp
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: net-snmp
|
||||
|
||||
%description snmp
|
||||
Provides check_snmp of the Monitoring Plugins.
|
||||
|
||||
%files snmp
|
||||
%{plugindir}/check_snmp
|
||||
|
||||
|
||||
|
||||
# check_ssh
|
||||
%package ssh
|
||||
Summary: Monitoring Plugins - check_ssh
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ssh
|
||||
Provides check_ssh of the Monitoring Plugins.
|
||||
|
||||
%files ssh
|
||||
%{plugindir}/check_ssh
|
||||
|
||||
|
||||
|
||||
# check_swap
|
||||
%package swap
|
||||
Summary: Monitoring Plugins - check_swap
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description swap
|
||||
Provides check_swap of the Monitoring Plugins.
|
||||
|
||||
%files swap
|
||||
%{plugindir}/check_swap
|
||||
|
||||
|
||||
|
||||
# check_tcp
|
||||
%package tcp
|
||||
Summary: Monitoring Plugins - check_tcp
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description tcp
|
||||
Provides check_tcp of the Monitoring Plugins.
|
||||
|
||||
%files tcp
|
||||
%{plugindir}/check_clamd
|
||||
%{plugindir}/check_ftp
|
||||
%{plugindir}/check_imap
|
||||
%{plugindir}/check_jabber
|
||||
%{plugindir}/check_nntp
|
||||
%{plugindir}/check_nntps
|
||||
%{plugindir}/check_pop
|
||||
%{plugindir}/check_simap
|
||||
%{plugindir}/check_spop
|
||||
%{plugindir}/check_ssmtp
|
||||
%{plugindir}/check_tcp
|
||||
%{plugindir}/check_udp
|
||||
|
||||
|
||||
|
||||
# check_time
|
||||
%package time
|
||||
Summary: Monitoring Plugins - check_time
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description time
|
||||
Provides check_time of the Monitoring Plugins.
|
||||
|
||||
%files time
|
||||
%{plugindir}/check_time
|
||||
|
||||
|
||||
|
||||
# check_ups
|
||||
%package ups
|
||||
Summary: Monitoring Plugins - check_ups
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description ups
|
||||
Provides check_ups of the Monitoring Plugins.
|
||||
|
||||
%files ups
|
||||
%{plugindir}/check_ups
|
||||
|
||||
|
||||
|
||||
# check_uptime
|
||||
%package uptime
|
||||
Summary: Monitoring Plugins - check_uptime
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description uptime
|
||||
Provides check_uptime of the Monitoring Plugins.
|
||||
|
||||
%files uptime
|
||||
%{plugindir}/check_uptime
|
||||
|
||||
|
||||
|
||||
# check_users
|
||||
%package users
|
||||
Summary: Monitoring Plugins - check_users
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description users
|
||||
Provides check_users of the Monitoring Plugins.
|
||||
|
||||
%files users
|
||||
%{plugindir}/check_users
|
||||
|
||||
|
||||
|
||||
# check_wave
|
||||
%package wave
|
||||
Summary: Monitoring Plugins - check_wave
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description wave
|
||||
Provides check_wave of the Monitoring Plugins.
|
||||
|
||||
%files wave
|
||||
%{plugindir}/check_wave
|
||||
|
||||
%changelog
|
||||
* Wed Oct 20 2011 John Doe <jdoe@example.com> 0.8.18.1-0.1
|
||||
- Initial RPM release
|
||||
28
.github/os_detect.sh
vendored
28
.github/os_detect.sh
vendored
|
|
@ -1,28 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
# workaround for really bare-bones Archlinux containers:
|
||||
if [ -x "$(command -v pacman)" ]; then
|
||||
pacman --noconfirm -Sy
|
||||
pacman --noconfirm -S grep gawk sed
|
||||
fi
|
||||
|
||||
if [ ${ID} == "fedora" -a ${VERSION_ID} -gt 41 ]; then
|
||||
dnf install -y gawk
|
||||
fi
|
||||
|
||||
os_release_file=
|
||||
if [ -s "/etc/os-release" ]; then
|
||||
os_release_file="/etc/os-release"
|
||||
elif [ -s "/usr/lib/os-release" ]; then
|
||||
os_release_file="/usr/lib/os-release"
|
||||
else
|
||||
echo >&2 "Cannot find an os-release file ..."
|
||||
return 1
|
||||
fi
|
||||
export distro_id=$(grep '^ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g')
|
||||
export version_id=$(grep '^VERSION_ID=' $os_release_file|awk -F = '{print $2}'|sed 's/\"//g')
|
||||
export platform_id=$(grep '^PLATFORM_ID=' /etc/os-release|awk -F = '{print $2}'|sed 's/\"//g'| cut -d":" -f2)
|
||||
# Fedora dropped PLATFORM_ID: https://fedoraproject.org/wiki/Changes/Drop_PLATFORM_ID?#Drop_PLATFORM_ID
|
||||
if [ -z $platform_id ]; then export platform_id=$(echo ${distro_id:0:1}${version_id}); fi
|
||||
149
.github/prepare_debian.sh
vendored
149
.github/prepare_debian.sh
vendored
|
|
@ -1,149 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -euo pipefail
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
source /etc/os-release
|
||||
|
||||
if [ ${ID} = "debian" ]; then
|
||||
if [ -f /etc/apt/sources.list.d/debian.sources ]; then
|
||||
sed "s/main/non-free contrib/g" /etc/apt/sources.list.d/debian.sources > /etc/apt/sources.list.d/debian-nonfree.sources
|
||||
else
|
||||
apt-get update
|
||||
apt-get -y install software-properties-common
|
||||
apt-add-repository non-free
|
||||
fi
|
||||
fi
|
||||
apt-get update
|
||||
apt-get -y install perl \
|
||||
autotools-dev \
|
||||
libdbi-dev \
|
||||
libldap2-dev \
|
||||
libpq-dev \
|
||||
libradcli-dev \
|
||||
libnet-snmp-perl \
|
||||
libsnmp-dev \
|
||||
procps \
|
||||
libdbi0-dev \
|
||||
libdbd-sqlite3 \
|
||||
libssl-dev \
|
||||
dnsutils \
|
||||
snmp-mibs-downloader \
|
||||
libsnmp-perl \
|
||||
snmpd \
|
||||
fping \
|
||||
snmp \
|
||||
netcat-openbsd \
|
||||
smbclient \
|
||||
vsftpd \
|
||||
apache2 \
|
||||
ssl-cert \
|
||||
postfix \
|
||||
libhttp-daemon-ssl-perl \
|
||||
libdbd-sybase-perl \
|
||||
libnet-dns-perl \
|
||||
slapd \
|
||||
ldap-utils \
|
||||
gcc \
|
||||
make \
|
||||
autoconf \
|
||||
automake \
|
||||
gettext \
|
||||
faketime \
|
||||
libmonitoring-plugin-perl \
|
||||
libcurl4-openssl-dev \
|
||||
liburiparser-dev \
|
||||
squid \
|
||||
openssh-server \
|
||||
mariadb-server \
|
||||
mariadb-client \
|
||||
libmariadb-dev \
|
||||
libmariadb-dev-compat \
|
||||
cron \
|
||||
iputils-ping \
|
||||
iproute2 \
|
||||
libjson-perl
|
||||
|
||||
# remove ipv6 interface from hosts
|
||||
# sed '/^::1/d' /etc/hosts > /tmp/hosts
|
||||
# cp -f /tmp/hosts /etc/hosts
|
||||
# ip addr show
|
||||
# cat /etc/hosts
|
||||
|
||||
# apache
|
||||
a2enmod ssl
|
||||
a2ensite default-ssl
|
||||
# replace snakeoil certs with openssl generated ones as the make-ssl-cert ones
|
||||
# seems to cause problems with our plugins
|
||||
rm /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
rm /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
openssl req -nodes -newkey rsa:2048 -x509 -sha256 -days 365 -nodes -keyout /etc/ssl/private/ssl-cert-snakeoil.key -out /etc/ssl/certs/ssl-cert-snakeoil.pem -subj "/C=GB/ST=London/L=London/O=Global Security/OU=IT Department/CN=$(hostname)"
|
||||
# add a subdomain for testing
|
||||
cp tools/subdomain1/subdomain1.conf /etc/apache2/sites-available/
|
||||
mkdir -p /var/www/subdomain1
|
||||
cp tools/subdomain1/index.php /var/www/subdomain1/
|
||||
echo '127.0.0.1 subdomain1.localhost' >> /etc/hosts
|
||||
echo '127.0.0.1 subdomain1.localhost.com' >> /etc/hosts
|
||||
apache2ctl configtest
|
||||
a2ensite subdomain1.conf
|
||||
|
||||
# Make it listen to both IPv4 on IPv6 on localhost
|
||||
sed -i 's/^Listen 80/Listen 0.0.0.0:80\nListen [::1]:80/' /etc/apache2/ports.conf
|
||||
sed -i 's/^[[:space:]]*Listen 443/Listen 0.0.0.0:443\nListen [::1]:443/' /etc/apache2/ports.conf
|
||||
|
||||
service apache2 restart
|
||||
|
||||
# squid
|
||||
cp tools/squid.conf /etc/squid/squid.conf
|
||||
service squid start
|
||||
|
||||
# mariadb
|
||||
service mariadb start || service mysql start
|
||||
mysql -e "create database IF NOT EXISTS test;" -uroot
|
||||
|
||||
# ldap
|
||||
sed -e 's/cn=admin,dc=nodomain/'$(/usr/sbin/slapcat|grep ^dn:|awk '{print $2}')'/' -i .github/NPTest.cache
|
||||
service slapd start
|
||||
|
||||
# sshd
|
||||
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
|
||||
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
|
||||
service ssh start
|
||||
sleep 1
|
||||
ssh-keyscan localhost >> ~/.ssh/known_hosts
|
||||
touch ~/.ssh/config
|
||||
|
||||
# start one login session, required for check_users
|
||||
ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
|
||||
disown %1
|
||||
|
||||
# snmpd
|
||||
service snmpd stop
|
||||
mkdir -p /var/lib/snmp/mib_indexes
|
||||
sed -e 's/^agentaddress.*/agentaddress 127.0.0.1/' -i /etc/snmp/snmpd.conf
|
||||
service snmpd start
|
||||
|
||||
sed 's/^mibs ://' -i /etc/snmp/snmp.conf
|
||||
|
||||
# start cron, will be used by check_nagios
|
||||
cron
|
||||
|
||||
# postfix
|
||||
cat <<EOD >> /etc/postfix/master.cf
|
||||
smtps inet n - n - - smtpd
|
||||
-o smtpd_tls_wrappermode=yes
|
||||
EOD
|
||||
service postfix start
|
||||
|
||||
# start ftpd
|
||||
service vsftpd start
|
||||
|
||||
# hostname
|
||||
sed "/NP_HOST_TLS_CERT/s/.*/'NP_HOST_TLS_CERT' => '$(hostname)',/" -i /src/.github/NPTest.cache
|
||||
|
||||
# create some test files to lower inodes
|
||||
for i in $(seq 10); do
|
||||
touch /media/ramdisk2/test.$i
|
||||
done
|
||||
85
.github/workflows/codeql-analysis.yml
vendored
85
.github/workflows/codeql-analysis.yml
vendored
|
|
@ -1,85 +0,0 @@
|
|||
---
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '15 18 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ['cpp']
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -y --no-install-recommends m4 gettext automake autoconf make build-essential
|
||||
sudo apt-get install -y --no-install-recommends perl \
|
||||
autotools-dev \
|
||||
libdbi-dev \
|
||||
libldap2-dev \
|
||||
libpq-dev \
|
||||
libmysqlclient-dev \
|
||||
libradcli-dev \
|
||||
libkrb5-dev \
|
||||
libdbi0-dev \
|
||||
libdbd-sqlite3 \
|
||||
libssl-dev \
|
||||
libcurl4-openssl-dev \
|
||||
liburiparser-dev \
|
||||
libsnmp-dev
|
||||
|
||||
- name: Configure build
|
||||
run: |
|
||||
./tools/setup
|
||||
./configure --enable-libtap
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
make
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
28
.github/workflows/spellcheck.yml
vendored
28
.github/workflows/spellcheck.yml
vendored
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
name: Spellcheck
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
# Run for pushes on any branch
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
# Run for any PRs
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
codespell:
|
||||
name: codespell
|
||||
strategy:
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Codespell
|
||||
uses: codespell-project/actions-codespell@v2
|
||||
with:
|
||||
skip: "./.git,./.gitignore,./ABOUT-NLS,./gl,./tools/squid.conf,./build-aux/ltmain.sh,THANKS.in"
|
||||
ignore_words_list: allright,gord,didi,hda,nd,alis,clen,scrit,ser,fot,te,parm,isnt,consol,oneliners,esponse,slac
|
||||
check_filenames: true
|
||||
check_hidden: true
|
||||
90
.github/workflows/test-next.yml
vendored
90
.github/workflows/test-next.yml
vendored
|
|
@ -1,90 +0,0 @@
|
|||
---
|
||||
name: Tests Debian:Testing and Fedora:Rawhide
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
debug_enabled:
|
||||
type: boolean
|
||||
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
|
||||
required: false
|
||||
default: false
|
||||
push:
|
||||
branches-ignore:
|
||||
- '*'
|
||||
schedule:
|
||||
# Run every week on Monday at 9:00 AM (UTC)
|
||||
- cron: '0 9 * * 1'
|
||||
|
||||
jobs:
|
||||
full-test:
|
||||
name: Running unit and integrationt tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distro:
|
||||
- 'debian:testing'
|
||||
include:
|
||||
- distro: 'debian:testing'
|
||||
prepare: .github/prepare_debian.sh
|
||||
steps:
|
||||
- name: Git clone repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
|
||||
- name: Run the tests on ${{ matrix.distro }}
|
||||
run: |
|
||||
docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
|
||||
docker run \
|
||||
-e NPTEST_ACCEPTDEFAULT=1 \
|
||||
-e NPTEST_CACHE="/src/.github/NPTest.cache" \
|
||||
-w /src -v ${PWD}:/src \
|
||||
--tmpfs /media/ramdisk1 \
|
||||
-v /var/run/utmp:/var/run/utmp \
|
||||
--mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
|
||||
${{ matrix.distro }} \
|
||||
/bin/sh -c '${{ matrix.prepare }} && \
|
||||
tools/setup && \
|
||||
./configure --enable-libtap && \
|
||||
make && \
|
||||
make test && \
|
||||
make dist && \
|
||||
tar zxf monitoring-plugins-*.tar.gz && \
|
||||
cd monitoring-plugins-*/ && \
|
||||
./configure && \
|
||||
make'
|
||||
docker container prune -f
|
||||
docker volume prune -f
|
||||
|
||||
build-test:
|
||||
name: Running rpm build test on ${{ matrix.distro }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- {"distro": "fedora:rawhide", "build": ".github/mock.sh"}
|
||||
steps:
|
||||
- name: Git clone repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
|
||||
- name: Run the tests on ${{ matrix.distro }}
|
||||
run: |
|
||||
docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
|
||||
docker run \
|
||||
--privileged=true \
|
||||
-e NPTEST_ACCEPTDEFAULT=1 \
|
||||
-e NPTEST_CACHE="/src/.github/NPTest.cache" \
|
||||
-w /src -v ${PWD}:/src \
|
||||
--tmpfs /media/ramdisk1 \
|
||||
-v /var/run/utmp:/var/run/utmp \
|
||||
--mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
|
||||
${{ matrix.distro }} \
|
||||
/bin/sh -c '${{ matrix.build }} && \
|
||||
ls -la'
|
||||
docker container prune -f
|
||||
docker volume prune -f
|
||||
91
.github/workflows/test.yml
vendored
91
.github/workflows/test.yml
vendored
|
|
@ -1,91 +0,0 @@
|
|||
---
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
debug_enabled:
|
||||
type: boolean
|
||||
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
|
||||
required: false
|
||||
default: false
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
full-test:
|
||||
name: Running unit and integrationt tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
distro:
|
||||
- 'debian:stable'
|
||||
include:
|
||||
- distro: 'debian:stable'
|
||||
prepare: .github/prepare_debian.sh
|
||||
steps:
|
||||
- name: Git clone repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
|
||||
- name: Run the tests on ${{ matrix.distro }}
|
||||
run: |
|
||||
docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
|
||||
docker run \
|
||||
-e NPTEST_ACCEPTDEFAULT=1 \
|
||||
-e NPTEST_CACHE="/src/.github/NPTest.cache" \
|
||||
-w /src -v ${PWD}:/src \
|
||||
--tmpfs /media/ramdisk1 \
|
||||
-v /var/run/utmp:/var/run/utmp \
|
||||
--mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
|
||||
${{ matrix.distro }} \
|
||||
/bin/sh -c '${{ matrix.prepare }} && \
|
||||
tools/setup && \
|
||||
./configure --enable-libtap && \
|
||||
make && \
|
||||
make test && \
|
||||
make dist && \
|
||||
tar zxf monitoring-plugins-*.tar.gz && \
|
||||
cd monitoring-plugins-*/ && \
|
||||
./configure && \
|
||||
make'
|
||||
docker container prune -f
|
||||
docker volume prune -f
|
||||
|
||||
build-test:
|
||||
name: Running rpm build test on ${{ matrix.distro }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- {"distro": "fedora:latest", "build": ".github/mock.sh"}
|
||||
- {"distro": "rockylinux:8", "build": ".github/mock.sh"}
|
||||
- {"distro": "almalinux:9", "build": ".github/mock.sh"}
|
||||
# - {"distro": "oraclelinux:9", "build": ".github/mock.sh"}
|
||||
steps:
|
||||
- name: Git clone repository
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
|
||||
uses: mxschmitt/action-tmate@v3
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
|
||||
- name: Run the tests on ${{ matrix.distro }}
|
||||
run: |
|
||||
docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000 tmp-vol
|
||||
docker run \
|
||||
--privileged=true \
|
||||
-e NPTEST_ACCEPTDEFAULT=1 \
|
||||
-e NPTEST_CACHE="/src/.github/NPTest.cache" \
|
||||
-w /src -v ${PWD}:/src \
|
||||
--tmpfs /media/ramdisk1 \
|
||||
-v /var/run/utmp:/var/run/utmp \
|
||||
--mount source=tmp-vol,destination=/src,target=/media/ramdisk2 \
|
||||
${{ matrix.distro }} \
|
||||
/bin/sh -c '${{ matrix.build }} && \
|
||||
ls -la'
|
||||
docker container prune -f
|
||||
docker volume prune -f
|
||||
298
.gitignore
vendored
298
.gitignore
vendored
|
|
@ -1,298 +0,0 @@
|
|||
# In all paths
|
||||
NP-VERSION-FILE
|
||||
*.o
|
||||
|
||||
# /
|
||||
/aclocal.m4
|
||||
/autom4te*.cache
|
||||
/Cache.pm
|
||||
/ChangeLog
|
||||
/command.cfg
|
||||
/compile
|
||||
/confdefs.h
|
||||
/config.*
|
||||
/configure
|
||||
/debian
|
||||
/depcomp
|
||||
/INSTALL
|
||||
/install-sh
|
||||
/intl
|
||||
/libtool
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/missing
|
||||
/monitoring-plugins.spec
|
||||
/stamp-h1
|
||||
/test.pl
|
||||
/THANKS
|
||||
|
||||
# /build-aux/
|
||||
/build-aux/*~
|
||||
/build-aux/compile
|
||||
/build-aux/config.guess
|
||||
/build-aux/config.sub
|
||||
/build-aux/depcomp
|
||||
/build-aux/install-sh
|
||||
/build-aux/missing
|
||||
/build-aux/mkinstalldirs
|
||||
/build-aux/test-driver
|
||||
|
||||
# /doc/
|
||||
/doc/developer-guidelines.html
|
||||
/doc/developer-guidelines.html.last
|
||||
/doc/jade-out.fot
|
||||
|
||||
# /tap/
|
||||
/tap/.deps
|
||||
/tap/.libs
|
||||
/tap/Makefile
|
||||
/tap/Makefile.in
|
||||
/tap/libtap.la
|
||||
/tap/tap.lo
|
||||
|
||||
# /gl/
|
||||
/gl/.deps
|
||||
/gl/*/.deps
|
||||
/gl/alloca.h
|
||||
/gl/arpa
|
||||
/gl/arpa_inet.h
|
||||
/gl/charset.alias
|
||||
/gl/configmake.h
|
||||
/gl/errno.h
|
||||
/gl/error.h
|
||||
/gl/fcntl.h
|
||||
/gl/float.h
|
||||
/gl/getopt.h
|
||||
/gl/glthread/.deps
|
||||
/gl/glthread/.dirstamp
|
||||
/gl/langinfo.h
|
||||
/gl/libgnu.a
|
||||
/gl/locale.h
|
||||
/gl/Makefile
|
||||
/gl/Makefile.in
|
||||
/gl/malloc/.dirstamp
|
||||
/gl/malloc/.deps
|
||||
/gl/math.h
|
||||
/gl/netdb.h
|
||||
/gl/netinet_in.h
|
||||
/gl/ref-add.sed
|
||||
/gl/ref-del.sed
|
||||
/gl/stdalign.h
|
||||
/gl/stdbool.h
|
||||
/gl/stddef.h
|
||||
/gl/stdint.h
|
||||
/gl/stdio.h
|
||||
/gl/stdlib.h
|
||||
/gl/string.h
|
||||
/gl/strings.h
|
||||
/gl/sys_socket.h
|
||||
/gl/sys_stat.h
|
||||
/gl/sys
|
||||
/gl/time.h
|
||||
/gl/unistd.h
|
||||
/gl/wchar.h
|
||||
/gl/wctype.h
|
||||
/gl/inttypes.h
|
||||
/gl/limits.h
|
||||
/gl/pthread.h
|
||||
/gl/sched.h
|
||||
/gl/uchar.h
|
||||
/gl/unicase.h
|
||||
/gl/unictype.h
|
||||
/gl/uninorm.h
|
||||
/gl/unitypes.h
|
||||
/gl/uniwidth.h
|
||||
/gl/stdckdint.h
|
||||
/gl/malloc/dynarray-skeleton.gl.h
|
||||
/gl/malloc/dynarray.gl.h
|
||||
|
||||
# /lib/
|
||||
/lib/.deps
|
||||
/lib/getopt.h
|
||||
/lib/libmonitoringplug.a
|
||||
/lib/Makefile
|
||||
/lib/Makefile.in
|
||||
/lib/vendor/cJSON/.deps
|
||||
/lib/vendor/cJSON/.dirstamp
|
||||
|
||||
# /lib/tests/
|
||||
/lib/tests/base64.Po
|
||||
/lib/tests/.deps
|
||||
/lib/tests/.libs
|
||||
/lib/tests/Makefile
|
||||
/lib/tests/Makefile.in
|
||||
/lib/tests/test_base64
|
||||
/lib/tests/test_cmd
|
||||
/lib/tests/test_tcp
|
||||
/lib/tests/test_utils
|
||||
/lib/tests/utils_base.Po
|
||||
/lib/tests/utils_cmd.Po
|
||||
/lib/tests/utils_disk.Po
|
||||
/lib/tests/utils_tcp.Po
|
||||
/lib/tests/parse_ini.Po
|
||||
/lib/tests/test_ini1
|
||||
/lib/tests/test_ini3
|
||||
/lib/tests/test_opts1
|
||||
/lib/tests/test_opts2
|
||||
/lib/tests/test_opts3
|
||||
/lib/tests/extra_opts.Po
|
||||
|
||||
# /m4/
|
||||
/m4/Makefile
|
||||
/m4/Makefile.in
|
||||
/m4/Makefile.am
|
||||
|
||||
# /perlmods/
|
||||
/perlmods/Makefile
|
||||
/perlmods/Makefile.in
|
||||
/perlmods/*[0-9]
|
||||
|
||||
# /pkg/solaris/
|
||||
/pkg/solaris/.cvsignore
|
||||
/pkg/solaris/pkginfo
|
||||
|
||||
# /plugins/
|
||||
/plugins/check_apt
|
||||
/plugins/check_by_ssh
|
||||
/plugins/check_by_ssh
|
||||
/plugins/check_clamd
|
||||
/plugins/check_cluster
|
||||
/plugins/check_curl
|
||||
/plugins/check_dbi
|
||||
/plugins/check_dig
|
||||
/plugins/check_disk
|
||||
plugins/check_disk.d/.deps/
|
||||
plugins/check_disk.d/.dirstamp
|
||||
/plugins/check_dns
|
||||
/plugins/check_dummy
|
||||
/plugins/check_fping
|
||||
/plugins/check_ftp
|
||||
/plugins/check_game
|
||||
/plugins/check_hpjd
|
||||
/plugins/check_http
|
||||
/plugins/check_ide_smart
|
||||
/plugins/check_imap
|
||||
/plugins/check_jabber
|
||||
/plugins/check_ldap
|
||||
/plugins/check_load
|
||||
/plugins/check_mrtg
|
||||
/plugins/check_mrtgtraf
|
||||
/plugins/check_mysql
|
||||
/plugins/check_mysql_query
|
||||
/plugins/check_nagios
|
||||
/plugins/check_netsaint
|
||||
/plugins/check_nntp
|
||||
/plugins/check_nntps
|
||||
/plugins/check_ntp_peer
|
||||
/plugins/check_ntp_time
|
||||
/plugins/check_pgsql
|
||||
/plugins/check_ping
|
||||
/plugins/check_pop
|
||||
/plugins/check_procs
|
||||
/plugins/check_radius
|
||||
/plugins/check_real
|
||||
/plugins/check_reply
|
||||
/plugins/check_simap
|
||||
/plugins/check_smtp
|
||||
/plugins/check_snmp
|
||||
/plugins/check_spop
|
||||
/plugins/check_ssh
|
||||
/plugins/check_ssmtp
|
||||
/plugins/check_swap
|
||||
/plugins/check_tcp
|
||||
/plugins/check_time
|
||||
/plugins/check_udp
|
||||
/plugins/check_ups
|
||||
/plugins/check_users
|
||||
/plugins/check_users.d/.deps
|
||||
/plugins/check_users.d/.dirstamp
|
||||
/plugins/check_vsz
|
||||
/plugins/config.h
|
||||
/plugins/config.h.in
|
||||
/plugins/.deps
|
||||
/plugins/.libs
|
||||
/plugins/Makefile
|
||||
/plugins/Makefile.in
|
||||
/plugins/libnpcommon.a
|
||||
/plugins/negate
|
||||
/plugins/stamp-h*
|
||||
/plugins/urlize
|
||||
|
||||
# /plugins/picohttpparser
|
||||
/plugins/picohttpparser/Makefile
|
||||
/plugins/picohttpparser/Makefile.in
|
||||
/plugins/picohttpparser/.deps
|
||||
/plugins/picohttpparser/libpicohttpparser.a
|
||||
|
||||
# /plugins/t/
|
||||
/plugins/t/*.tmp
|
||||
|
||||
# /plugins/tests/
|
||||
/plugins/tests/Makefile
|
||||
/plugins/tests/Makefile.in
|
||||
/plugins/tests/test_utils
|
||||
/plugins/tests/test_check_disk
|
||||
/plugins/tests/test_check_swap
|
||||
/plugins/tests/.deps
|
||||
/plugins/tests/.dirstamp
|
||||
|
||||
# /plugins/check_swap.d
|
||||
/plugins/check_swap.d/.deps
|
||||
/plugins/check_swap.d/.dirstamp
|
||||
|
||||
# /plugins/check_snmp.d
|
||||
/plugins/check_snmp.d/.deps
|
||||
/plugins/check_snmp.d/.dirstamp
|
||||
|
||||
# /plugins/check_curl.d
|
||||
/plugins/check_curl.d/.deps
|
||||
/plugins/check_curl.d/.dirstamp
|
||||
|
||||
# /plugins-root/
|
||||
/plugins-root/.deps
|
||||
/plugins-root/.libs
|
||||
/plugins-root/Makefile.in
|
||||
/plugins-root/Makefile
|
||||
/plugins-root/check_dhcp
|
||||
/plugins-root/check_icmp
|
||||
/plugins-root/pst3
|
||||
/plugins-root/check_icmp.d/.dirstamp
|
||||
/plugins-root/check_icmp.d/.deps
|
||||
|
||||
# /plugins-scripts/
|
||||
/plugins-scripts/Makefile
|
||||
/plugins-scripts/Makefile.in
|
||||
/plugins-scripts/subst
|
||||
/plugins-scripts/utils.pm
|
||||
/plugins-scripts/utils.sh
|
||||
/plugins-scripts/check_breeze
|
||||
/plugins-scripts/check_disk_smb
|
||||
/plugins-scripts/check_flexlm
|
||||
/plugins-scripts/check_ifoperstatus
|
||||
/plugins-scripts/check_ifstatus
|
||||
/plugins-scripts/check_ircd
|
||||
/plugins-scripts/check_log
|
||||
/plugins-scripts/check_mailq
|
||||
/plugins-scripts/check_mssql
|
||||
/plugins-scripts/check_ntp
|
||||
/plugins-scripts/check_oracle
|
||||
/plugins-scripts/check_rpc
|
||||
/plugins-scripts/check_sensors
|
||||
/plugins-scripts/check_wave
|
||||
/plugins-scripts/check_file_age
|
||||
/plugins-scripts/check_uptime
|
||||
|
||||
# /po/
|
||||
/po/Makefile
|
||||
/po/Makefile.in
|
||||
/po/remove-potcdate.sed
|
||||
/po/Rules-quot
|
||||
/po/boldquot.sed
|
||||
/po/de.gmo
|
||||
/po/en@boldquot.header
|
||||
/po/en@quot.header
|
||||
/po/fr.gmo
|
||||
/po/insert-header.sin
|
||||
/po/quot.sed
|
||||
/po/POTFILES
|
||||
/po/stamp-po
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
This file contains the origin of code copied verbatim into some or all of the Monitoring Plugins.
|
||||
This file contains the origin of code copied verbatim into some or all of the Nagios plugins.
|
||||
|
||||
The Monitoring Plugins team thanks the original authors.
|
||||
The NagiosPlugin team thanks the original authors.
|
||||
|
||||
Copied code is cited in the source by indented comments of the form
|
||||
Copied code is cited in the source by indented commnents of the form
|
||||
|
||||
.. indent level .. /* Author YYYY sub-citation see ACKNOWLEDGEMENTS */
|
||||
|
||||
|
|
@ -20,20 +20,10 @@ Using the DLPI support on SysV systems to get the host MAC address in check_dhcp
|
|||
Stenberg, Daniel
|
||||
Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se>
|
||||
http://curl.haxx.se/
|
||||
Use of duplication of macros in m4/np_curl.m4 (slightly adapted for m4/uriparser.m4 too)
|
||||
Use of duplication of macros in m4/np_curl.m4
|
||||
|
||||
Coreutils team
|
||||
Copyright (C) 91, 1995-2004 Free Software Foundation, Inc.
|
||||
http://www.gnu.org/software/coreutils/
|
||||
Use of macros and lib files in m4/np_coreutils.m4 and lib/. Setuid installs in plugins-root
|
||||
|
||||
Gnulib team
|
||||
Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc
|
||||
http://www.gnu.org/software/gnulib/
|
||||
Use of lib files that originally were used from coreutils
|
||||
|
||||
Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase,
|
||||
Shigeo Mitsunari
|
||||
picohttpparser
|
||||
https://github.com/h2o/picohttpparser
|
||||
Use of the library for HTTP header parsing in check_curl.
|
||||
|
|
|
|||
16
AUTHORS
16
AUTHORS
|
|
@ -1,26 +1,14 @@
|
|||
The Monitoring Plugins are brought to you by the Monitoring Plugins Development Team.
|
||||
The Nagios Plugins are brought to you by the Nagios Plugins Development Team.
|
||||
|
||||
Jeremy T. Bouse
|
||||
Jeremy T Bouse
|
||||
Peter Bray
|
||||
Gavin Carr
|
||||
Karl DeBisschop
|
||||
Matthias Eble
|
||||
Ethan Galstad
|
||||
Sean Finney
|
||||
Subhendu Ghosh
|
||||
Thomas Guyot-Sionnest
|
||||
Stanley Hopcroft
|
||||
Matthew Kent
|
||||
Sam Kottler
|
||||
Harper Mann
|
||||
Benoit Mortier
|
||||
Sven Nierlein
|
||||
Eric Stanley
|
||||
Nathan Vonnahme
|
||||
Ton Voon
|
||||
Jan Wagner
|
||||
Holger Weiss
|
||||
Michael Wirtgen
|
||||
Oliver Skibbe
|
||||
Andreas Baumann
|
||||
Lorenz Kästle
|
||||
|
|
|
|||
9
BRANCHES
Normal file
9
BRANCHES
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# $Id$
|
||||
#
|
||||
# This file describes the current branches in CVS for nagiosplug
|
||||
# Used by sfsnapshot to generate the snapshots
|
||||
#
|
||||
# Format:
|
||||
# cvs_branch_name:description
|
||||
HEAD:Stable - 1.4.x releases
|
||||
r1_4-patches:Testing multiple branches
|
||||
20
BUGS
Normal file
20
BUGS
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
This file lists known bugs in this specific release. It lists the major bugs from the Nagios
|
||||
Plugins page on Sourceforge at http://sourceforge.net/tracker/?group_id=29880&atid=397597.
|
||||
|
||||
For the 1.4 release:
|
||||
|
||||
1291987 - urlize useragent does not work
|
||||
1291115 - Wrong compile options for openSSL
|
||||
1284352 - check_dhcp -s not compatible with helpers/relays
|
||||
1283131 - check_load gives incorrect data on AIX
|
||||
1267741 - check_ntp logic incorrect with > 1 peers
|
||||
1252285 - check_ssh reports critical for some SSH servers
|
||||
1225470 - check_swap perf data incorrect
|
||||
1218438 - check_radius linking to wrong header
|
||||
1210958 - check_nwstat incorrectly reporting free disk space
|
||||
1144727 - check_disk fails on solaris with large available space
|
||||
1108499 - check_ping with -U on Debian fails
|
||||
1094326 - check_ide_smart usage errors
|
||||
1090549 - check_dhcp ignores DHCP replies
|
||||
990948 - check_disk_smb doesn't allow spaces in share names
|
||||
|
||||
26
CHANGES
Normal file
26
CHANGES
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
This file documents the major additions and syntax changes between releases.
|
||||
|
||||
1.4.3
|
||||
Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install
|
||||
SSL plugins work with gnutls as well as OpenSSL
|
||||
check_mysql_query added to run arbitrary SQL commands, with threshold checking
|
||||
libtool now required for development systems
|
||||
Notice: check_udp (compiled from check_udp.c) will be deprecated in the next release.
|
||||
check_udp2 should be used instead and will be renamed to check_udp
|
||||
|
||||
1.4.2
|
||||
Fix for Redhat ES4 for check_dns and check_dig
|
||||
|
||||
1.4
|
||||
IPv6 support in check_ping, check_by_ssh, check_http, check_ldap, check_smtp, check_tcp
|
||||
Internationalisation support
|
||||
Performance data added to most plugins
|
||||
check_disk now using GNU coreutils code
|
||||
New plugins - check_dhcp, check_icmp
|
||||
contrib/check_citrix has been replaced by contrib/check_ica* (requires packet_utils.pm in libexec)
|
||||
check_http --min changed to --pagesize, added max so min:max in check
|
||||
check_vsz and check_rss deprecated - functionality moved into check_procs
|
||||
check_swap % thresholds changed to measure amount free, instead of amount used
|
||||
check_disk syntax changes for -p, -m/-M, defaults to MB instead of kB
|
||||
check_procs -C expects no path for the command name
|
||||
|
||||
35
CODING
35
CODING
|
|
@ -7,20 +7,33 @@ readability in a wide range of environments.
|
|||
|
||||
1. C Language Programming
|
||||
|
||||
All code should comply with most of the requirements of the Free Software
|
||||
All code should comply with the requirements of the Free Software
|
||||
Foundation Coding standards (which are currently available at
|
||||
https://www.gnu.org/prep/standards/standards.html ).
|
||||
We also follow most of the FSF guidelines, with the huge and explicit
|
||||
exception of the style guidelines.
|
||||
Developers may suggest deviations from the FSF
|
||||
http://www.gnu.org/prep/standards_toc.html). We also follow most of
|
||||
the FSF guidelines. Developers may suggest deviations from the FSF
|
||||
style recommendations, which will be considered by open discussion on
|
||||
the Monitoring Plugins devel mailing list or the Github Pull Request.
|
||||
Any such deviations should be
|
||||
applied to the entire code base to ensure consistency.
|
||||
the nagiosplug-devel mailing list. Any such deviations will apply to
|
||||
the entire code base to ensure consistency.
|
||||
|
||||
Currently, the exceptions to FSF recommendations are roughly equivalent
|
||||
to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
|
||||
exceptions are as follows:
|
||||
|
||||
a) leading white space for a statement should be formatted as tabs,
|
||||
with one tab for each code indentation level.
|
||||
|
||||
b) in statement continuation lines, format whitespace up to the column
|
||||
starting the statement as tabs, format the rest as spaces (this
|
||||
results in code that is legible regardless of tab-width setting).
|
||||
|
||||
c) with the exception of the above, tabs should generally be avoided
|
||||
|
||||
d) when tab width is 2 spaces, line-length should not exceed 80
|
||||
characters
|
||||
|
||||
e) The opening brace of an if or while block is on the same line as
|
||||
the end of the conditional expression (the '-br' option).
|
||||
|
||||
The style guideline is the following:
|
||||
Whatever clang-format does with the configuration file available (.clang-format)
|
||||
Apart from that, code should naturally be readable and easy to understand.
|
||||
|
||||
2. Perl Language Programming
|
||||
|
||||
|
|
|
|||
884
COPYING
884
COPYING
|
|
@ -1,626 +1,285 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
NO WARRANTY
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
|
|
@ -628,15 +287,15 @@ free software which everyone can redistribute and change under these terms.
|
|||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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 3 of the License, or
|
||||
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,
|
||||
|
|
@ -645,30 +304,37 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||
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, see <http://www.gnu.org/licenses/>.
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
|
|
|||
100
FAQ
100
FAQ
|
|
@ -1,55 +1,87 @@
|
|||
Frequently Asked Questions
|
||||
**************************
|
||||
|
||||
Q: Where can I find documentation for <insert name> plugin?
|
||||
1. Q: Where can I find documentation for <insert name> plugin?
|
||||
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include internal documentation. The documentation
|
||||
can be read executing plugin with the -h or --help option. If
|
||||
the '-h' option does not work, that is a bug.
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include internal documentation. The documentation
|
||||
can be read executing plugin with the '-h' option ('--help' if
|
||||
long options are enabled). If the '-h' option does not work, that
|
||||
is a bug.
|
||||
|
||||
2. Q: What version of <insert name> plugin am I running?
|
||||
|
||||
Q: What version of <insert name> plugin am I running?
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include detailed version information. When executed
|
||||
with the '-V' option, a version string will be printed:
|
||||
|
||||
A: All plugins that comply with minimal development guideline for
|
||||
this project include detailed version information. When executed
|
||||
with the '-V' option, a version string will be printed:
|
||||
check_radius (nagios-plugins 1.3.0-alpha1) 1.11
|
||||
|
||||
check_radius v1.4.16 (monitoring-plugins 1.4.16)
|
||||
Note that this string include both the assigned package release
|
||||
name and the CVS-generated revision for the individual plugin.
|
||||
Authors should strictly adhere to this format. All bug reports
|
||||
and help requests should reference this information.
|
||||
|
||||
All bug reports and help requests should reference this
|
||||
information.
|
||||
3. Q: What information do I need to include when asking for help or
|
||||
submitting a bug report?
|
||||
|
||||
A: At a minimum, the output from 'uname -a' and the version string
|
||||
from '<plugin_name> -V' and, of course, a description of the
|
||||
problem and any solution/patch.
|
||||
|
||||
Q: What information do I need to include when asking for help or
|
||||
submitting a bug report?
|
||||
4. Q: I'm using Redhat Linux (or some other RPM-based distribution).
|
||||
Which packages should I install?
|
||||
|
||||
A: At a minimum, the output from 'uname -a' and the version string
|
||||
from '<plugin_name> -V' and, of course, a description of the
|
||||
problem and any solution/patch.
|
||||
A: The package nagios-plugins-<version>.<arch>.rpm contains only
|
||||
those plugins that should work on any POSIX compliant system. In
|
||||
other words, you should be able to install this package on your
|
||||
system, no matter what else is or in not installed.
|
||||
|
||||
However, most of us have more complex systems than barebones
|
||||
POSIX. We tried creating a variety of separate packages so
|
||||
each dependency could be installed cleanly, but many people
|
||||
found that this resulted in too many packages. So in the end,
|
||||
all the non-POSIX plugins were folded into one RPM
|
||||
(nagios-plugins-<version>.<arch>.rpm). Most people will need to
|
||||
use RPM's '--nodeps' option to install this package.
|
||||
|
||||
Q: I get an error like
|
||||
5. Q: My system uses the .deb package format. What packages should I
|
||||
install?
|
||||
|
||||
Warning: Return code of 127 for check of service 'PING' on host 'anyhost' was out of bounds.
|
||||
A: We strive for cooperation between all packagers and developers.
|
||||
The answers for .deb are the same as for RPM, after changing the
|
||||
package name suffixes accordingly.
|
||||
|
||||
when I run Nagios. (Often check_ping runs just fine on the
|
||||
command line).
|
||||
6. Q: I prefer to build my own RPMs. Do I need to install all of the
|
||||
various dependencies?
|
||||
|
||||
A: Commonly, system administrators will make security as tight as
|
||||
possible on the monitoring system. Sometimes this includes OS
|
||||
options or hardening scripts that prevent unprivileged users from
|
||||
running the ping command. Nagios runs with no more privileges
|
||||
than 'nobody' -- check to be sure that the nagios user can
|
||||
actually run check ping. (This can also happen with other binaries
|
||||
executed by nagios, but ping seems to be far and away the biggest
|
||||
offender.)
|
||||
A: Beginning with the 1.2.9-1 release, you may run
|
||||
|
||||
rpm --define 'custom 1' -ta nagios-plugins-<release>.tar.gz
|
||||
|
||||
Q: I have a plugin to offer. What can I do?
|
||||
In prior releases, you must unpack the tarball and build the
|
||||
RPM using nagios-custom.spec with 'rpm -ba'.
|
||||
|
||||
A: You can make it available on MonitoringExchange (http://monitoringexchange.org)
|
||||
where other people can find it for use.
|
||||
7. Q: I get an error like
|
||||
|
||||
You can also get feedback on improving the plugin via the
|
||||
devel@monitoring-plugins.org mailing list.
|
||||
Warning: Return code of 127 for check of service 'PING' on host 'anyhost' was out of bounds.
|
||||
|
||||
when I run Nagios. (Often check_ping runs just fine on the
|
||||
command line).
|
||||
|
||||
A: Commonly, system administrators will make security as tight as
|
||||
possible on the monitoring system. Sometimes this includes OS
|
||||
options or hardening scripts that prevent unprivileged users from
|
||||
running the ping command. Nagios runs with no more privileges
|
||||
than 'nobody' -- check to be sure that the nagios user can
|
||||
actually run check ping. (This can also happen with other binaries
|
||||
executed by nagios, but ping seems to be far and away the biggest
|
||||
offender.)
|
||||
|
||||
8. Q: I have a plugin to offer. What do I do to get it accepted?
|
||||
|
||||
A: Send it to nagiosplug-devel@lists.sourceforge.net. Usually, we
|
||||
just drop it into contrib until we have a chance to check if the
|
||||
standard options are used, etc.
|
||||
|
||||
You can also get feedback on improving the plugin via the mailing list.
|
||||
|
|
|
|||
59
INSTALLING
Normal file
59
INSTALLING
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
Nagios Plugins Quick-and-Dirty Installation Instructions
|
||||
--------------------------------------------------------
|
||||
|
||||
0) If using the CVS tree, you need m4, automake, and autoconf. To
|
||||
start out, run:
|
||||
|
||||
# aclocal
|
||||
# autoconf
|
||||
# autoheader
|
||||
# automake
|
||||
|
||||
or you can run ./tools/setup
|
||||
|
||||
For best results, please use the most recent versions of autoconf
|
||||
and automake. Older versions may also work, but are not
|
||||
specifically supprted.
|
||||
|
||||
|
||||
1) Run the configure script to initialize variables and create a Makefile, etc.
|
||||
|
||||
./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-cgiurl=SOMEURL
|
||||
|
||||
a) Replace BASEDIRECTORY with the path of the directory under which Nagios
|
||||
is installed (default is '/usr/local/nagios')
|
||||
b) Replace SOMEUSER with the name of a user on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
c) Replace SOMEGRP with the name of a group on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
d) Replace CGIURL with the path used to access the Nagios CGIs with
|
||||
a web browser (default is '/nagios/cgi-bin')
|
||||
|
||||
|
||||
2) Compile the plugins with the following command:
|
||||
|
||||
make all
|
||||
|
||||
|
||||
3) Install the compiled plugins and plugin scripts with the following command:
|
||||
|
||||
make install
|
||||
|
||||
NOTE:
|
||||
The installation procedure will attempt to place the plugins in a
|
||||
'libexec/' subdirectory in the base directory you specified with
|
||||
the --prefix argument to the configure script.
|
||||
|
||||
|
||||
4) Verify that your host configuration file (hosts.cfg) for Nagios contains
|
||||
the correct paths to the new plugins.
|
||||
|
||||
|
||||
|
||||
That's it. If you have any problems or questions, feel free send mail
|
||||
to nagios-users@lists.sourceforge.net or nagiosplug-help@lists.sourceforge.net
|
||||
|
||||
Please send patches and bugs to nagiosplug-devel@lists.sourceforge.net and
|
||||
post them on http://sourceforge.net/projects/nagiosplug.
|
||||
|
||||
|
||||
10
LEGAL
Normal file
10
LEGAL
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
All source code, binaries, documentation, and information contained
|
||||
in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
|
||||
INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE.
|
||||
|
||||
Nagios and the Nagios logo are trademarks of Ethan Galstad. All
|
||||
other trademarks, servicemarks, registered trademarks, and
|
||||
registered servicemarks are the property of their respective owner(s).
|
||||
|
||||
43
Makefile.am
43
Makefile.am
|
|
@ -1,39 +1,35 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = gl tap lib plugins plugins-scripts plugins-root @PERLMODS_DIR@
|
||||
SUBDIRS = intl lib plugins plugins-scripts plugins-root m4 po
|
||||
|
||||
EXTRA_DIST = config.rpath \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ NEWS \
|
||||
NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm pkg \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \
|
||||
REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm contrib pkg nagios-plugins.spec \
|
||||
config_test/Makefile config_test/run_tests config_test/child_test.c \
|
||||
perlmods tools/build_perl_modules
|
||||
tools/tinderbox_build
|
||||
|
||||
ACLOCAL_AMFLAGS = -I gl/m4 -I m4
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\"
|
||||
|
||||
#
|
||||
# The ChangeLog file is auto-generated from the Git history. We let it depend
|
||||
# on NP-VERSION-GEN, as we bump our version number in that file.
|
||||
#
|
||||
ChangeLog: NP-VERSION-GEN
|
||||
$(top_srcdir)/tools/generate-change-log > $@
|
||||
|
||||
dist-hook:
|
||||
$(MAKE) THANKS
|
||||
echo ${VERSION} >$(distdir)/release
|
||||
make THANKS nagios-plugins.spec pkg/fedora/nagios-plugins.spec
|
||||
|
||||
install-root:
|
||||
cd plugins-root && $(MAKE) $@
|
||||
|
||||
test test-debug:
|
||||
cd lib && $(MAKE) $@
|
||||
if test "$(PERLMODS_DIR)" != ""; then cd perlmods && $(MAKE) $@; fi
|
||||
cd plugins && $(MAKE) $@
|
||||
cd plugins-scripts && $(MAKE) $@
|
||||
cd plugins-root && $(MAKE) $@
|
||||
test:
|
||||
cd plugins; $(MAKE) test
|
||||
cd plugins-scripts; $(MAKE) test
|
||||
|
||||
nagios-plugins.spec: nagios-plugins.spec.in
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@
|
||||
|
||||
pkg/fedora/nagios-plugins.spec: nagios-plugins.spec.in
|
||||
$(top_srcdir)/mkinstalldirs pkg/fedora
|
||||
sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;/^# Requires$$/r $(top_srcdir)/pkg/fedora/requires" $? > $@
|
||||
|
||||
# Solaris pkgmk
|
||||
BUILDDIR = build-solaris
|
||||
|
|
@ -45,13 +41,11 @@ solpkg:
|
|||
if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
|
||||
$(MAKE) all
|
||||
$(MAKE) DESTDIR=$$PWD/$(BUILDDIR) install
|
||||
$(INSTALL) plugins-root/pst3 $(BUILDDIR)$(libexecdir)
|
||||
$(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
|
||||
$(INSTALL) pkg/solaris/preinstall $(BUILDDIR)
|
||||
cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
|
||||
|
||||
THANKS: THANKS.in
|
||||
@echo "This software is brought to you by the Monitoring Plugins Development Team. However," > $@
|
||||
@echo "This software is brought to you by the Nagios Plugins Development Team. However," > $@
|
||||
@echo "there have been many contributors to this project. Everyone below has helped in " >> $@
|
||||
@echo "raising bug reports, creating patches or contributing new plugins." >> $@
|
||||
@echo "" >> $@
|
||||
|
|
@ -59,4 +53,3 @@ THANKS: THANKS.in
|
|||
|
||||
pkgclean:
|
||||
rm -rf $(BUILDDIR) $(PACKDIR)
|
||||
|
||||
|
|
|
|||
851
NEWS
851
NEWS
|
|
@ -1,849 +1,2 @@
|
|||
This file documents the major additions and syntax changes between releases.
|
||||
|
||||
3.0.0 16th Jun 2026
|
||||
Codename: Johann Georg Elser
|
||||
|
||||
This release contains a lot of changes (at least at the C side of things),
|
||||
both regarding the code, but also regarding the development itself.
|
||||
There are some breaking changes included, including the deprecation or removal of Plugins.
|
||||
|
||||
Removals
|
||||
* check_nt
|
||||
* check_ntp
|
||||
* check_nwstat
|
||||
* check_overcr
|
||||
|
||||
Deprecations
|
||||
Deprecated plugins are marked as dead but still there since they are
|
||||
in common usage. They will not be developed any further, but patches may get
|
||||
accepted if there is not much effort and a low risk of breaking something.
|
||||
It is recommended to stop using them and they will be removed in a future release
|
||||
* check_http, the replacement is check_curl
|
||||
|
||||
General changes
|
||||
* check_curl is no longer experimental and can be considered stable
|
||||
* check_snmp links directly against net-snmp instead of executing `snmpget` (or `snmpgetnext`)
|
||||
* the vendored version of Gnulib was updated
|
||||
* IPv6 is no longer optional
|
||||
* All of the C plugins were heavily refactored to homongenize the code
|
||||
* Far less global variables to reduce complexity and side effects
|
||||
* A more or less common structure to reduce the mental overhead
|
||||
* All of the C code is now formatted with clang-format
|
||||
|
||||
Fixes
|
||||
* multiple plugins
|
||||
* improved error message for missing certificate
|
||||
* fixes for compiler warnings
|
||||
* Compilation on OpenBSD was fixed
|
||||
* added CHECK_EOF to work around warnings about EOF and -1 being the same
|
||||
* lots of Typos
|
||||
* check_curl
|
||||
* fix relative redirects on non-standard port
|
||||
* raise SSL issue when --continue-after-certificate is used
|
||||
* Documentation for --certificate, --cookie-jar
|
||||
* fix help for regex state
|
||||
* fix OpenSSL SSL_read: error: ... unexpected eof while reading
|
||||
* update TLS notification notes
|
||||
* enable internal cookie handling
|
||||
* Fix sticky redir
|
||||
* try to be more helpful in check_curls help
|
||||
* abort redir if location is not found
|
||||
* old style follow on redirect did miss some parts
|
||||
* check_fping
|
||||
* Improve handling of IPv4/IPv6 options
|
||||
* check_ssh
|
||||
* Fix a buffer overflow situation
|
||||
* check_by_ssh
|
||||
* Ignore output on stderr by default
|
||||
* check_snmp
|
||||
* Put all privproto/authproto options into help
|
||||
* check_mysql
|
||||
* Fix replica check on newer versions of MySQL
|
||||
|
||||
Enhancements
|
||||
* multiple plugins
|
||||
* A new output infrastructure for the C part of the project
|
||||
* Removes some text formatting complexity from individual plugins
|
||||
* Multi line output is the new default and should make the output better readable
|
||||
* Centralised formatting allows for extenting the output format
|
||||
* Most of the C plugins were migrated to the new system
|
||||
* On OpenBSD some plugins restrict themselves to reduce security risks
|
||||
* check_dig: add -E/--require-flags and -X/--forbid-flags
|
||||
* check_ifstatus: Add -d switch
|
||||
* check_fping
|
||||
* Add dontfrag / random flags
|
||||
* Add fwmark option
|
||||
* Add icmp-timestamp option
|
||||
* Add check-source option
|
||||
* check_curl
|
||||
* Add proxy option (similar to `curl`)
|
||||
* Add selectable timeout return state
|
||||
* check_http
|
||||
* Add selectable timeout return state
|
||||
|
||||
2.4.0 25th Jul 2024
|
||||
FIXES
|
||||
* check_dbi: Compiler warning for uninitialized variable
|
||||
* check_curl: Initialize pointer before usage
|
||||
* check_ntp: Initialize intermediate results in any case
|
||||
* Fixes for -Wsign-compare
|
||||
* check_tcp: Fixes an error with using the wrong type for a variable
|
||||
* check_mailq: exit on empty strings and exit early
|
||||
* check_users: Change option for sanity checking arguments to avoid segfault
|
||||
* check_users: Update help to properly show that thresholds are ranges
|
||||
* check_users: fix segfault
|
||||
* check_dbi: Fix compiler warning for uninitialized variable
|
||||
* check_curl: Initialize pointer before usage
|
||||
* check_ntp: Initialize intermediate results in any case
|
||||
* Fix logic in is_uint64_t to fix type-limit warning
|
||||
* check_ntp_peer: Fixes for Wmaybe-unitialized and some restructuring
|
||||
* check_dns: Remove unused variable
|
||||
* check_disk: fix ignore-missing in combination with includes
|
||||
* check_procs: ignore our own children
|
||||
* Prevent -lcrypto from showing up in Makefile dependencies
|
||||
* Change irritating NULL assignment
|
||||
* check_http: Remove self assignment of a variable and add some comments
|
||||
* check_snmp: Remove unused variable
|
||||
* check_dhcp: Make implicit conversion explicit to dismiss warning
|
||||
* Ini Parser: Avoid freeing symbols from text section
|
||||
* check_icmp: keep performance data order in case of none-reachable hosts
|
||||
* check_swap: Change another fake boolean to a real one
|
||||
* check_swap: Rename type since *_t is reserved for C standard types
|
||||
* check_ssh: Fix a typo in "remote-protocol parameter
|
||||
* check_ssh: Handle non-alpha software versions
|
||||
* check_ssh: properly parse a delayed version control string
|
||||
* check_disk: Fail on missing arguments for --warning and --critical and fix a test case
|
||||
* check_disk: Use new test function for percentage expressions
|
||||
* check_load: remove unused code
|
||||
* check_curl/check_http: clarified format of POST data
|
||||
|
||||
ENHANCEMENTS
|
||||
* Use C99 booleans
|
||||
* check_mailq: remove trailing whitespaces
|
||||
* check_mailq: unify tabs/spaces
|
||||
* check_oracle: Shellcheck fixes
|
||||
* check_ups: output ups.realpower if supported
|
||||
* check_disk: add -n short option for --ignore-missing
|
||||
* check_procs: Improve help text, mentioning excluded processes
|
||||
* check_procs: Generalise wording, remove mentioning of nrpe
|
||||
* check_curl: add haproxy protocol option
|
||||
* Improve negate plugin helptext
|
||||
* check_disk: increase alert precision
|
||||
* check_ircd: IPv6 support
|
||||
* check_nwstat: adds percentage used space
|
||||
* Add new test function for percentage expressions
|
||||
* check_swap: Possibility to run check_swap without thresholds
|
||||
* check_ups: additional alarm conditions
|
||||
* check_http/check_curl: added a --regex-state option to change the state of a regex check
|
||||
|
||||
2.3.5 18th Oct 2023
|
||||
FIXES
|
||||
* Include maxfd.h in lib Makefile
|
||||
|
||||
2.3.4 18th Oct 2023
|
||||
ENHANCEMENTS
|
||||
* check_curl: added --cookie-jar and doing proper cleanup of libcurl
|
||||
* check_curl: Include all IPs from getaddrinfo() in curl DNS cache
|
||||
* check_dhcp: Add dhcp rogue detection
|
||||
* check_disk: add ignore-missing option to return OK for missing fs
|
||||
* check_disk_smb: allow checking 0-sized resource (ex. IPC$)
|
||||
* check_disk: The options to include or exclude specific file systems now allow the usage of regex(7)
|
||||
* check_icmp: Add support to Jitter, MOS and Score
|
||||
* check_mysql: Detect running mysqldump and handle it more gracefully
|
||||
* check_procs: Implement --exclude-process to exclude specific processes
|
||||
* check_smtp: add new longoption --tls
|
||||
* check_smtp: Add option to prefix PROXY header
|
||||
* check_smtp: Add support for SMTP over TLS
|
||||
* check_smtp: Add support for SNI
|
||||
* check_snmp: Implement option to ignore mib file parsing errors
|
||||
* check_users: prefer systemd-logind over utmp
|
||||
|
||||
FIXES
|
||||
* check_disk: Display SI units correctly
|
||||
* check_ircd: use pack_sockaddr_in rather than hand-rolled
|
||||
* check_log/check_oracle/check_sensors: fixed the outputs of the help functionality
|
||||
* check_mysql: Add mysql_close to avoid spamming the server logs
|
||||
* check_smtp: add missing -r option in usage
|
||||
* check_snmp: disable multiplier when unused
|
||||
* check_wave: Use compile time determined path to snmpget
|
||||
|
||||
GENERAL
|
||||
* Sync with the Gnulib code 668c0b8ffa
|
||||
* Set autoconf prerequisite version to 2.64
|
||||
* Remove sha1 and use sha256 in some parts of the plugin structure
|
||||
* A lot of compiler warnings were fixed
|
||||
* Some code was refactored a little bit
|
||||
|
||||
2.3.3 2nd Feb 2023
|
||||
ENHANCEMENTS
|
||||
using PRId64 and PRIu64 instead of %ld directly
|
||||
check_http: Make faster with larger files
|
||||
check_snmp: add 'multiplier' to modify current value
|
||||
check_http: Implement chunked encoding decoding
|
||||
check_http/check_curl: add chunked encoding test
|
||||
check_log: Added --exclude to exclude patterns
|
||||
check_log: Add tests
|
||||
check_disk: Clarify usage possibilities
|
||||
|
||||
FIXES
|
||||
fixed two PRId64 to PRIu64 in perfdata_uint64
|
||||
check_pgsql: Removing is_pg_dbname altogether,using postgres API.
|
||||
check_http: Remove superfluous CRLF in HTTP-Requests
|
||||
check_curl: detect ipv6
|
||||
check_icmp: fix parsing help/version long options
|
||||
check_http: fix test plan
|
||||
check_disk: Find accessible mount path if multiple are available
|
||||
check_apt: Fix unknown escape sequence error output
|
||||
check_curl: fix checking large bodys
|
||||
check_snmp: Improve tests for check_snmp & multiply option
|
||||
check_snmp: always apply format when applying multiplier
|
||||
check_http: Use real booleans instead of ints
|
||||
check_http: Document process_arguments a little bit better
|
||||
check_http: Remove dead code
|
||||
check_http: Fix several bug in the implementation of unchunking
|
||||
check_http: Reformat a part to increase readability
|
||||
check_apt: Put upgrade options in the root sections
|
||||
check_apt: Fix comment
|
||||
check_apt: Use real booleans
|
||||
check_mailq: Fixing nullmailer regex
|
||||
check_snmp: Fix regex matches
|
||||
check_log: Fixed a bug when using --all
|
||||
check_log: Cleaned up duplicated code in the args
|
||||
check_http: Fix memory reallocation error in chunk decoding logic
|
||||
check_http: Add space for ending NULL byte in array for chunked encoding
|
||||
|
||||
2.3.2 20th Oct 2022
|
||||
GENERAL
|
||||
Use netcat-openbsd for debian explicitly (by @RincewindsHat #1704)
|
||||
Replace egrep with grep -E (by @RincewindsHat #1791)
|
||||
Use silent automake by default (by @RincewindsHat #1747)
|
||||
|
||||
SINGLE PLUGINS
|
||||
check_by_ssh: added option to exit with an warning, if there is output on STDERR (by @nafets #1301)
|
||||
check_by_ssh: Add "-U" flag (#1123). (by @archiecobbs #1774)
|
||||
check_by_ssh: Let ssh decide if a host is valid, enables usage of ssh .config file (by @RincewindsHat #1691)
|
||||
check_curl: Add an option to check_curl to verify the peer certificate & host using the system CA's (by @bazzisoft #1669)
|
||||
check_curl: fixed -ffollow for HTTP/2.0 (Fixes #1685): added major_version parsing to PicoHTTPParser (by @andreasbaumann #1742)
|
||||
check_curl: fixes check_curl: "CRITICAL - Cannot retrieve certificate subject." (by @andreasbaumann #1689)
|
||||
check_curl: fix if http header contains leading spaces (by @sni #1666)
|
||||
check_curl: Update check_curl.c to display a specific human-readable error message where possible (by @bazzisoft #1668)
|
||||
check_curl: verify certificates option should not force SSL to be used (by @bazzisoft #1688)
|
||||
check_disk: Description for -M was the wrong way around (by @RincewindsHat #1746)
|
||||
check_disk: Fixing the stuff that is broken on btrfs (by @waja #1388)
|
||||
check_disk: Fix perfdata for big values for check disk (by @RincewindsHat #1714)
|
||||
check_disk_smb: Add configfile feature (by @Napsty #1402)
|
||||
check_disk_smb: Add timeout (by @cdruee #1770)
|
||||
check_dns: Add --expect-nxdomain (by @Jonny007-MKD #1623)
|
||||
check_dns: split multiple IP addresses passed in one -a argument (by @DerDakon #1649)
|
||||
check_file_age: Make size parameter a little bit more intelligible (by @RincewindsHat #1730)
|
||||
check_fping: Implements 'host-alive' mode (Closes. #1027) (by @waja #1740)
|
||||
check_game: Update Url to qstat (by @RincewindsHat #1725)
|
||||
check_http: changed 'STATE_CRITICAL' to 'STATE_WARNING' for infinite loop (by @xFuture603 #1690)
|
||||
check_http: Increase regexp limit (by @hydrapolic #1566)
|
||||
check_http: Support http redirect (by @waja #1449)
|
||||
check_icmp: buffer offerflow (by @RincewindsHat #1733)
|
||||
check_icmp: delay set_source_ip() until address_family is detected (by @ghciv6 #1735)
|
||||
check_icmp: Fix "Invalid Argument" from sendmsg() under FreeBSD 13.1 and "setsockopt failed" for TTL setting (by @eriksejr #1771)
|
||||
check_icmp: Fix pkt perfdata in check_host mode (by @sjoegren #1721)
|
||||
check_ldap: Allows check_ldap to read password from environment variable (by @mullumaus #1724)
|
||||
check_load: add LOAD prefix to load plugin (by @haraldj #1694)
|
||||
check_load: Display total and scaled load values if check_load scales the values (by number of CPUs by @RincewindsHat #1778)
|
||||
check_log: Missing oldlog now aborts check_log (by @RincewindsHat #1732)
|
||||
check_mailq: Add mailq -C option for config dir or config file (by @leeclemens #1490)
|
||||
check_mailq: Check mailq domain specific warnings (by @RincewindsHat #1731)
|
||||
check_mailq: Fix regexp for nullmailer "mailq" output (by @darksoul42 #1493)
|
||||
check_mysql: fix segfaults with mysql-connector-c #1562 (by @ghciv6 #1644)
|
||||
check_pgsql: add --queryname parameter to check_pgsql (by @datamuc #1741)
|
||||
check_ping: Do not show RTA if no connection was possible (by @RincewindsHat #1697)
|
||||
check_ping: understang ping6 output from iputils package (by @glensc #1412)
|
||||
check_proc: Fix check proc ps detection (by @sni #1712)
|
||||
check_procs: exchange needle and haystack in strstr() for proper st… (by @wolfgangkarall #1654)
|
||||
check_smtp: add -L flag to support LMTP (LHLO instead of HELO/EHLO). (by @ghen2 #1715)
|
||||
check_snmp: Added option for null zero length string exit codes (by @FracKenA #1496)
|
||||
check_snmp: fix performance thresholds when using multiple oids (by @sni #1722)
|
||||
check_snmp fix segfaults (by @adrb #1589)
|
||||
check_snmp: put the "c" (to mark a counter) after the perfdata value (by @lausser #1465)
|
||||
check_swap: fix parsing swap values (by @sni #1780)
|
||||
check_swap: Fix perfdata for check swap (by @RincewindsHat #1707)
|
||||
check_swap: Fix unit for total in perfdata (by @RincewindsHat #1779)
|
||||
check_swap: Handle cached swap (by @mdavranche #1642)
|
||||
check_swap: Small fix to threshold validation and style (indentation) fixes (by @RincewindsHat #1723)
|
||||
check_ups: Fix possible overflow in check_ups (by @phibos #1727)
|
||||
check_uptime: Add option to report uptime in days instead of seconds (by @amotl #1750)
|
||||
check_uptime: Fix/improve output message "Uptime is ..." (by @amotl #1751)
|
||||
|
||||
MULTIPLE PLUGINS
|
||||
check_http, check_curl: added --max-redirs=N option (feature #1684) (by @andreasbaumann #1744)
|
||||
check_http, check_curl: Enhancement --continue-after-certificate (backport from nagios-plugins) (by @andreasbaumann #1762)
|
||||
check_http, check_curl: Remove check_http and check_curl test which are somehow always failing (by @RincewindsHat #1777)
|
||||
check_log, check_oracle, check_sensors: Several fixes shellcheck complaining about (by @waja #1459)
|
||||
sslutils: use chain from client certificates (by @tobiaswiese #1664)
|
||||
|
||||
NON FUNCTIONAL CHANGES
|
||||
Trivial source code whitespace formatting fixes to standard. (by @ziesemer #1424)
|
||||
docs: fix simple typo, conspicuosly -> conspicuously (by @timgates42 #1652)
|
||||
Migrate to GitHub actions (by @jacobbaungard #1686)
|
||||
Point to Icinga Exchange instead of dead Monitoring Exchange (by @RincewindsHat #1737)
|
||||
github actions: fix check_users test case (by @sni #1713)
|
||||
Add CodeQL checks (by @phibos #1682)
|
||||
Fix some QL problems (by @RincewindsHat #1729)
|
||||
Update CodeQL and update runner before installing (by @RincewindsHat #1775)
|
||||
check_disk: Check disk compiler warnings (by @RincewindsHat #1758)
|
||||
check_disk: Trivial printf fix and a little bit of code style (by @RincewindsHat #1695)
|
||||
check_http: Docs: make -C obvious (by @stblassitude #1554)
|
||||
check_ifoperstatus: Re-attach a comment to where it actually belongs (by @peternewman #1699)
|
||||
check_ircd: Restrict the nickname length of the test user for check_ircd (by @RincewindsHat #1710)
|
||||
check_load: Check load compiler warnings (by @RincewindsHat #1759)
|
||||
check_log: Modernize check log (by @RincewindsHat #1692)
|
||||
check_mailq: remove duplicate W=i/C=i args in check_mailq.pl (by @ichdasich #1755)
|
||||
check_ntp: Check ntp remove unused variables (by @RincewindsHat #1781)
|
||||
check_pgsql: Using snprintf which honors the buffers size and guarantees null termination. (Closes: #1601) (by @waja #1663)
|
||||
check_procs: Fix double percentage sign in usage (by @RincewindsHat #1743)
|
||||
check_sensors.sh: Make shellcheck happier (by @RincewindsHat #1679)
|
||||
check_snmp: Fixed option description authpassword -> authpasswd + whitespaces (by @RincewindsHat #1676)
|
||||
check_swap: Check swap compiler warnings (by @RincewindsHat #1756)
|
||||
|
||||
2.3.1 10 April 2021
|
||||
ENHANCEMENTS
|
||||
check_curl: Add an option to verify the peer certificate & host using the system CA's
|
||||
|
||||
FIXES
|
||||
check_icmp: fix simple typo, conspicuosly -> conspicuously
|
||||
check_curl: fixed help, usage and errors for TLS 1.3
|
||||
check_curl: fixed a potential buffer overflow in url buffer
|
||||
check_dns: split multiple IP addresses passed in one -a argument
|
||||
check_curl: added string_statuscode function for printing HTTP/1.1 and HTTP/2 correctly
|
||||
check_curl: fix crash if http header contains leading spaces
|
||||
check_curl: display a specific human-readable error message where possible
|
||||
check_pgsql: Using snprintf which honors the buffers size and guarantees null termination.
|
||||
check_snmp: put the "c" (to mark a counter) after the perfdata value
|
||||
check_http: Increase regexp limit
|
||||
check_http: make -C obvious
|
||||
check_curl: Increase regexp limit (to 1024 as in check_http)
|
||||
check_curl: make -C obvious (from check_http)
|
||||
check_curl: backported --show-body/-B to print body (from check_http)
|
||||
|
||||
2.3 10th December 2020
|
||||
ENHANCEMENTS
|
||||
check_dns: allow 'expected address' (-a) to be specified in CIDR notation
|
||||
(IPv4 only).
|
||||
check_dns: allow for IPv6 RDNS
|
||||
check_dns: Accept CIDR
|
||||
check_dns: allow unsorted addresses
|
||||
check_dns: allow forcing complete match of all addresses
|
||||
check_dns: option to expect NXDOMAIN
|
||||
check_apt: add --only-critical switch
|
||||
check_apt: add -l/--list option to print packages
|
||||
check_file_age: add range checking
|
||||
check_file_age: enable to test for maximum file size
|
||||
check_apt: adding packages-warning option
|
||||
check_load: Adding top consuming processes option
|
||||
check_http: Adding Proxy-Authorization and extra headers
|
||||
check_snmp: make calculation of timeout value in help output more clear
|
||||
check_uptime: new plugin for checking uptime to see how long the system is running
|
||||
check_curl: check_http replacement based on libcurl
|
||||
check_http: Allow user to specify HTTP method after proxy CONNECT
|
||||
check_http: Add new flag --show-body/-B to print body
|
||||
check_cluster: Added data argument validation
|
||||
check_icmp: Add IPv6 support
|
||||
check_icmp: Automatically detect IP protocol
|
||||
check_icmp: emit error if multiple protocol version
|
||||
check_disk: add support to display inodes usage in perfdata
|
||||
check_hpjd: Added -D option to disable warning on 'out of paper'
|
||||
check_http: support the --show-body/-B flag when --expect is used
|
||||
check_mysql: allow mariadbclient to be used
|
||||
check_tcp: add --sni
|
||||
check_dns: detect unreachable dns service in nslookup output
|
||||
|
||||
FIXES
|
||||
Fix regression where check_dhcp was rereading response in a tight loop
|
||||
check_dns: fix error detection on sles nslookup
|
||||
check_disk_smb: fix timeout issue
|
||||
check_swap: repaired "-n" behaviour
|
||||
check_icmp: Correctly set address_family on lookup
|
||||
check_icmp: Do not overwrite -4,-6 on lookup
|
||||
check_smtp: initializes n before it is used
|
||||
check_dns: fix typo in parameter description
|
||||
check_by_ssh: fix child process leak on timeouts
|
||||
check_mysql: Allow sockets to be specified to -H
|
||||
check_procs: improve command examples for 'at least' processes
|
||||
check_swap: repaired "-n" behaviour
|
||||
check_disk: include -P switch in help
|
||||
check_mailq: restore accidentally removed options
|
||||
|
||||
2.2 29th November 2016
|
||||
ENHANCEMENTS
|
||||
The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2"
|
||||
to force TLSv1.1 and TLSv1.2 connections, respectively
|
||||
The check_http -S/--ssl option now allows for specifying the desired
|
||||
protocol with a "+" suffix to also accept newer versions
|
||||
Let check_http check HTTPS web sites via proxies
|
||||
check_http: add timeout to performance data as max value
|
||||
check_http: report certificate expiry date in UTC
|
||||
check_snmp: add IPv6 support
|
||||
check_snmp's performance data now also includes warning/critical
|
||||
thresholds
|
||||
New check_snmp -N option to specify SNMPv3 context name
|
||||
Let check_smtp's -D option imply -S
|
||||
Let check_smtp's -e option match against the full SMTP response
|
||||
check_dig: expected response is now case-insensitive
|
||||
New check_mailq -s option which tells the plugin to use sudo(8)
|
||||
New check_nt -l parameters: seconds|minutes|hours|days
|
||||
New -W/-C option for check_ldap to check number of entries
|
||||
check_users: add support for range thresholds
|
||||
check_fping now auto-detects IPv6 addresses
|
||||
check_radius now supports the radcli library
|
||||
Support OpenSSL 1.1
|
||||
|
||||
FIXES
|
||||
check_http: fix host header port handling
|
||||
Let check_real terminate lines with CRLF when talking to the server, as
|
||||
mandated by RFC 2326
|
||||
Fix check_procs on HP-UX
|
||||
check_smtp's -e/--expect option can now be combined with -S/--starttls
|
||||
Fix incorrect performance data thresholds emitted by check_ups
|
||||
Don't let check_procs miss some processes on busy Solaris systems
|
||||
|
||||
WARNINGS
|
||||
The format of the performance data emitted by check_mrtgtraf has been
|
||||
changed to comply with the development guidelines
|
||||
check_ssh now returns CRITICAL for protocol/version errors
|
||||
If a plugin is invoked with -h/--help or -V/--version, the exit status
|
||||
is now UNKNOWN
|
||||
The superseded check_ntp.pl was removed, please use check_ntp_peer or
|
||||
check_ntp_time instead
|
||||
|
||||
2.1.2 16th October 2015
|
||||
FIXES
|
||||
Fix incorrect performance data thresholds emitted by check_ups
|
||||
Fix check_dhcp's option parsing to not crash with certain arguments
|
||||
Fix check_snmp using correct timeout
|
||||
|
||||
2.1.1 2nd December 2014
|
||||
FIXES
|
||||
Fix check_ntp's jitter checking
|
||||
Fix check_ntp's handling of invalid server responses
|
||||
Fix check_apt's handling of invalid regular expressions
|
||||
Fix check_real's server response processing
|
||||
Fix backslash escaping in check_tcp's --help output
|
||||
|
||||
2.1 15th October 2014
|
||||
ENHANCEMENTS
|
||||
New check_hpjd -p option for port specification
|
||||
New ./configure --with-qmail-qstat-command option to specify the path to
|
||||
qmail-qstat(8)
|
||||
New check_ifstatus -n option to ignore interfaces by name
|
||||
check_ntp_peer has now specific state output for each metric
|
||||
New check_mysql -n option to ignore authentication failures
|
||||
Added IP and port or socket name to error messages
|
||||
New check_ntp_time -o option to add expected offset
|
||||
check_disk shows now troubled partitions in verbose mode
|
||||
check_dig has now support for drill and dig
|
||||
check_dig has now support for -6 option
|
||||
Add performance data to check_file_age
|
||||
|
||||
FIXES
|
||||
Fix check_jabber to work with Openfire servers
|
||||
Fix check_oracle bad string matching when testing TNS server
|
||||
Fixed check_ifstatus performance data output
|
||||
Fixed expire time output for sslutils
|
||||
check_dns now verifies if the answer is returning from the queried
|
||||
server
|
||||
Fix check_by_ssh to accept --hostname as argument
|
||||
|
||||
WARNINGS
|
||||
This release doesn't ship with an RPM spec file, please contribute to
|
||||
PR #1283 if you are interested in it
|
||||
|
||||
2.0 11th July 2014
|
||||
ENHANCEMENTS
|
||||
check_mailq now supports auto detection of qmail, postfix, exim and nullmailer with
|
||||
fallback to sendmail
|
||||
check_ide_smart now defaults to plugin output, original output appended with -v
|
||||
Extra-Opts are now enabled by default, see:
|
||||
https://www.monitoring-plugins.org/doc/extra-opts.html
|
||||
check_swap now supports a configurable state when there is no swap
|
||||
check_radius now supports the FreeRADIUS Client library
|
||||
New check_mysql_query -f option to specify a client options file
|
||||
New check_mysql_query -g option to specify a client options group
|
||||
Add performance data to check_mysql_query
|
||||
New check_file_age -i/--ignore-missing option to return OK on nonexistent files
|
||||
Make check_ping, check_users, and check_disk work on Windows
|
||||
New check_ssh -P option to specify the expected SSH protocol version
|
||||
check_dns now emits the warning and critical thresholds with the performance data
|
||||
|
||||
FIXES
|
||||
Don't let e.g. check_http's -C option reset SSL version if e.g. -S 1 -C 5 is specified
|
||||
Don't have check_http's -N option expect an argument
|
||||
check_ide_smart could disable offline auto tests but could not re-enable them.
|
||||
For this reason all SMART command modes have been disabled.
|
||||
check_dig: fix wrong IPv6 arguments order
|
||||
check_dig: make sure not to give up too early when a timeout is specified with -t
|
||||
check_log: don't stumble over log lines that include a "%" character
|
||||
check_nt: add UPTIME to perfdata
|
||||
Handle SNMPv3 noAuthNoPriv properly with check_snmp
|
||||
Fix compilation with GnuTLS
|
||||
|
||||
WARNINGS
|
||||
New default installation prefix: /usr/local instead of /usr/local/nagios
|
||||
check_snmp now evaluates negative values properly, which means it might return CRITICAL
|
||||
in cases where it used to return OK. If this is undesired, the warning/critical
|
||||
threshold(s) must be fixed by specifying e.g. ~:100 instead of 100
|
||||
check_procs now ignores its parent process to avoid unexpected results when invoked via
|
||||
certain shells
|
||||
utils.sh no longer defines ECH
|
||||
check_ide_smart -q/--quiet and -n/--nagios (Nagios-compatible output) are now deprecated
|
||||
but accepted for backward-compatibility
|
||||
check_ide_smart -0/--auto-off, -1/--auto-on and -i/--immediate: options have
|
||||
been disabled because they were broken
|
||||
State retention: the NAGIOS_PLUGIN_STATE_DIRECTORY environment variable has been
|
||||
renamed MP_STATE_PATH. The old variable will continue to work in v2.0.x
|
||||
Add the UID of the invoking user to the state retention file path. This helps solving
|
||||
permission issues when different users run the same plugin
|
||||
check_swap used to allow returning OK on a system without swap when only percent thresholds
|
||||
were used. This is no longer the case and one must now use -n/--no-swap=<state>
|
||||
The Perl and Shell plugins now use the PATH specified via ./configure's --trusted-path
|
||||
option, or "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" by default
|
||||
|
||||
1.5 2nd October 2013
|
||||
ENHANCEMENTS
|
||||
New check_dbi plugin for checking an (SQL) database using DBI
|
||||
Let OpenSSL load its configuration file (see the OPENSSL_config(3) man page)
|
||||
Add performance data to check_apt
|
||||
Add performance data to check_procs
|
||||
Added -4/-6 options to check_dig
|
||||
New check_oracle --connect option to perform real login
|
||||
New check_nagios -t option to override the default timeout
|
||||
New check_disk -f/--freespace-ignore-reserved option to ignore space reserved for root
|
||||
New check_disk -N/--include-type option to limit the filesystem types to check
|
||||
Allow for building the plugins in parallel
|
||||
Add --without-{dbi,ldap,radius} options to ./configure
|
||||
Made Verbose output of check_sensors compliant
|
||||
New switch -E/--extended-perfdata for check_http to print additional performance data
|
||||
New check_http -d option to specify a string to expect within the response headers
|
||||
New check_http -J/-K options for client certificate authentication support
|
||||
Add support for executing queries to check_pgsql
|
||||
Let check_pgsql accept a UNIX socket directory as hostname
|
||||
New check_pgsql -o option to specify additional connection parameters
|
||||
New check_fping -S option to specify the source IP address
|
||||
New check_fping -I option to specify the interface to bind to
|
||||
Let check_fping support IPv6
|
||||
New check_procs -k option to ignore kernel threads (on Linux)
|
||||
Let check_procs use /proc/<PID>/exe (if available) instead of getpid(2), unless -T is specified
|
||||
Let check_mysql support SSL
|
||||
Let check_mysql add performance metrics for all checks
|
||||
New check_mysql -f option to specify a client options file
|
||||
New check_mysql -g option to specify a client options group
|
||||
New check_snmp --offset option to allow for adding/subtracting an offset value to sensor data
|
||||
Let check_snmp support an arbitrary number of OIDs
|
||||
Let check_ide_smart support NetBSD
|
||||
|
||||
FIXES
|
||||
Change the MAIL FROM command generated by check_smtp to be RFC compliant
|
||||
Fix compilation of check_http without SSL support
|
||||
Fix check_snmp reversed threshold ranges (backward-compatibility)
|
||||
Fix check_snmp memory violation when using more than 8 oids
|
||||
Fix check_apt security regular expression
|
||||
Fix check_http handling extra header (-k) containing semicolons
|
||||
Fix check_apt handling unknown exit codes from apt-get
|
||||
Fix deprecated imports of check_nmap.py
|
||||
|
||||
WARNINGS
|
||||
check_http behaviour of -k/--header changed since it does not separate multiple headers by semicolons anymore. Use multiple -k switches instead.
|
||||
check_http's --proxy_authorization option is now called --proxy-authorization (it was always documented this way)
|
||||
The contrib directory has been removed from this distribution
|
||||
|
||||
1.4.16 27th June 2012
|
||||
ENHANCEMENTS
|
||||
check_nt UPTIME accepts warning/critical thresholds
|
||||
check_disk_smb now allows spaces in share names (#990948, #1370031, Debian #601699)
|
||||
check_http now uses standard threshold functions (enables floating point and ranges)
|
||||
check_http now checks for and prints the certificate cn (hostname) in SSL certificate checks
|
||||
check_http now supports an optional -S/--ssl value to choose the SSL protocol version (#3066166)
|
||||
Add perfdata to check_ssh (#3244097)
|
||||
New option to check_smtp to ignore failures when sending QUIT (#3358348)
|
||||
New check_by_ssh -F option which allows for specifying an alternative ssh_config(5) file (#2895334)
|
||||
check_sensors now detects faulty sensors unless --ignore-fault is specified
|
||||
utils.sh now provides a check_range function
|
||||
Improved the performance of check_users
|
||||
Add perfdata to check_disk_smb (Debian #654259)
|
||||
Updated Nagios::Plugin perl module
|
||||
Add warning threshold to certificate expiration checks of check_tcp/http/smtp
|
||||
Add --perf-oids option for check_snmp
|
||||
|
||||
FIXES
|
||||
Fix check_disk free space calculation if blocksizes differ within a disk group (#2973603)
|
||||
check_disk_smb now handles NT_STATUS_ACCESS_DENIED properly (Debian #601696)
|
||||
Make check_snmp work more like v1.4.14 with regard to using special values (Timeticks, STRING) as numeric thresholds
|
||||
Fix check_ldap overriding the port when --ssl was specified after -p
|
||||
Fix check_procs where regex input of '|' would get displayed in output - now replaced with ','
|
||||
Fix segfault in check_host when hostname returns multiple IP addresses
|
||||
Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors
|
||||
Fix check_ping's parsing of ping6(1) output (#1894850, Debian #514588, Debian #662638)
|
||||
Fix a check_dhcp bug which was triggered by checking Windows 2003 DHCP servers (#3503921)
|
||||
Disable RFC4507 support, to work around SSL negotiation issues with (at least) some Tomcat versions
|
||||
Fix performance data label containing spaces in check_snmp
|
||||
|
||||
1.4.15 27th July 2010
|
||||
ENHANCEMENTS
|
||||
New check_ntp_peer -m and -n options to check the number of usable time sources ("truechimers")
|
||||
New check_disk_smb -a option which allows for specifying the IP address of the remote server
|
||||
New check_radius -N option which allows for specifying the value of the NAS-IP-Address attribute
|
||||
New check_snmp --rate option to store differences between invocations. Saves state in PREFIX/var/{plugin}
|
||||
check_snmp -l label option now also changes the perfdata label. See WARNINGS
|
||||
check_snmp has an --invert-search option which reverses status of the string and regexp searches
|
||||
check_http now displays the missing search string and the URL in the output when failed (#2999924)
|
||||
Updated Nagios::Plugin perl module
|
||||
Updated gnulib to June 2010
|
||||
|
||||
FIXES
|
||||
Fix check_ircd binding to wrong interface (#668778)
|
||||
Add proxy-authorization option to check_http (#1323230, #2863925)
|
||||
check_icmp now increment the sequence counter in each packet
|
||||
Fix usage of repeated -o options in check_snmp
|
||||
Try to detect arguments passed via --with-ping[6]-command and set options accordingly (#2908236)
|
||||
Fix memory leak in check_http for large pages (#2957455)
|
||||
Fix compilation with GCC 2.96 (#2977105)
|
||||
Fix regression introduced in #1867716 where partially valid performance strings would not be printed anymore
|
||||
Fix regression in check_http ssl checks on some servers - make SNI an option
|
||||
Fix guest mode support in check_disk_smb
|
||||
Fix check_disk_smb and check_ircd failures when run via ePN
|
||||
check_ldap now allows for specifying an empty LDAP base
|
||||
Fix compilation error of pst3 in Solaris 8
|
||||
Fix check_radius returning OK on unexpected results (#2911752)
|
||||
Fix translations when extra-opts aren't enabled (#2832884)
|
||||
Fix parsing of multi-line strings in check_snmp (broken in 1.4.14) and enhance output in such case (#2832451)
|
||||
Fix detection of pst3 64-bit compile flags with Sun CC
|
||||
Fix cmd_run overwriting the environment, which would break some commands that needed it
|
||||
Allow check_ifstatus to accept version=2c - used to only allow version=2
|
||||
Fix examples in check_disk, where it implied was possible to suffix unit values to warn/crit parameters
|
||||
|
||||
WARNINGS
|
||||
Updated developer documentation to say that performance labels should not have an equals sign or
|
||||
single quote in the label
|
||||
check_http 1.4.14 introduced SSL SNI support - you now have to enable it explicitly with "--sni"
|
||||
check_snmp -l label option is also used for the performance label. This could change history from previous uses
|
||||
|
||||
1.4.14 16th September 2009
|
||||
check_http has options to specify the HTTP method (#2155152)
|
||||
check_users thresholds were not working exactly as documented (>= rather than >)
|
||||
Updated tinderbox_build script to point to new tinderbox server
|
||||
check_ifoperstatus -n flag now works as expected (#1569488)
|
||||
check_ifoperstatus now supports ifType based lookup for ifIndex
|
||||
check_ups now sends a LOGOUT string (Debian #387001)
|
||||
Extra-opts (C plugins) now allows both '#' and ';' for comments (like N::P)
|
||||
Extra-opts (C plugins) does not allow trailing comments anymore (like N::P)
|
||||
Fixed dependency issue on libtap when ./configure --enable-libtap used. Warning: will install libtap
|
||||
Fixed segfault in extra-opts under some circumstance when reading multiple sections
|
||||
Fix long options parsing in check_disk, check_dns, check_mrtg, check_mrtgtraf and check_tcp
|
||||
Add missing long options for check_nt (for use with extra-opts)
|
||||
check_icmp now reports min and max round trip time perfdata
|
||||
Fixed check_http bug where additional headers with redirection caused a segfault (2089159)
|
||||
check_disk: make autofs mount paths specified with -p before we determine the mount list
|
||||
Fixed buffer overflow in check_ntp/check_ntp_peer (#1999319, Ubuntu #291265)
|
||||
Re-bundled libtap as a built-in library (--enable-libtap): detects system library as pre-1.4.13 and does not install the built-in library anymore
|
||||
Fixed check_mrtg returning UNKNOWN instead of OK (#2378068)
|
||||
Fixed check_http behaviour: all check are now performed as long as a valid response is returned (#1460312)
|
||||
check_http --onredirect=sticky follows using the same IP address (#2550208)
|
||||
check_http --onredirect=stickyport also follows the same port
|
||||
Fixed coredump from check_nt when invalid drive is specified (#2179754)
|
||||
Fixed crash from check_nt when -H unspecified or given multiple times (#2731755, Debian #521097)
|
||||
Fixed passing of quotes in OID for check_snmp (#1985230)
|
||||
Fixed check_http sending HTTP/1.0 with v1.1 headers (#2638765)
|
||||
Fixed check_http not timing-out on redirects
|
||||
Fixed negate not printing the real timeout in ALRM handler when left to default
|
||||
negate timeout result is now configurable
|
||||
Fixed segfault in check_mysql with old slaves (#2696823)
|
||||
check_nt can return UNKNOWN on timeouts (-u)
|
||||
Fixed typos for check_disk
|
||||
Fixed check_mysql* not using password set in my.cnf (#2531905) - Specify an empty password explicitly if you need to override it.
|
||||
Fixed awk subst.in/subst script path error (#2722832)
|
||||
check_http: Add SSL/TLS hostname extension support (SNI) - (#1939022)
|
||||
Fixed wrong perfdata label for output traffic in check_mrtgtraf (#2654308)
|
||||
Fixed check_by_ssh interpretation of quotes in -C parameter (#1985246, #2268675)
|
||||
check_snmp now supports standard threshold ranges and doubles (floating numbers) in thresholds
|
||||
check_fping now supports passing target timeout and interval to fping (#2347686)
|
||||
Fixed SNMPv3 behaviour of check_ifoperstatus and check_ifstatus. Added -P to define privprotocol (#2343438)
|
||||
check_ifoperstatus and check_ifstatus are now more user-friendly in case of missing arguments
|
||||
pst3 compile fix for Sun Studio Compiler
|
||||
|
||||
1.4.13 25th Sept 2008
|
||||
Fix Debian bug #460097: check_http --max-age broken
|
||||
Optimised pst3 for systems with large number of processes
|
||||
Updated Nagios::Plugin to 0.27
|
||||
Fix Debian bug #479013: check_dig's -l is mandatory now (#1986306)
|
||||
check_dig now returns CRITICAL instead of WARNING when no answer section is found
|
||||
check_procs now captures stderr in external command and adds to plugin output
|
||||
check_snmp now only prints perfdata for non numeric values (#1867716)
|
||||
check_icmp now supports packet size modification
|
||||
check_http -e now accepts a comma-delimited list of expected status codes
|
||||
libtap now included with this distribution for easier testing. Run ./configure with --enable-libtap
|
||||
check_ntp_peer/check_ntp_time used to show port in --help but ignored the argument - now implemented
|
||||
Fix possible segfault in check_ntp_peer with deliberately invalid packets
|
||||
|
||||
1.4.12 27th May 2008
|
||||
Added ./check_nt -v INSTANCES to count number of instances
|
||||
New check_icmp -s option to specify the source IP address
|
||||
check_dns now sorts addresses for testing results for more than one returned IP
|
||||
Fix segfault in check_ntp_time and (deprecated) check_ntp (#1862300)
|
||||
check_disk should now work with large file systems (2TB+) on all archs that supports it
|
||||
Fixed check_disk disk usage calculation when using --group=NAME (related to #1348746)
|
||||
Fix help text of check_ntp* (#1880095)
|
||||
Fix bugs and flaws in best offset server selection of check_ntp_time and (deprecated) check_ntp
|
||||
check_ntp_peer now checks for the LI_ALARM flag
|
||||
Sync to latest Gnulib (includes new floorf function)
|
||||
check_pgsql now successfully builds with postgres lib v8.3 (#1878972)
|
||||
check_procs now accepts --ereg-argument-array for a regular expression match to the argument array
|
||||
Reverted back to using pst3 for Solaris systems. Fixed issues re: -m64 needed to compile on 64bit systems
|
||||
If applicable, Gettext linked dynamically instead of statically
|
||||
check_dig can now pass arguments to dig by using -A/--dig-arguments (#1874041/#1889453)
|
||||
check_ntp and check_ntp_peer now show proper jitter/stratum thresholds longopts in --help
|
||||
check_dns now allow to repeat -a to match multiple possibly returned address (common with load balancers)
|
||||
check_mysql and check_radius now try clearing password in processlist just like check_mysql_query
|
||||
check_mysql and check_mysql_query now support sockets explicitly (-s, --socket)
|
||||
negate now has the ability to replace the status text as well (-s, --substitute)
|
||||
Added performance data to check_ping
|
||||
Added support for --extra-opts in all C plugins (disabled by default, see configure --help)
|
||||
Fixed passive option in check_by_ssh
|
||||
On non-skipped stderr, check_by_ssh now returns UNKNOWN or worse (result from command) instead of always UNKNOWN.
|
||||
Fix linking against OpenSSL where libdl is required
|
||||
|
||||
1.4.11 13th December 2007
|
||||
Fixed check_http regression in 1.4.10 where following redirects to
|
||||
relative URLs on virtual hosts failed if both "-H" and "-I" were used
|
||||
Merged two new checks that deprecates check_ntp: check_ntp_peer and check_ntp_time.
|
||||
You should read the --help output so see which one is suitable for you. check_ntp_peer
|
||||
implement stratum thresholds support (feature request #1703823).
|
||||
check_ntp now returns UNKNOWN instead of WARNING if jitter is unavailable (jitter=-1.000000)
|
||||
as long as the thresholds range include -1. If no offset threshold is specified
|
||||
and the offset is unavailable, will return UNKNOWN as well.
|
||||
NOTE: If jitter thresholds are specified as integers it will return CRITICAL if jitter
|
||||
is "-1" as the default range starts at 0. See Examples in --help output.
|
||||
Fixed broken usage2 in check_snmp and check_cluster
|
||||
check_cluster now accepts all valid characters in its thresholds ("-", "@", "~")
|
||||
Fixed check_disk reporting OK if disk usage grows over 100% (#1348746).
|
||||
The problem happens to be in Gnulib but a workaround have been implemented in check_disk.c
|
||||
Fixed check_load argument handling when not passing triplets (#1831890)
|
||||
Fixed buffer overflow in check_snmp (CVE-2007-5623)
|
||||
Tinderbox builds now runs tests in a verbose mode
|
||||
Updated Nagios::Plugin to 0.22
|
||||
VPATH problem fixed for compiling plugins-root
|
||||
|
||||
1.4.10 28th September 2007
|
||||
Fix check_http buffer overflow vulnerability when following HTTP redirects (CVE-2007-5198)
|
||||
check_http now explicitly asks HTTP/1.1 servers to close the connection
|
||||
after completion of the response
|
||||
Check_ldaps' guessing which secure method to use (starttls vs. ssl on connect)
|
||||
is now deprecated. See --help for further information.
|
||||
Check_disk now calls stat() on all filesystems to check. (Old: only the ones selected using -p)
|
||||
A meaningful error message (eg "Stale NFS Handle") is printed if stat fails.
|
||||
New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too.
|
||||
Thus accessibility of remote filesystems can be checked without any threshold comparison.
|
||||
Check_disk's --help now prints some examples for the new features introduced in 1.4.8
|
||||
New check_disk -i/-I option to ignore paths/partitions based on regular expressions
|
||||
New check_disk -A option to select all filesystems explicitly
|
||||
WARNING: check_disk's -E option must now be passed before -p or -r/-R arguments
|
||||
Passing -E after -p or -r results in UNKNOWN state, now
|
||||
This is needed due to the new ignore feature
|
||||
Fix check_disk bug when mixing case sensitive and case insensitive regex arguments
|
||||
New check_dhcp -u/--unicast option for emulating a DHCP relay in order
|
||||
to check DHCP servers on remote networks
|
||||
New check_dhcp -m/--mac option which allows for specifying the MAC
|
||||
address to use in the DHCP request
|
||||
The check_dhcp -r and -s options now accept host names, too
|
||||
Fix possible check_icmp bus errors on some (non-x86/AMD64) platforms
|
||||
Fix check_smtp's handling of multiple-packet server responses
|
||||
WARNING: Fix for negate which may break existing commands:
|
||||
- stop evaluating command line options through shell twice
|
||||
- enforce a full path for the command to run
|
||||
The "negate" utility can now remap custom states
|
||||
Check_radius now supports radiusclient-ng
|
||||
The (undocumented) positional parameter parsing which check_radius used
|
||||
instead of getopt(3) if 8 arguments were given is no longer available
|
||||
Check_by_ssh now supports multiline output
|
||||
IPv6 support can now be disabled using ./configure --without-ipv6
|
||||
Fix check_ntp now honor ntp flags
|
||||
|
||||
1.4.9 4th June 2007
|
||||
Inclusion of contrib/check_cluster2 as check_cluster with some improvements
|
||||
New/improved -E/--skip-stderr and -S/--skip-stdout options for check_by_ssh
|
||||
check_snmp now supports Counter64
|
||||
Fix compilation of check_ldap, check_radius and check_pgsql
|
||||
check_load can optionally divide by number of cpus
|
||||
Fix check_time returning wrong OK when time is before the epoch on some arch
|
||||
Make check_http output more consistent
|
||||
Fix possible check_http segfaults when following HTTP redirects
|
||||
check_snmp don't warn anymore if something is printed on stderr
|
||||
Fix check_tcp segfault when multiple expect strings are given
|
||||
New option for check_tcp: -A/--all to test if all given expect strings match
|
||||
|
||||
1.4.8 11th April 2007
|
||||
Respects --without-world-permissions for setuid plugins
|
||||
check_disk extra options for regex matching of filesystems and grouping of filesystems
|
||||
for collective thresholds
|
||||
Better configure test for mysqlclient availability
|
||||
Various check_ntp fixes
|
||||
|
||||
1.4.7 29th March 2007
|
||||
check_procs uses /usr/ucb/ps if available - fixes pst3 problems on Solaris
|
||||
Fixed MKINSTALLDIRS problem in po/
|
||||
./configure now detects if possible to compile check_mysql
|
||||
Fixed broken HELO in check_smtp
|
||||
check_icmp now allows to set a minimum number of hosts required for success (-m)
|
||||
check_icmp fix for *BSD when running for long time
|
||||
check_ping times out 1 second quicker if host is unreachable
|
||||
Root plugins installed with world executable
|
||||
check_sybase from contrib now maintained in MonitoringExchange
|
||||
--with-nagios-user/group reinstated ./configure option
|
||||
New --without-world-permissions ./configure option
|
||||
|
||||
1.4.6 5th February 2007
|
||||
Reduced number of DNS lookups in check_ping and netutils.c for IPv6 configurations
|
||||
Fixed compile problems with *BSD re: alloca.h
|
||||
Fixed Solaris problems with check_swap (tested on Solaris 9)
|
||||
Fixed check_swap for HP/UX where swapinfo command was incorrect
|
||||
Fixed check_disk inode threshold checks, regressed at r1.4.4.
|
||||
Fixed crit/warn for check_disk perf data
|
||||
Fixed buffer overflow in check_procs
|
||||
Fixed error handling for UNIX sockets in netutils.c
|
||||
New -q and -o options for check_by_ssh which are handed over to ssh(1) as is
|
||||
Synced with latest GNUlib
|
||||
Fixed check_jabber always returns warning
|
||||
|
||||
1.4.5
|
||||
Fixed bug in perl's is_hostname routine
|
||||
|
||||
1.4.4
|
||||
New C based check_ntp. The perl version is now deprecated.
|
||||
New check_apt plugin
|
||||
Notice: plugins in contrib/ will start to be removed from this distribution.
|
||||
Please check at http://www.monitoringexchange.org for contributed plugins
|
||||
Major bug fixes to check_disk where values were incorrectly calculated and alerted on.
|
||||
check_udp2 removed. check_udp is now linked to check_tcp.c
|
||||
check_mailq now errors if the sub-program run returns non-zero return code. This would appear
|
||||
as if mailqs were okay when the nagios user could not query the mail-queues
|
||||
Compile problems with check_snmp fixed
|
||||
|
||||
1.4.3
|
||||
Setuid plugins (check_dhcp, check_icmp) separated into plugins-root/. Run make install as root to install
|
||||
SSL plugins work with gnutls as well as OpenSSL
|
||||
check_mysql_query added to run arbitrary SQL commands, with threshold checking
|
||||
libtool now required for development systems
|
||||
Notice: check_udp (compiled from check_udp.c) will be deprecated in the next release.
|
||||
check_udp2 should be used instead and will be renamed to check_udp
|
||||
|
||||
1.4.2
|
||||
Fix for Redhat ES4 for check_dns and check_dig
|
||||
|
||||
1.4
|
||||
IPv6 support in check_ping, check_by_ssh, check_http, check_ldap, check_smtp, check_tcp
|
||||
Internationalisation support
|
||||
Performance data added to most plugins
|
||||
check_disk now using GNU coreutils code
|
||||
New plugins - check_dhcp, check_icmp
|
||||
contrib/check_citrix has been replaced by contrib/check_ica* (requires packet_utils.pm in libexec)
|
||||
check_http --min changed to --pagesize, added max so min:max in check
|
||||
check_vsz and check_rss deprecated - functionality moved into check_procs
|
||||
check_swap % thresholds changed to measure amount free, instead of amount used
|
||||
check_disk syntax changes for -p, -m/-M, defaults to MB instead of kB
|
||||
check_procs -C expects no path for the command name
|
||||
New in 1.2.9:
|
||||
* Added support for multiplatform builds
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This is from the Git repository (GIT-VERSION-GEN with modifications)
|
||||
#
|
||||
|
||||
SRC_ROOT=`dirname $0`
|
||||
|
||||
NPVF=NP-VERSION-FILE
|
||||
DEF_VER=3.0.0git
|
||||
|
||||
LF='
|
||||
'
|
||||
|
||||
# First try git-describe, then svn info, then default.
|
||||
if test -d $SRC_ROOT/.git -o -f $SRC_ROOT/.git &&
|
||||
VN=`cd $SRC_ROOT; git describe --abbrev=4 HEAD 2>/dev/null` &&
|
||||
case "$VN" in
|
||||
*$LF*) (exit 1) ;;
|
||||
release-[0-9]*)
|
||||
git update-index -q --refresh
|
||||
test -z "`git diff-index --name-only HEAD --`" ||
|
||||
VN="$VN-dirty" ;;
|
||||
esac
|
||||
then
|
||||
VN=`echo "$VN" | sed -e 's/^release-//' | sed -e 's/-/./g'`;
|
||||
elif test -d $SRC_ROOT/.svn -o -f $SRC_ROOT/.svn &&
|
||||
VN=`cd $SRC_ROOT; svn info 2>/dev/null | grep '^Revision'` &&
|
||||
case "$VN" in
|
||||
*$LF*) (exit 1) ;;
|
||||
Revision:*)
|
||||
VN=`echo $VN | awk '{print $NF}'`
|
||||
test "`svn status 2>/dev/null | grep '^[AMD]' | wc -l | tr -d ' '`" = 0 ||
|
||||
VN="$VN-dirty" ;;
|
||||
esac
|
||||
then
|
||||
VN=`echo "trunk.$VN" | sed -e 's/-/./g'`;
|
||||
else
|
||||
VN="$DEF_VER"
|
||||
fi
|
||||
|
||||
VN=`expr "$VN" : v*'\(.*\)'`
|
||||
|
||||
if test -r $NPVF
|
||||
then
|
||||
VC=`sed -e 's/^NP_VERSION = //' <$NPVF`
|
||||
else
|
||||
VC=unset
|
||||
fi
|
||||
test "$VN" = "$VC" || {
|
||||
echo >&2 "NP_VERSION = $VN"
|
||||
echo "NP_VERSION = $VN" >$NPVF
|
||||
}
|
||||
|
||||
386
NPTest.pm
386
NPTest.pm
|
|
@ -1,12 +1,12 @@
|
|||
package NPTest;
|
||||
|
||||
#
|
||||
# Helper Functions for testing Monitoring Plugins
|
||||
# Helper Functions for testing Nagios Plugins
|
||||
#
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(getTestParameter checkCmd skipMissingCmd skipMsg);
|
||||
@EXPORT = qw(getTestParameter checkCmd skipMissingCmd);
|
||||
@EXPORT_OK = qw(DetermineTestHarnessDirectory TestsFrom SetCacheFilename);
|
||||
|
||||
use strict;
|
||||
|
|
@ -15,33 +15,31 @@ use warnings;
|
|||
use Cwd;
|
||||
use File::Basename;
|
||||
|
||||
use JSON;
|
||||
|
||||
use IO::File;
|
||||
use Data::Dumper;
|
||||
|
||||
use Test;
|
||||
|
||||
use vars qw($VERSION);
|
||||
$VERSION = "1556."; # must be all one line, for MakeMaker
|
||||
$VERSION = do { my @r = (q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NPTest - Simplify the testing of Monitoring Plugins
|
||||
NPTest - Simplify the testing of Nagios Plugins
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This modules provides convenience functions to assist in the testing
|
||||
of Monitoring Plugins, making the testing code easier to read and write;
|
||||
of Nagios Plugins, making the testing code easier to read and write;
|
||||
hopefully encouraging the development of a more complete test suite for
|
||||
the Monitoring Plugins. It is based on the patterns of testing seen in the
|
||||
the Nagios Plugins. It is based on the patterns of testing seen in the
|
||||
1.4.0 release, and continues to use the L<Test> module as the basis of
|
||||
testing.
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
This module defines four public functions, C<getTestParameter(...)>,
|
||||
C<checkCmd(...)>, C<skipMissingCmd(...)> and C<skipMsg(...)>. These are exported by
|
||||
This module defines three public functions, C<getTestParameter(...)>,
|
||||
C<checkCmd(...)> and C<skipMissingCmd(...)>. These are exported by
|
||||
default via the C<use NPTest;> statement.
|
||||
|
||||
=over
|
||||
|
|
@ -55,14 +53,25 @@ developer to interactively request test parameter information from the
|
|||
user. The user can accept the developer's default value or reply "none"
|
||||
which will then be returned as "" for the test to skip if appropriate.
|
||||
|
||||
If a parameter needs to be entered and the test is run without a tty
|
||||
attached (such as a cronjob), the parameter will be assigned as if it
|
||||
was "none". Tests can check for the parameter and skip if not set.
|
||||
If a parameter needs to be entered and the test is run without a tty
|
||||
attached (such as a cronjob), this routine will die causing the test to
|
||||
fail.
|
||||
|
||||
Responses are stored in an external, file-based cache so subsequent test
|
||||
runs will use these values. The user is able to change the values by
|
||||
amending the values in the file /var/tmp/NPTest.cache, or by setting
|
||||
the appropriate environment variable before running the test.
|
||||
Responses are stored in an external, file-based
|
||||
cache so subsequent test runs will use these values. The user is able
|
||||
to change the values by amending the values in the file /var/tmp/NPTest.pm,
|
||||
or by setting the appropriate environment variable before running the test.
|
||||
|
||||
The option exists to store parameters in a scoped means, allowing a
|
||||
test harness to a localise a parameter should the need arise. This
|
||||
allows a parameter of the same name to exist in a test harness
|
||||
specific scope, while not affecting the globally scoped parameter. The
|
||||
scoping identifier is the name of the test harness sans the trailing
|
||||
".t". All cache searches first look to a scoped parameter before
|
||||
looking for the parameter at global scope. Thus for a test harness
|
||||
called "check_disk.t" requesting the parameter "mountpoint_valid", the
|
||||
cache is first searched for "check_disk"/"mountpoint_valid", if this
|
||||
fails, then a search is conducted for "mountpoint_valid".
|
||||
|
||||
To facilitate quick testing setup, it is possible to accept all the
|
||||
developer provided defaults by setting the environment variable
|
||||
|
|
@ -83,7 +92,7 @@ Testing of results would be done in your test script, not in this module.
|
|||
This function is obsolete. Use C<testCmd()> instead.
|
||||
|
||||
This function attempts to encompass the majority of test styles used
|
||||
in testing Monitoring Plugins. As each plug-in is a separate command, the
|
||||
in testing Nagios Plugins. As each plug-in is a separate command, the
|
||||
typical tests we wish to perform are against the exit status of the
|
||||
command and the output (if any) it generated. Simplifying these tests
|
||||
into a single function call, makes the test harness easier to read and
|
||||
|
|
@ -123,7 +132,7 @@ of either C<Test::ok(...)> or C<Test::skip(...)>, so remember this
|
|||
when counting the number of tests to place in the C<Test::plan(...)>
|
||||
call.
|
||||
|
||||
Many Monitoring Plugins test network services, some of which may not be
|
||||
Many Nagios Plugins test network services, some of which may not be
|
||||
present on all systems. To cater for this, C<checkCmd(...)> allows the
|
||||
tester to define exceptions based on the command's exit status. These
|
||||
exceptions are provided to skip tests if the test case developer
|
||||
|
|
@ -153,14 +162,14 @@ of testing against a set of desired exit status values.
|
|||
=item *
|
||||
|
||||
Firstly, if C<$desiredExitStatus> is a reference to an array of exit
|
||||
statuses, if the actual exit status of the command is present in the
|
||||
stati, if the actual exit status of the command is present in the
|
||||
array, it is used in the call to C<Test::ok(...)> when testing the
|
||||
exit status.
|
||||
|
||||
=item *
|
||||
|
||||
Alternatively, if C<$desiredExitStatus> is a reference to a hash of
|
||||
exit statuses(mapped to the strings "continue" or "skip"), similar
|
||||
exit stati (mapped to the strings "continue" or "skip"), similar
|
||||
processing to the above occurs with the side affect of determining if
|
||||
any generated output testing should proceed. Note: only the string
|
||||
"skip" will result in generated output testing being skipped.
|
||||
|
|
@ -176,15 +185,6 @@ of times.
|
|||
|
||||
=back
|
||||
|
||||
=item C<skipMsg(...)>
|
||||
|
||||
If for any reason the test harness must C<Test::skip()> some
|
||||
or all of the tests in a given test harness this function provides a
|
||||
simple iterator to issue an appropriate message the requested number
|
||||
of times.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Test>
|
||||
|
|
@ -199,7 +199,7 @@ Copyright (c) 2005 Peter Bray. All rights reserved.
|
|||
|
||||
This package is free software and is provided "as is" without express
|
||||
or implied warranty. It may be used, redistributed and/or modified
|
||||
under the same terms as the Monitoring Plugins release.
|
||||
under the same terms as the Nagios Plugins release.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ under the same terms as the Monitoring Plugins release.
|
|||
|
||||
my( %CACHE ) = ();
|
||||
|
||||
# I'm not really sure whether to house a site-specific cache inside
|
||||
# I'm not really sure wether to house a site-specific cache inside
|
||||
# or outside of the extracted source / build tree - lets default to outside
|
||||
my( $CACHEFILENAME ) = ( exists( $ENV{'NPTEST_CACHE'} ) && $ENV{'NPTEST_CACHE'} )
|
||||
? $ENV{'NPTEST_CACHE'} : "/var/tmp/NPTest.cache"; # "../Cache.pdd";
|
||||
|
|
@ -240,26 +240,26 @@ sub checkCmd
|
|||
{
|
||||
if ( scalar( grep { $_ == $exitStatus } @{$desiredExitStatus} ) )
|
||||
{
|
||||
$desiredExitStatus = $exitStatus;
|
||||
$desiredExitStatus = $exitStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
$desiredExitStatus = -1;
|
||||
$desiredExitStatus = -1;
|
||||
}
|
||||
}
|
||||
elsif ( ref $desiredExitStatus eq "HASH" )
|
||||
{
|
||||
if ( exists( ${$desiredExitStatus}{$exitStatus} ) )
|
||||
{
|
||||
if ( defined( ${$desiredExitStatus}{$exitStatus} ) )
|
||||
{
|
||||
$testOutput = ${$desiredExitStatus}{$exitStatus};
|
||||
}
|
||||
$desiredExitStatus = $exitStatus;
|
||||
if ( defined( ${$desiredExitStatus}{$exitStatus} ) )
|
||||
{
|
||||
$testOutput = ${$desiredExitStatus}{$exitStatus};
|
||||
}
|
||||
$desiredExitStatus = $exitStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
$desiredExitStatus = -1;
|
||||
$desiredExitStatus = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,65 +304,77 @@ sub skipMissingCmd
|
|||
return $testStatus;
|
||||
}
|
||||
|
||||
sub skipMsg
|
||||
sub getTestParameter
|
||||
{
|
||||
my( $msg, $count ) = @_;
|
||||
my( $param, $envvar, $default, $brief, $scoped );
|
||||
my $new_style;
|
||||
if (scalar @_ <= 3) {
|
||||
($param, $brief, $default) = @_;
|
||||
$envvar = $param;
|
||||
$new_style = 1;
|
||||
} else {
|
||||
( $param, $envvar, $default, $brief, $scoped ) = @_;
|
||||
$new_style = 0;
|
||||
}
|
||||
|
||||
my $testStatus;
|
||||
# Apply default values for optional arguments
|
||||
$scoped = ( defined( $scoped ) && $scoped );
|
||||
|
||||
for ( 1 .. $count )
|
||||
my $testharness = basename( (caller(0))[1], ".t" ); # used for scoping
|
||||
|
||||
if ( defined( $envvar ) && exists( $ENV{$envvar} ) && $ENV{$envvar} )
|
||||
{
|
||||
$testStatus += skip( $msg, 1 );
|
||||
return $ENV{$envvar};
|
||||
}
|
||||
|
||||
return $testStatus;
|
||||
}
|
||||
|
||||
sub getTestParameter {
|
||||
my($param, $description, $default) = @_;
|
||||
|
||||
if($param !~ m/^NP_[A-Z0-9_]+$/mx) {
|
||||
die("parameter should be all uppercase and start with NP_ (requested from ".(caller(0))[1].")");
|
||||
}
|
||||
|
||||
return $ENV{$param} if $ENV{$param};
|
||||
|
||||
my $cachedValue = SearchCache($param);
|
||||
if(defined $cachedValue) {
|
||||
my $cachedValue = SearchCache( $param, $testharness );
|
||||
if ( defined( $cachedValue ) )
|
||||
{
|
||||
# This save required to convert to new style because the key required is
|
||||
# changing to the environment variable
|
||||
if ($new_style == 0) {
|
||||
SetCacheParameter( $envvar, undef, $cachedValue );
|
||||
}
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
if($ENV{'NPTEST_ACCEPTDEFAULT'}) {
|
||||
return $default if $default;
|
||||
return "";
|
||||
my $defaultValid = ( defined( $default ) && $default );
|
||||
my $autoAcceptDefault = ( exists( $ENV{'NPTEST_ACCEPTDEFAULT'} ) && $ENV{'NPTEST_ACCEPTDEFAULT'} );
|
||||
|
||||
if ( $autoAcceptDefault && $defaultValid )
|
||||
{
|
||||
return $default;
|
||||
}
|
||||
|
||||
# Set "none" if no terminal attached (eg, tinderbox build servers when new variables set)
|
||||
return "" unless (-t STDIN);
|
||||
die "Need to manually enter test parameter $param" unless (-t STDERR);
|
||||
|
||||
my $userResponse = "";
|
||||
while($userResponse eq "") {
|
||||
|
||||
while ( $userResponse eq "" )
|
||||
{
|
||||
print STDERR "\n";
|
||||
print STDERR "Test File : ".(caller(0))[1]."\n";
|
||||
print STDERR "Test Parameter : $param\n";
|
||||
print STDERR "Description : $description\n";
|
||||
print STDERR "Enter value (or 'none') ", ($default ? "[${default}]" : "[]"), " => ";
|
||||
print STDERR "Test Harness : $testharness\n";
|
||||
print STDERR "Test Parameter : $param\n";
|
||||
print STDERR "Environment Variable : $envvar\n" if ($param ne $envvar);
|
||||
print STDERR "Brief Description : $brief\n";
|
||||
print STDERR "Enter value (or 'none') ", ($defaultValid ? "[${default}]" : "[]"), " => ";
|
||||
$userResponse = <STDIN>;
|
||||
$userResponse = "" if ! defined( $userResponse ); # Handle EOF
|
||||
chomp($userResponse);
|
||||
if($default && $userResponse eq "") {
|
||||
chomp( $userResponse );
|
||||
if ( $defaultValid && $userResponse eq "" )
|
||||
{
|
||||
$userResponse = $default;
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "\n";
|
||||
|
||||
if($userResponse =~ /^(na|none)$/) {
|
||||
$userResponse = "";
|
||||
if ($userResponse =~ /^(na|none)$/) {
|
||||
$userResponse = "";
|
||||
}
|
||||
|
||||
# store user responses
|
||||
SetCacheParameter($param, $userResponse);
|
||||
# define all user responses at global scope
|
||||
SetCacheParameter( $param, ( $scoped ? $testharness : undef ), $userResponse );
|
||||
|
||||
return $userResponse;
|
||||
}
|
||||
|
|
@ -371,20 +383,37 @@ sub getTestParameter {
|
|||
# Internal Cache Management Functions
|
||||
#
|
||||
|
||||
sub SearchCache {
|
||||
my($param) = @_;
|
||||
sub SearchCache
|
||||
{
|
||||
my( $param, $scope ) = @_;
|
||||
|
||||
LoadCache();
|
||||
|
||||
if(exists $CACHE{$param}) {
|
||||
if ( exists( $CACHE{$scope} ) && exists( $CACHE{$scope}{$param} ) )
|
||||
{
|
||||
return $CACHE{$scope}{$param};
|
||||
}
|
||||
|
||||
if ( exists( $CACHE{$param} ) )
|
||||
{
|
||||
return $CACHE{$param};
|
||||
}
|
||||
return undef; # Need this to say "nothing found"
|
||||
return undef; # Need this to say "nothing found"
|
||||
}
|
||||
|
||||
sub SetCacheParameter {
|
||||
my($param, $value) = @_;
|
||||
$CACHE{$param} = $value;
|
||||
sub SetCacheParameter
|
||||
{
|
||||
my( $param, $scope, $value ) = @_;
|
||||
|
||||
if ( defined( $scope ) )
|
||||
{
|
||||
$CACHE{$scope}{$param} = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$CACHE{$param} = $value;
|
||||
}
|
||||
|
||||
SaveCache();
|
||||
}
|
||||
|
||||
|
|
@ -392,7 +421,6 @@ sub LoadCache
|
|||
{
|
||||
return if exists( $CACHE{'_cache_loaded_'} );
|
||||
|
||||
my $fileContents = "";
|
||||
if ( -f $CACHEFILENAME )
|
||||
{
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
|
@ -403,50 +431,40 @@ sub LoadCache
|
|||
return;
|
||||
}
|
||||
|
||||
$fileContents = join("", <$fileHandle>);
|
||||
my( $fileContents ) = join( "\n", <$fileHandle> );
|
||||
|
||||
$fileHandle->close();
|
||||
|
||||
chomp($fileContents);
|
||||
my( $contentsRef ) = eval $fileContents;
|
||||
%CACHE = %{$contentsRef} if (defined($contentsRef));
|
||||
%CACHE = %{$contentsRef};
|
||||
|
||||
}
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_original_cache'} = $fileContents;
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
}
|
||||
|
||||
|
||||
sub SaveCache
|
||||
{
|
||||
delete $CACHE{'_cache_loaded_'};
|
||||
my $oldFileContents = delete $CACHE{'_original_cache'};
|
||||
|
||||
# clean up old style params
|
||||
for my $key (keys %CACHE) {
|
||||
delete $CACHE{$key} if $key !~ m/^NP_[A-Z0-9_]+$/mx;
|
||||
my( $fileHandle ) = new IO::File;
|
||||
|
||||
if ( ! $fileHandle->open( "> ${CACHEFILENAME}" ) )
|
||||
{
|
||||
print STDERR "NPTest::LoadCache() : Problem saving ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
|
||||
my($dataDumper) = new Data::Dumper([\%CACHE]);
|
||||
my( $dataDumper ) = new Data::Dumper( [ \%CACHE ] );
|
||||
|
||||
$dataDumper->Terse(1);
|
||||
$dataDumper->Sortkeys(1);
|
||||
my $data = $dataDumper->Dump();
|
||||
$data =~ s/^\s+/ /gmx; # make sure all systems use same amount of whitespace
|
||||
$data =~ s/^\s+}/}/gmx;
|
||||
chomp($data);
|
||||
|
||||
if($oldFileContents ne $data) {
|
||||
my($fileHandle) = new IO::File;
|
||||
if (!$fileHandle->open( "> ${CACHEFILENAME}")) {
|
||||
print STDERR "NPTest::SaveCache() : Problem saving ${CACHEFILENAME} : $!\n";
|
||||
return;
|
||||
}
|
||||
print $fileHandle $data;
|
||||
$fileHandle->close();
|
||||
}
|
||||
print $fileHandle $dataDumper->Dump();
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
$CACHE{'_original_cache'} = $data;
|
||||
$fileHandle->close();
|
||||
|
||||
$CACHE{'_cache_loaded_'} = 1;
|
||||
}
|
||||
|
||||
#
|
||||
|
|
@ -469,35 +487,26 @@ sub SetCacheFilename
|
|||
|
||||
sub DetermineTestHarnessDirectory
|
||||
{
|
||||
my( @userSupplied ) = @_;
|
||||
my @dirs;
|
||||
my( $userSupplied ) = @_;
|
||||
|
||||
# User Supplied
|
||||
if ( @userSupplied > 0 )
|
||||
if ( defined( $userSupplied ) && $userSupplied )
|
||||
{
|
||||
for my $u ( @userSupplied )
|
||||
if ( -d $userSupplied )
|
||||
{
|
||||
if ( -d $u )
|
||||
{
|
||||
push ( @dirs, $u );
|
||||
}
|
||||
return $userSupplied;
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # userSupplied is invalid -> FAIL
|
||||
}
|
||||
}
|
||||
|
||||
# Simple Cases: "t" and tests are subdirectories of the current directory
|
||||
# Simple Case : "t" is a subdirectory of the current directory
|
||||
if ( -d "./t" )
|
||||
{
|
||||
push ( @dirs, "./t");
|
||||
return "./t";
|
||||
}
|
||||
if ( -d "./tests" )
|
||||
{
|
||||
push ( @dirs, "./tests");
|
||||
}
|
||||
|
||||
if ( @dirs > 0 )
|
||||
{
|
||||
return @dirs;
|
||||
}
|
||||
|
||||
# To be honest I don't understand which case satisfies the
|
||||
# original code in test.pl : when $tstdir == `pwd` w.r.t.
|
||||
|
|
@ -510,7 +519,7 @@ sub DetermineTestHarnessDirectory
|
|||
|
||||
if ( $pwd =~ m|/t$| )
|
||||
{
|
||||
push ( @dirs, $pwd );
|
||||
return $pwd;
|
||||
|
||||
# The alternate that might work better is
|
||||
# chdir( ".." );
|
||||
|
|
@ -519,7 +528,7 @@ sub DetermineTestHarnessDirectory
|
|||
# to be tested is in the current directory (ie "./check_disk ....")
|
||||
}
|
||||
|
||||
return @dirs;
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub TestsFrom
|
||||
|
|
@ -545,12 +554,12 @@ sub TestsFrom
|
|||
{
|
||||
if ( $excludeIfAppMissing )
|
||||
{
|
||||
$application = basename( $filename, ".t" );
|
||||
if ( ! -e $application and ! -e $application.'.pm' )
|
||||
{
|
||||
print STDERR "No application (${application}) found for test harness (${filename})\n";
|
||||
next;
|
||||
}
|
||||
$application = basename( $filename, ".t" );
|
||||
if ( ! -e $application )
|
||||
{
|
||||
print STDERR "No application (${application}) found for test harness (${filename})\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
push @tests, "${directory}/${filename}";
|
||||
}
|
||||
|
|
@ -563,85 +572,60 @@ sub TestsFrom
|
|||
|
||||
# All the new object oriented stuff below
|
||||
|
||||
sub new {
|
||||
my $type = shift;
|
||||
my $self = {};
|
||||
return bless $self, $type;
|
||||
sub new {
|
||||
my $type = shift;
|
||||
my $self = {};
|
||||
return bless $self, $type;
|
||||
}
|
||||
|
||||
# Accessors
|
||||
sub return_code {
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{return_code} = shift;
|
||||
} else {
|
||||
return $self->{return_code};
|
||||
}
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{return_code} = shift;
|
||||
} else {
|
||||
return $self->{return_code};
|
||||
}
|
||||
}
|
||||
sub output {
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{output} = shift;
|
||||
} else {
|
||||
return $self->{output};
|
||||
}
|
||||
my $self = shift;
|
||||
if (@_) {
|
||||
return $self->{output} = shift;
|
||||
} else {
|
||||
return $self->{output};
|
||||
}
|
||||
}
|
||||
|
||||
sub perf_output {
|
||||
my $self = shift;
|
||||
$_ = $self->{output};
|
||||
/\|(.*)$/;
|
||||
return $1 || "";
|
||||
}
|
||||
|
||||
sub only_output {
|
||||
my $self = shift;
|
||||
$_ = $self->{output};
|
||||
/(.*?)\|/;
|
||||
return $1 || "";
|
||||
my $self = shift;
|
||||
$_ = $self->{output};
|
||||
/\|(.*)$/;
|
||||
return $1 || "";
|
||||
}
|
||||
|
||||
sub testCmd {
|
||||
my $class = shift;
|
||||
my $command = shift or die "No command passed to testCmd";
|
||||
my $timeout = shift || 120;
|
||||
my $object = $class->new;
|
||||
my $class = shift;
|
||||
my $command = shift or die "No command passed to testCmd";
|
||||
my $object = $class->new;
|
||||
|
||||
my $output = `$command`;
|
||||
$object->return_code($? >> 8);
|
||||
$_ = $? & 127;
|
||||
if ($_) {
|
||||
die "Got signal $_ for command $command";
|
||||
}
|
||||
chomp $output;
|
||||
$object->output($output);
|
||||
|
||||
local $SIG{'ALRM'} = sub { die("timeout in command: $command"); };
|
||||
alarm($timeout); # no test should take longer than 120 seconds
|
||||
if ($ENV{'NPTEST_DEBUG'}) {
|
||||
my ($pkg, $file, $line) = caller(0);
|
||||
print "testCmd: Called from line $line in $file", $/;
|
||||
print "Testing: $command", $/;
|
||||
print "Output: ", $object->output, $/;
|
||||
print "Return code: ", $object->return_code, $/;
|
||||
}
|
||||
|
||||
my $output = `$command`;
|
||||
$object->return_code($? >> 8);
|
||||
$_ = $? & 127;
|
||||
if ($_) {
|
||||
die "Got signal $_ for command $command";
|
||||
}
|
||||
chomp $output;
|
||||
$object->output($output);
|
||||
|
||||
eval { $object->{'mp_test_result'} = decode_json($output) };
|
||||
|
||||
alarm(0);
|
||||
|
||||
my ($pkg, $file, $line) = caller(0);
|
||||
print "Testing: $command", $/;
|
||||
if ($ENV{'NPTEST_DEBUG'}) {
|
||||
print "testCmd: Called from line $line in $file", $/;
|
||||
print "Output: ", $object->output, $/;
|
||||
print "Return code: ", $object->return_code, $/;
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
# do we have ipv6
|
||||
sub has_ipv6 {
|
||||
# assume ipv6 if a ping6 to labs.consol.de works
|
||||
`ping6 -c 1 2a03:3680:0:2::21 2>&1`;
|
||||
if($? == 0) {
|
||||
return 1;
|
||||
}
|
||||
return;
|
||||
return $object;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
174
README
174
README
|
|
@ -1,98 +1,114 @@
|
|||
Monitoring Plugins
|
||||
==================
|
||||
Nagios Plugins README
|
||||
---------------------
|
||||
|
||||
* For instructions on installing these plugins for use with your monitoring
|
||||
system, see below. In addition, generic instructions for the GNU
|
||||
toolchain can be found in the `INSTALL` file.
|
||||
* For instructions on installing these plugins for use with Nagios,
|
||||
see below. In addition, generic instructions for the GNU toolchain
|
||||
can be found in the INSTALL file.
|
||||
|
||||
* For major changes between releases, read the `NEWS` file.
|
||||
* For major changes between releases, read the CHANGES file.
|
||||
|
||||
* For information on detailed changes that have been made or plugins
|
||||
that have been added, read the `ChangeLog` file.
|
||||
* For information on detailed changes that have been made or plugins
|
||||
that have been added, read the Changelog file.
|
||||
|
||||
* Some plugins require that you have additional programs or
|
||||
libraries installed on your system before they can be used. Plugins that
|
||||
are dependent on other programs/libraries that are missing are usually not
|
||||
compiled. Read the `REQUIREMENTS` file for more information.
|
||||
* Some plugins require that you have additional programs and/or
|
||||
libraries installed on your system before they can be used. Plugins
|
||||
that are dependent on other programs/libraries that are missing are
|
||||
usually not compiled. Read the REQUIREMENTS file for more information.
|
||||
|
||||
* Individual plugins are self-documenting. All plugins that comply with
|
||||
* For a list of outstanding bugs for this release, see the BUGS file.
|
||||
|
||||
* Individual plugins are self documenting. All plugins that comply with
|
||||
the basic guidelines for development will provide detailed help when
|
||||
invoked with the `-h` or `--help` options.
|
||||
invoked with the '-h' or '--help' options.
|
||||
|
||||
You can check the latest plugins at:
|
||||
* The file command.cfg contains example configurations for many of the
|
||||
plugins
|
||||
|
||||
* <https://www.monitoring-plugins.org/>
|
||||
* The win32 subdir contains plugins specific to the Win32 platform.
|
||||
These are scripts or binaries.
|
||||
|
||||
Send an email to <help@monitoring-plugins.org> for assistance. Please
|
||||
include the OS type and version that you are using. Also, run the plugin
|
||||
with the `-vvv` option and provide the resulting version information. Of
|
||||
course, there may be additional diagnostic information required as well.
|
||||
Use good judgment.
|
||||
You can check for the latest plugins at:
|
||||
http://sourceforge.net/projects/nagiosplug/
|
||||
|
||||
Send an email to <devel@monitoring-plugins.org> for developer discussions.
|
||||
Send mail to nagiosplug-help@lists.sourceforge.net for assistance. Please
|
||||
include the OS type and version that you are using. Also, run the plugin with
|
||||
the '-vvv' option and provide the resulting version information. Of course,
|
||||
there may be additional diagnostic information required as well. Use good
|
||||
judgment.
|
||||
|
||||
For patch submissions and bug reports, please use the appropriate resources
|
||||
at:
|
||||
Send mail to nagiosplug-devel@lists.sourceforge.net for developer discussions.
|
||||
|
||||
* <https://github.com/monitoring-plugins>
|
||||
For patch submissions and bug reports, please use the appropriate resources at
|
||||
http://sourceforge.net/projects/nagiosplug/ (navigate to the bug tool and/or
|
||||
patch tool from the summary page). Patches should be relative to the current
|
||||
CVS head (development), or to the head of the current stable branch. Also,
|
||||
please include version information for your OS and the plugin(s) your are
|
||||
patching/reporting.
|
||||
|
||||
|
||||
Installation Instructions
|
||||
-------------------------
|
||||
|
||||
1. If you are using the Git tree, you will need m4, gettext, automake, and
|
||||
autoconf. To start out, run:
|
||||
|
||||
./tools/setup
|
||||
|
||||
For more detail, see the developer guidelines at
|
||||
<https://www.monitoring-plugins.org/doc/guidelines.html>.
|
||||
|
||||
2. Run the configure script to initialize variables and create a Makefile,
|
||||
etc.
|
||||
|
||||
./configure --prefix=BASEDIRECTORY --with-cgiurl=SOMEURL
|
||||
|
||||
Replace `BASEDIRECTORY` with the path of the directory under which your
|
||||
monitoring system is installed (default is `/usr/local`), and replace
|
||||
`SOMEURL` with the path used to access the monitoring system CGIs with a
|
||||
web browser (default is `/nagios/cgi-bin`).
|
||||
|
||||
3. Compile the plugins with the following command:
|
||||
|
||||
make
|
||||
|
||||
4. Install the compiled plugins and plugin scripts with the following
|
||||
command:
|
||||
|
||||
make install
|
||||
|
||||
The installation procedure will attempt to place the plugins in a
|
||||
`libexec/` subdirectory in the base directory you specified with the
|
||||
`--prefix` argument to the configure script.
|
||||
|
||||
5. There are some plugins that require setuid. If you run make install as
|
||||
a non-root user, they will not be installed. To install, switch to root
|
||||
and run:
|
||||
|
||||
make install-root
|
||||
|
||||
That's it! If you have any problems or questions, feel free to send an
|
||||
email to <help@monitoring-plugins.org>.
|
||||
|
||||
|
||||
License Notice
|
||||
--------------
|
||||
Nagios Plugins Quick-and-Dirty Installation Instructions
|
||||
--------------------------------------------------------
|
||||
|
||||
You can redistribute and/or modify this software under the terms of the GNU
|
||||
General Public License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version; with the
|
||||
additional exemption that compiling, linking, and/or using OpenSSL is
|
||||
allowed.
|
||||
0) If you are using the CVS tree, you will need m4, gettext, automake, and autoconf.
|
||||
To start out, run ./tools/setup
|
||||
|
||||
This software 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.
|
||||
For more detail, see the developer guidelines at
|
||||
http://nagiosplug.sourceforge.net/developer-guidelines.html.
|
||||
|
||||
See the `COPYING` file for the complete text of the GNU General Public
|
||||
License, version 3.
|
||||
|
||||
1) Run the configure script to initialize variables and create a Makefile, etc.
|
||||
|
||||
./configure --prefix=BASEDIRECTORY --with-nagios-user=SOMEUSER --with-nagios-group=SOMEGROUP --with-cgiurl=SOMEURL
|
||||
|
||||
a) Replace BASEDIRECTORY with the path of the directory under which Nagios
|
||||
is installed (default is '/usr/local/nagios')
|
||||
b) Replace SOMEUSER with the name of a user on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
c) Replace SOMEGRP with the name of a group on your system that will be
|
||||
assigned permissions to the installed plugins (default is 'nagios')
|
||||
d) Replace CGIURL with the path used to access the Nagios CGIs with
|
||||
a web browser (default is '/nagios/cgi-bin')
|
||||
|
||||
|
||||
2) Compile the plugins with the following command:
|
||||
|
||||
make
|
||||
|
||||
|
||||
3) Install the compiled plugins and plugin scripts with the following command:
|
||||
|
||||
make install
|
||||
|
||||
The installation procedure will attempt to place the plugins in a
|
||||
'libexec/' subdirectory in the base directory you specified with
|
||||
the --prefix argument to the configure script.
|
||||
|
||||
4) There are some plugins that require setuid. If you run make install as
|
||||
a non root user, they will not be installed. To install, switch to root and
|
||||
run:
|
||||
|
||||
make install-root
|
||||
|
||||
5) Verify that your host configuration file (hosts.cfg) for Nagios contains
|
||||
the correct paths to the new plugins.
|
||||
|
||||
|
||||
|
||||
That's it! If you have any problems or questions, feel free send mail
|
||||
to nagiosplug-help@lists.sourceforge.net
|
||||
|
||||
|
||||
|
||||
LICENSE STUFF
|
||||
-------------
|
||||
|
||||
This software is released under the GNU Public License with the additional
|
||||
exemption that compiling, linking and/or using OpenSSL is allowed.
|
||||
|
||||
See the COPYING file for the complete GPL text.
|
||||
|
||||
|
||||
--
|
||||
Nagios Plugins Team
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
README
|
||||
88
REQUIREMENTS
88
REQUIREMENTS
|
|
@ -1,4 +1,4 @@
|
|||
Monitoring Plugins Requirements
|
||||
Nagios Plugin Requirements
|
||||
--------------------------
|
||||
|
||||
Some plugins require that you have additional programs and/or
|
||||
|
|
@ -7,99 +7,73 @@ that are dependent on other programs/libraries that are missing are
|
|||
usually not compiled. Requirements for various plugins are listed
|
||||
below...
|
||||
|
||||
check_ldaps, check_http --ssl, check_tcp --ssl, check_smtp --starttls
|
||||
- Requires openssl or gnutls libraries for SSL connections
|
||||
http://www.openssl.org, http://www.gnu.org/software/gnutls
|
||||
|
||||
check_curl:
|
||||
- Requires libcurl 7.15.2 or later
|
||||
http://www.haxx.se
|
||||
- --ssl/-S and -C requires OpenSSL for certificate checks, otherwise
|
||||
libcurl must be quite new to support CURLINFO_CERTINFO with
|
||||
GnuTLS and NSS libraries:
|
||||
- 7.42.0 or newer for GnuTLS
|
||||
- 7.34.0 or newer for NSS
|
||||
GnuTLS is known to create problems on some distributions with
|
||||
self-signed certificate chains
|
||||
http://www.openssl.org, http://www.gnu.org/software/gnutls,
|
||||
http://www.mozilla.org/projects/security/pki/nss/,
|
||||
other SSL implementations are currently not supported
|
||||
- uriparser 0.7.5 or later
|
||||
https://uriparser.github.io/
|
||||
|
||||
check_fping:
|
||||
- Requires the fping utility distributed with SATAN. Either
|
||||
download and install SATAN or grab the fping program from
|
||||
http://www.fping.com/
|
||||
RPM: http://rpmfind.net/linux/rpm2html/search.php?query=fping
|
||||
http://www.fping.com
|
||||
http://www.stanford.edu/~schemers/docs/fping/fping.html
|
||||
ftp://ftp.redhat.com/pub/contrib/libc6/SRPMS/fping-2.2b1-1.src.rpm
|
||||
ftp://ftp.redhat.com/pub/contrib/libc6/RPMS/fping-2.2b1-1.i386.rpm
|
||||
Note that the fping command must be setuid root to function.
|
||||
|
||||
check_game:
|
||||
- Requires the qstat utility available from
|
||||
http://sourceforge.net/projects/qstat/
|
||||
http://www.qstat.org
|
||||
http://www.activesw.com/people/steve/qstat.html
|
||||
Last tested on qstat 2.3d BETA
|
||||
|
||||
check_hpjd:
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net/
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net
|
||||
The snmpget binary is all that is required.
|
||||
|
||||
check_ldap:
|
||||
- Requires the LDAP libraries available from
|
||||
http://www.openldap.org/
|
||||
http://www.openldap.org
|
||||
Lib: libldap, liblber
|
||||
Redhat Source: openldap-1.2.9-6.i386.rpm, openldap-devel-1.2.9-6.i386.rpm
|
||||
|
||||
check_mysql, check_mysql_query:
|
||||
- Requires the MySQL libraries available from
|
||||
http://dev.mysql.com/downloads/
|
||||
http://www.mysql.org
|
||||
Lib: libmysql, libmysqlclient
|
||||
Redhat Source (RHEL6, YUM): mysql-devel, mysql-libs
|
||||
Redhat Powertools Source: mysql-3.20.32a-3.i386.rpm, mysql-devel-3.20.32a-3.i386.rpm (these seem to be broken, however)
|
||||
RPMS from www.mysql.org work better
|
||||
Must have mysql_config in PATH or specified with --with-mysql=DIR for DIR/bin/mysql_config
|
||||
|
||||
check_pqsql:
|
||||
- Requires the PostgreSQL libraries available from
|
||||
http://www.postgresql.org/
|
||||
|
||||
check_dbi:
|
||||
- Requires the DBI libraries available from
|
||||
http://libdbi.sourceforge.net/
|
||||
http://www.postgresql.org
|
||||
|
||||
check_radius:
|
||||
- Requires the radcli library available from:
|
||||
http://radcli.github.io/radcli/
|
||||
- As an alternative, the FreeRADIUS Client library may be used:
|
||||
http://freeradius.org/freeradius-client/
|
||||
The minimal version is 1.1.8, since it broke compatibility in that
|
||||
release. Later versions may be used if that does not happen again
|
||||
- As another alternative, the radiusclient-ng library may be used:
|
||||
http://sourceforge.net/projects/radiusclient-ng.berlios/
|
||||
- This plugin also works with the original radiusclient library from
|
||||
ftp://ftp.cityline.net/pub/radiusclient/
|
||||
RPM (rpmfind): radiusclient 0.3.2, radiusclient-devel-0.3.2
|
||||
However, you probably want to use either radcli or the FreeRADIUS
|
||||
Client library, as both radiusclient and radiusclient-ng are
|
||||
unmaintained and have known issues.
|
||||
- Requires the radiusclient library available from
|
||||
http://www.cityline.net/~lf/radius/
|
||||
RPM (rpmfind): radiusclient-0.3.1-1, radiusclient-devel-0.3.1-1
|
||||
|
||||
check_snmp:
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net/
|
||||
- Requires the NET-SNMP package available from
|
||||
http://net-snmp.sourceforge.net
|
||||
|
||||
check_ifstatus/check_ifoperstatus
|
||||
- Requires Net::SNMP perl module
|
||||
http://www.perl.com/CPAN/modules/by-authors/id/D/DT/DTOWN/
|
||||
http://www.perl.com/CPAN/modules/by-authors/id/D/DT/DTOWN/
|
||||
|
||||
check_nwstat:
|
||||
- Requires MRTGEXT NLM for Novell Servers
|
||||
http://www.engr.wisc.edu/~drews/mrtg/
|
||||
|
||||
check_nt:
|
||||
- Requires NSClient to run on the NT server to monitor
|
||||
http://nsclient.ready2run.nl/
|
||||
|
||||
check_ups:
|
||||
- Requires Network UPS Tools (>= 1.4) to run on the server to monitor
|
||||
http://www.networkupstools.org/
|
||||
|
||||
check_ide_smart:
|
||||
- Uses the Linux specific SMART interface [http://smartlinux.sourceforge.net/smart/index.php].
|
||||
- Requires Network UPS Tools (>= 1.4) to run on the server to monitor
|
||||
http://www.networkupstools.org/
|
||||
|
||||
OS Specific Issues
|
||||
------------------
|
||||
|
||||
HP-UX 11.11
|
||||
You need to use the version of gcc provided by HP at version 3.3.3.
|
||||
You need to use the version of gcc provided by HP at version 3.3.3.
|
||||
Also, you need GNU make 3.8
|
||||
|
||||
|
|
|
|||
117
ROADMAP
Normal file
117
ROADMAP
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
|
||||
Releases in the 1.3 series will be for development. Version 1.4.0 will
|
||||
be the next full production release. I am not planning on dates right now,
|
||||
but you can expect maintennence releases for 1.2.9 as well.
|
||||
|
||||
With that done, it's time to figure out what we are doing for release
|
||||
1.3 development. I have a few ideas. Maybe others do as well.
|
||||
|
||||
DOCUMENTATION:
|
||||
We pretty much have decieded that we will doing something along
|
||||
the lines of a literate programming model. So far, we have site
|
||||
documentation in DocBook. I have some ideas here, which I will
|
||||
discuss in a separate thread.
|
||||
|
||||
|
||||
|
||||
OPTION PROCESSING:
|
||||
I believe we can remove reverse compatibility for non-Getopt
|
||||
option specifications. For example, 'check_ping 1 2 3 4 -p 2'
|
||||
would not be supported anymore. Support for this is a hack,
|
||||
and making it portable is bug-prone. We should also review
|
||||
standardization of our options -- the current list is a little
|
||||
ad hoc, it should be nailed down. Details in a separate thread.
|
||||
|
||||
Also,
|
||||
|
||||
check_http -p 443 --ssl www.infoplease.com
|
||||
|
||||
should be fine, but if the getopt in use does not natively support it,
|
||||
things like
|
||||
|
||||
check_http www.infoplease.com -p 443 --ssl
|
||||
|
||||
should be trapped and result in a call to one of the usage macros
|
||||
(which print a message and then exit STATE_UNKNOWN).
|
||||
|
||||
This means that the call_getopt() function can go away. It's an
|
||||
inconsistent mess and I'd love to ditch it. I only created it to
|
||||
satisfy people that wanted reverse compatibility and did not have
|
||||
GNU getopt.
|
||||
|
||||
Bu I would like to urge that all standard plugins contain
|
||||
validate_arguments(). I think this will help convey the idea that
|
||||
validations hould be done, even if we don't insist on the specific
|
||||
extent that each plugin must do that validation.
|
||||
|
||||
This is the set of standard options I envision:
|
||||
|
||||
Reserved:
|
||||
|
||||
-h, --help (REQUIRED!!!!!)
|
||||
-V, --version (REQUIRED!!!!!)
|
||||
-v, --verbose
|
||||
-q, --quiet
|
||||
-t, --timeout = INTEGER (senonds)
|
||||
-c, --critical = (INT|FLOAT|RANGE|LIST)
|
||||
-w, --warning = (INT|FLOAT|RANGE|LIST)
|
||||
-H, --hostname = STRING
|
||||
-F, --file = STRING (usually input)
|
||||
-O, --output = STRING (output file)
|
||||
|
||||
Recommended, but not reserverd:
|
||||
|
||||
-I, --ipaddress = STRING
|
||||
-C, --community = STRING
|
||||
-a, --auth(info) = STRING (authentication or password)
|
||||
-l, --logname = STRING
|
||||
-p, --password = STRING
|
||||
-P, --port = INT
|
||||
-u, --url = STRING (also --username if --url is not needed)
|
||||
|
||||
I am suggesting that port alway be '-P' (uppercase) -- we are
|
||||
currently inconsistent in that regard.
|
||||
|
||||
I am also adding '-q' for silent running. This is totally self
|
||||
centered--I am planning to use a plugin in a cron script, and I
|
||||
don't want nightly emails.
|
||||
|
||||
As has been the case, ranges are specified with colons, like 'i:j'
|
||||
and list are specified with commas like 'i,k' and may contain ranges
|
||||
if it makes sense to do so. Perhaps it would be good to build a
|
||||
standard list/range processing function for this task.
|
||||
|
||||
|
||||
Programming:
|
||||
I would like to follow the GNU guidelines and remove all fixed
|
||||
length character assignments, at least to the extent possible,
|
||||
from the C-based plugins. To that end, I have made strscpy and
|
||||
friends in utils.c -- I'd like to deploy them. I have comments
|
||||
that there is alot of duplicated code, and techniques used that
|
||||
should be cleaned up. Details in a separate thread.
|
||||
|
||||
Remote checks:
|
||||
I have a proposal in hand to incorporate ssh check into spopen()
|
||||
so that remote machine checks can be seemless. A nice idea, but
|
||||
complex enough to require discussion. Another thread.
|
||||
|
||||
I also have a wish list, and I'm sure I've forgot some items. I'll
|
||||
list mine, please respond with other items that can be put into the
|
||||
sourceforge task manager:
|
||||
|
||||
Indent all code in a GNU-compatible manner (indent -ts 2 -br)
|
||||
Add RAND_seed to check_http for --ssl on systems without /dev/random
|
||||
Add regex filtering to check_procs --args option
|
||||
Add working procs syntax for AIX check_procs
|
||||
Allow check_disk to exclude non-local disks
|
||||
Add md5 checksumming to check_http
|
||||
Complete unification of check_tcp and friends
|
||||
Add SSL in a general way to check_tcp and friends
|
||||
Patches to check_log from Joonas
|
||||
Add calculator engine and snmpwalk to check_snmp
|
||||
Is there a bug in check_oracle
|
||||
Are there outstanding bugs in check_snmp
|
||||
Change check_http --onredirect to default as STATE_UNKNOWN
|
||||
Create plugin to check tftp servers
|
||||
Create plugin wrapper to invert error status
|
||||
|
||||
35
SUPPORT
35
SUPPORT
|
|
@ -1,14 +1,14 @@
|
|||
SUPPORT
|
||||
|
||||
Using the mailing lists and issue tracker at GitHub are the
|
||||
best ways to obtain direct support for the Monitoring Plugins. There may
|
||||
Using the mailing lists and tracker databases at SourceForge are the
|
||||
best ways to obtain direct support for the Nagios Plugins. There may
|
||||
also be commercial support options available to you -- check
|
||||
http://www.nagios.org/ to track the current status of commercial
|
||||
support offerings.
|
||||
|
||||
There are two mailing lists associated with Monitoring Plugins development:
|
||||
'help' (mailto:help@monitoring-plugins.org), and 'devel'
|
||||
(mailto:devel@monitoring-plugins.org). Unless you are fairly
|
||||
There are two mailing lists associated with Nagios Plugin development:
|
||||
'help' (mailto:nagiosplug-help@lists.sourceforge.net), and 'devel'
|
||||
(mailto:nagiosplug-devel@lists.sourceforge.net). Unless you are fairly
|
||||
certain you have found a bug or that you are requesting a new feature,
|
||||
please direct support requests to 'help'.
|
||||
|
||||
|
|
@ -18,15 +18,14 @@ their time to fix bug and provide feature requests, it is generally in
|
|||
you interest to do a modest amount of legwork before posting to either
|
||||
of these lists.
|
||||
|
||||
Plugins that are in the contrib directories are provided as-is. We will
|
||||
try to help, but sometimes the plugins have dependencies that the monitoring-plugin
|
||||
Plugins that are in the contrib directories are provided as-is. We will
|
||||
try to help, but sometimes the plugins have dependencies that the nagios-plugin
|
||||
developers do not have access to. You may be able to try the authors
|
||||
directly.
|
||||
|
||||
In brief, always provide the version of the software that you are
|
||||
using, and when requesting features or reporting bugs, first check to
|
||||
see that the issue has not already been addressed in the current Git
|
||||
code.
|
||||
see that the issue has not already been addressed in the CVS tree.
|
||||
|
||||
GETTING HELP
|
||||
|
||||
|
|
@ -34,7 +33,7 @@ Requests to 'help' require posting the version number of the
|
|||
plugin. The best place to include the version information is in the
|
||||
subject. A good post would have a subject like:
|
||||
|
||||
Can I use SSL with check_imap (monitoring-plugins 1.3.0-beta2) 1.12
|
||||
Can I use SSL with check_imap (nagios-plugins 1.3.0-beta2) 1.12
|
||||
|
||||
If you do not include the version of the plugin, you risk having your
|
||||
post silently ignored.
|
||||
|
|
@ -48,19 +47,19 @@ REPORTING BUGS AND SUBMITTING PATCHES
|
|||
|
||||
Bug reports, investigations of possible bugs, feature requests, and
|
||||
patch submissions should be submitted to the development list at
|
||||
mailto:devel@monitoring-plugins.org. Please raise an issue first
|
||||
in GitHub, otherwise your email is likely to be missed over time.
|
||||
mailto:nagiosplug-devel@lists.sourceforge.net. Please raise a tracker first
|
||||
in Sourceforge, otherwise your email is likely to be missed over time.
|
||||
|
||||
You should identify the version, preferably in the subject line.
|
||||
However, to best use developer resources, it is suggested that you
|
||||
You should identify the version, preferably in the subject line.
|
||||
However, to best use developer resources, it is suggested that you
|
||||
reference your report to one of the following sources:
|
||||
|
||||
1) The most recent release, including beta's
|
||||
|
||||
2) The current snapshots (there's a link provided on
|
||||
https://www.monitoring-plugins.org/download.html)
|
||||
2) The twice-daily snapshots (there's a link provided on
|
||||
http://nagiosplug.sourceforge.net)
|
||||
|
||||
3) The current Git code from GitHub
|
||||
3) The current CVS tree from sourceforge
|
||||
|
||||
(This does not mean you should run any of these sources in a
|
||||
production environment - the latter two you clearly should
|
||||
|
|
@ -70,7 +69,7 @@ which are most recent.)
|
|||
|
||||
From experience, I know that most bugs can be fixed with only a few
|
||||
more moments work than it takes to determine if the bug is still
|
||||
present in the Git tree. If you can save a developer the expense of
|
||||
present in the CVS tree. If you can save a developer the expense of
|
||||
that time, you ensure that bugs are fixed more rapidly, and thus you
|
||||
ensure your problem resolution is reflected in a stable release more
|
||||
quickly.
|
||||
|
|
|
|||
259
THANKS.in
259
THANKS.in
|
|
@ -181,262 +181,3 @@ Sakari Lehtonen
|
|||
John Rouillard
|
||||
Sebastian Wiesinger
|
||||
Jason Kau
|
||||
Michael Tiernan
|
||||
Jeremy Reed
|
||||
Cire Iriarte
|
||||
Allan Bennett
|
||||
Ari Pollak
|
||||
Lance Albertson
|
||||
Mike Emigh
|
||||
Christian Mies
|
||||
Andreas Behal
|
||||
O'Shaughnessy Evans
|
||||
Aravind Gottipati
|
||||
Kyle Tucker
|
||||
Craig Orsinger
|
||||
Robby Giffin
|
||||
Henning Schmiedehausen
|
||||
Markus Baertschi
|
||||
Florian Gleixner
|
||||
Pawel Malachowski
|
||||
Duncan Ferguson
|
||||
Dick van den Burg
|
||||
Sebastian Schubert
|
||||
Jason Hoos
|
||||
Chris Grim
|
||||
Nobuhiro Ban
|
||||
Ville Mattila
|
||||
Lars Stavholm
|
||||
Enrico Scholz
|
||||
Marlo Bell
|
||||
Stefan Meier
|
||||
Mark Favas
|
||||
Felix Frank
|
||||
Denis Knauf
|
||||
Matthias Flacke
|
||||
Emil Michles
|
||||
Ask Bjoern Hansen
|
||||
Daniel Bimschas
|
||||
Aurelien Bompard
|
||||
Christoph Schell
|
||||
Andrew Elwell
|
||||
Heiti Ernits
|
||||
Sebastien Guay
|
||||
Matteo HCE Valsasna
|
||||
Bernhard Fischer
|
||||
fabiodds
|
||||
Tom Payerle
|
||||
Alessandro Ren
|
||||
Harald Jenny
|
||||
Matthias Urlichs
|
||||
Jan Wagner
|
||||
Christian Schneemann
|
||||
Rob Windsor
|
||||
Hilko Bengen
|
||||
Erik Wasser
|
||||
Tilman Koschnick
|
||||
Olivier 'Babar' Raginel
|
||||
Steve Rader
|
||||
Dieter Van de Walle
|
||||
Jan Lipphaus
|
||||
Erik Welch
|
||||
Nik Soggia
|
||||
Olli Hauer
|
||||
Richard Edward Horner
|
||||
John Barbuto
|
||||
Oskar Ahner
|
||||
Chris Pepper
|
||||
Ben Timby
|
||||
Martin Foster
|
||||
Joe Presbrey
|
||||
Will Preston
|
||||
Nikita Kalabukhov
|
||||
Grant Byers
|
||||
Marcel Kuiper
|
||||
Bryan Irvine
|
||||
Jimmy Bergman
|
||||
Konstantin Khomoutov
|
||||
Josip Rodin
|
||||
Dann Frazier
|
||||
Stephane Chazelas
|
||||
Craig Leres
|
||||
Brian Landers
|
||||
Ryan Kelly
|
||||
Stéphane Urbanovski
|
||||
Marco Beck
|
||||
Sebastian Harl
|
||||
Jason Lunn
|
||||
Alex Griffin
|
||||
Marc Remy
|
||||
Matej Vela
|
||||
Jason Ellison
|
||||
Charles-Henri Larose
|
||||
Tobias Brox
|
||||
William Leibzon
|
||||
Jochen Bern
|
||||
Anders Kaseorg
|
||||
Robin Sonefors
|
||||
Alex Bradley
|
||||
Brian De Wolf
|
||||
Richard Leitner
|
||||
Diego Elio Pettenò
|
||||
Vaclav Ovsik
|
||||
Roman Fiedler
|
||||
Fabio Rueda
|
||||
Gabriele Tozzi
|
||||
Sebastian Nohn
|
||||
Emmanuel Dreyfus
|
||||
Booker C. Bense
|
||||
Daniël van Eeden
|
||||
Dominique Broeglin
|
||||
Erwan Ben Souiden
|
||||
Gianluca Varisco
|
||||
Joerg Linge
|
||||
Jonathan Milby
|
||||
Juan Carlos Fernandez
|
||||
Lionel Cons
|
||||
Marc Huffnagle
|
||||
Mark Keisler
|
||||
Pall Sigurdsson
|
||||
Sebastian Schmidt
|
||||
Simon Kainz
|
||||
Steve Weinreich
|
||||
Geoff Oakham
|
||||
Tim Laszlo
|
||||
Stéphane Bortzmeyer
|
||||
Luca Corti
|
||||
Jethro Carr
|
||||
Evgeni Golov
|
||||
Oskar Liljeblad
|
||||
Andrew Widdersheim
|
||||
Anton Lofgren
|
||||
Damian Myerscough
|
||||
Davide Madrisan
|
||||
Gunnar Beutner
|
||||
Joseph Gooch
|
||||
Lars Vogdt
|
||||
Ricardo Maraschini
|
||||
Spenser Reinhardt
|
||||
Stephane Lapie
|
||||
Tilmann Bubeck
|
||||
Eric J. Mislivec
|
||||
Jean-Claude Computing
|
||||
Andy Brist
|
||||
Mikael Falkvidd
|
||||
Patric Wust
|
||||
Julius Kriukas
|
||||
Patrick McAndrew
|
||||
Alexander Wittig
|
||||
Jason Benguerel
|
||||
Matthew Kent
|
||||
Frederic Krueger
|
||||
Simon Meggle
|
||||
Jonas Genannt
|
||||
Nick Peelman
|
||||
Sebastian Herbszt
|
||||
Christopher Schultz
|
||||
Matthias Hähnel
|
||||
Roberto Greiner
|
||||
Peter Radcliffe
|
||||
John C. Frickson
|
||||
Christian Kujau
|
||||
Christopher Odenbach
|
||||
Adrian Murphy
|
||||
Andreas Seemueller
|
||||
Andrew Berglund
|
||||
Bernd Apfel
|
||||
Daniel Stirnimann
|
||||
Elan Ruusamäe
|
||||
Greg Cox
|
||||
Johannes Engel
|
||||
Laurent Licour
|
||||
Matthieu Kermagoret
|
||||
Michael Melcher
|
||||
Sven Geggus
|
||||
Thomas Kurschel
|
||||
Yannick Charton
|
||||
Nicolai Søborg
|
||||
Rolf Eike Beer
|
||||
Bernd Arnold
|
||||
Andreas Baumann
|
||||
Tobias Wolf
|
||||
Lars Michelsen
|
||||
Vincent Danjean
|
||||
Kostyantyn Hushchyn
|
||||
Christian Tacke
|
||||
Alexander A. Klimov
|
||||
Vadim Zhukov
|
||||
Bernard Spil
|
||||
Christian Schmidt
|
||||
Guido Falsi
|
||||
Harald Koch
|
||||
Iustin Pop
|
||||
Jacob Hansen
|
||||
Jean-François Rameau
|
||||
Karol Babioch
|
||||
Lucas Bussey
|
||||
Marc Sánchez
|
||||
Markus Frosch
|
||||
Michael Kraus
|
||||
Patrick Rauscher
|
||||
Prathamesh Bhanuse
|
||||
Valentin Vidic
|
||||
Barak Shohat
|
||||
Florian Lohoff
|
||||
Stefan Bethke
|
||||
Tim Gates
|
||||
Tomas Mozes
|
||||
Aksel Sjögren
|
||||
Andreas Motl
|
||||
Claudio Kuenzler
|
||||
Daniel Uhlmann
|
||||
Eric Wunderlin
|
||||
Geert Hendrickx
|
||||
Ken D
|
||||
Klaus Ethgen
|
||||
Lee Clemens
|
||||
Linda Guo
|
||||
Peter Newman
|
||||
Tobias Fiebig
|
||||
Tobias Wiese
|
||||
Wolfgang Karall-Ahlborn
|
||||
Danijel Tasov
|
||||
Robert Bohne
|
||||
Wolfgang Nieder
|
||||
andrew bezella
|
||||
Lorenz Gruenwald
|
||||
John Morrissey
|
||||
Ralph Gottschalkson
|
||||
Arkadiusz Miśkiewicz
|
||||
Björn Berg
|
||||
Franz Schwartau
|
||||
Gerardo Malazdrewicz
|
||||
Kristian Schuster
|
||||
Patrick Cervicek
|
||||
Patrick Uiterwijk
|
||||
Platon Pronko
|
||||
Stefan Taferner
|
||||
Stuart Henderson
|
||||
Thoralf Rickert-Wendt
|
||||
Thorsten Kukuk
|
||||
Matthias Döhler
|
||||
Emmanuel Riviere
|
||||
Eric Knibbe
|
||||
Eunice Remoquillo
|
||||
Louis Sautier
|
||||
Sven Hartge
|
||||
Alvar Penning
|
||||
Michael Jeanson
|
||||
Ahmet Oeztuerk
|
||||
Alexandre Anriot
|
||||
Andre Klärner
|
||||
Dirk Mueller
|
||||
Mathieu Gagné
|
||||
Michael Orlitzky
|
||||
Richard Laager
|
||||
Yannick Martin
|
||||
Alvar
|
||||
Dennis
|
||||
Firstyear
|
||||
inqrphl
|
||||
William
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ dnl e.g. 6 arguments (linux)
|
|||
dnl e.g. 5 arguments (solaris)
|
||||
dnl e.g. 3 arguments (osf/1)
|
||||
dnl
|
||||
dnl @version $Id$
|
||||
dnl @author Brian Stafford <brian@stafford.uklinux.net>
|
||||
dnl
|
||||
dnl based on version by Caolan McNamara <caolan@skynet.ie>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Requires: automake, autoconf, dpkg-dev
|
||||
# set -e
|
||||
|
||||
|
|
|
|||
|
|
@ -1,684 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2023 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a '.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
case $cc_basename in
|
||||
ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
icc* | ifort*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
lf95*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
nagfor*)
|
||||
wl='-Wl,-Wl,,'
|
||||
;;
|
||||
pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
xl* | bgxl* | bgf* | mpixl*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ F* | *Sun*Fortran*)
|
||||
wl=
|
||||
;;
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
case $cc_basename in
|
||||
f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix[3-9]*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
haiku*)
|
||||
;;
|
||||
interix[3-9]*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix[4-9]*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
:
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc)
|
||||
;;
|
||||
m68k)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd2.[01]*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | dragonfly* | midnightbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
;;
|
||||
openbsd*)
|
||||
if test -f /usr/libexec/ld.so; then
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix[4-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
case "$host_cpu" in
|
||||
powerpc*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
m68k)
|
||||
library_names_spec='$libname.a' ;;
|
||||
esac
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32* | cegcc*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd[23].*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
freebsd* | dragonfly* | midnightbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
haiku*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix[3-9]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux* | k*bsd*-gnu | kopensolaris*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
*nto* | *qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
rdos*)
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
tpf*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
|
||||
a linker warning on most glibc systems.
|
||||
We use a linker warning rather than a preprocessor warning, because
|
||||
#warning cannot be used inside macros. */
|
||||
#ifndef GL_LINK_WARNING
|
||||
/* This works on platforms with GNU ld and ELF object format.
|
||||
Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
|
||||
Testing __ELF__ guarantees the ELF object format.
|
||||
Testing __GNUC__ is necessary for the compound expression syntax. */
|
||||
# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
|
||||
# define GL_LINK_WARNING(message) \
|
||||
GL_LINK_WARNING1 (__FILE__, __LINE__, message)
|
||||
# define GL_LINK_WARNING1(file, line, message) \
|
||||
GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
|
||||
# define GL_LINK_WARNING2(file, line, message) \
|
||||
GL_LINK_WARNING3 (file ":" #line ": warning: " message)
|
||||
# define GL_LINK_WARNING3(message) \
|
||||
({ static const char warning[sizeof (message)] \
|
||||
__attribute__ ((__unused__, \
|
||||
__section__ (".gnu.warning"), \
|
||||
__aligned__ (1))) \
|
||||
= message "\n"; \
|
||||
(void)0; \
|
||||
})
|
||||
# else
|
||||
# define GL_LINK_WARNING(message) ((void) 0)
|
||||
# endif
|
||||
#endif
|
||||
9661
build-aux/ltmain.sh
9661
build-aux/ltmain.sh
File diff suppressed because it is too large
Load diff
275
command.cfg.in
Normal file
275
command.cfg.in
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
###############################################################################
|
||||
# COMMAND CONFIGURATION
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# SYNTAX:
|
||||
# command[<command_name>]=<command_line>
|
||||
#
|
||||
# <command_name> = A short name used to identify the command
|
||||
# <command_line> = The actual command line. The command line doesn't have to
|
||||
# be surrounded in quotes, but may contain quotes as needed within
|
||||
# the command line. Take care to use single quotes at the
|
||||
# outer edges of commands or you will have command line
|
||||
# expansion problems when the command is executed by the shell.
|
||||
# Any valid shell command can be used. Multiple commands can
|
||||
# be separated with semicolons, piping is allowed. The
|
||||
# command line can contain macros, but not are macros are valid
|
||||
# at all time (notifications, service checks, etc). See the
|
||||
# HTML documentaion for more informationon on using macros in
|
||||
# commands.
|
||||
#
|
||||
# Note: Service check, service notification, host check, host notification,
|
||||
# service event handler, and host event handler functions are all defined
|
||||
# here.
|
||||
#
|
||||
# Note: Use the convertcfg program in the contrib directory of the Nagios
|
||||
# distribution to convert this file into a object file format.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# Service notification command - send email with problem summary
|
||||
|
||||
command[notify-by-email]=/bin/printf "$OUTPUT$" | /bin/mail -s '$SERVICESTATE$ alert for $HOSTALIAS$/$SERVICEDESC$' $CONTACTEMAIL$
|
||||
|
||||
# Service notification command - send email to alphanumeric pager
|
||||
# gateway The notify-by-epager command assumes that each contact has a
|
||||
# pager email gateway, and that the address has been entered into the
|
||||
# appropriate contact field instead of an actual pager number.
|
||||
# (i.e. 'pagejoe@nowhere.com' routes mail to Joe's alphanumeric pager)
|
||||
|
||||
command[notify-by-epager]=/bin/echo "$OUTPUT$" | /bin/mail -s '$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$' $CONTACTPAGER$
|
||||
|
||||
# Host notification commands (one for email, one for alphanumeric
|
||||
# pager with email gateway)
|
||||
|
||||
command[host-notify-by-email]=/bin/echo -e "***** Nagios *****\n\nHost "$HOSTALIAS$" is $HOSTSTATE$!\n\nDate/Time: $DATETIME$\n" | /bin/mail -s 'Host $HOSTNAME$ is $HOSTSTATE$!' $CONTACTEMAIL$
|
||||
|
||||
command[host-notify-by-epager]=/bin/echo '$HOSTALIAS$ is $HOSTSTATE$!' | /bin/mail -s 'Host $HOSTNAME$ is $HOSTSTATE$!' $CONTACTPAGER$
|
||||
|
||||
|
||||
## Send notifications to a pager using modem with Qpage (www.qpage.com)
|
||||
|
||||
command[notify-by-qpage]=/usr/bin/printf "Service: %s\nHost: %s\nAddress: %s\nState: %s\nInfo: %s\nDate: %s" '$SERVICEDESC$' '$HOSTNAME$' '$HOSTADDRESS$' '$SERVICESTATE$' '$OUTPUT$' '$DATETIME' | /usr/local/bin/qpage -l 0 -p $CONTACTPAGER$
|
||||
|
||||
command[host-notify-by-qpage]=/usr/bin/printf "Host: %s is %s\nInfo: %s\nDate: %s" '$HOSTALIAS$' '$HOSTSTATES$' '$OUTPUT$' '$DATETIME' | /usr/local/bin/qpage -l 0 -p $CONTACTPAGER$
|
||||
|
||||
## Send notifications using SMSclient (www.smsclient.org)
|
||||
command[notify-by-smsclient]=/usr/bin/sms_client -q $CONTACTPAGER$ "$NOTIFICATIONTYPE$: $HOSTADDRESS$ $HOSTALIAS$: $SERVICEDESC$ is $SERVICESTATE$"
|
||||
command[host-notify-by-smsclient]=/usr/bin/sms_client -q $CONTACTPAGER$ "Host $HOSTALIAS$ is $HOSTSTATE$; $OUTPUT$; $DATETIME$"
|
||||
|
||||
|
||||
|
||||
|
||||
# These are some example service check commands. See the HTML
|
||||
# documentation on the plugins for examples of how to configure
|
||||
# command definitions.
|
||||
|
||||
command[check_tcp]=@libexecdir@/check_tcp -H $HOSTADDRESS$ -p $ARG1$
|
||||
command[check_udp]=@libexecdir@/check_udp -H $HOSTADDRESS$ -p $ARG1$
|
||||
command[check_ftp]=@libexecdir@/check_ftp -H $HOSTADDRESS$
|
||||
command[check_pop]=@libexecdir@/check_pop -H $HOSTADDRESS$
|
||||
command[check_smtp]=@libexecdir@/check_smtp -H $HOSTADDRESS$
|
||||
command[check_nntp]=@libexecdir@/check_nntp -H $HOSTADDRESS$
|
||||
command[check_telnet]=@libexecdir@/check_tcp -H $HOSTADDRESS$ -p 23
|
||||
command[check_users]=@libexecdir@/check_users -w $ARG1$ -c $ARG2$
|
||||
command[check_ntp]=@libexecdir@/check_ntp -H $HOSTADDRESS$
|
||||
command[check_ntp_ntpq]=@libexecdir@/check_ntp -H $HOSTADDRESS$ -j 10 -k 15
|
||||
command[check_flexlm]=@libexecdir@/check_flexlm -F $ARG1$
|
||||
command[check_hpjd]=@libexecdir@/check_hpjd -H $HOSTADDRESS$ -C public
|
||||
command[check_mrtg]=@libexecdir@/check_mrtg $ARG1$ 10 AVG $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
|
||||
command[traffic_average]=@libexecdir@/check_mrtgtraf $ARG1$ 10 AVG $ARG2$ $ARG3$ $ARG4$ $ARG5$
|
||||
command[check_load]=@libexecdir@/check_load $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
|
||||
|
||||
command[check_disk]=@libexecdir@/check_disk -w 85% -c 95% -p $ARG1$
|
||||
command[check_dns]=@libexecdir@/check_dns -H www.yahoo.com -s $HOSTADDRESS$
|
||||
command[check_http]=@libexecdir@/check_http -H $HOSTADDRESS$ -I $HOSTADDRESS$
|
||||
command[check_http2]=@libexecdir@/check_http -H $ARG1$ -I $HOSTADDRESS$ -w $ARG2$ -c $ARG3$
|
||||
command[check_pgsql]=@libexecdir@/check_pgsql -H $HOSTADDRESS$
|
||||
command[check_ping]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 10:20% -c 60:100%
|
||||
command[check_procs]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$
|
||||
command[check_procs_zombie]=@libexecdir@/check_procs -w $ARG1$ -c $ARG2$ -s Z
|
||||
command[check_procs_httpd]=@libexecdir@/check_procs -w 5:$ARG1$ -c 1:$ARG2$ -C httpd
|
||||
command[check_procs_vsz]=@libexecdir@/check_procs -w 8096 -c 16182 -C httpd --metric VSZ
|
||||
command[check_ups]=@libexecdir@/check_ups -H $HOSTADDRESS$ -u $ARG1$
|
||||
|
||||
# An example of using check_by_ssh as an active service check
|
||||
command[ssh_disk]=@libexecdir@/check_by_ssh -H $HOSTADDRESS$ -C '@libexecdir@/check_disk -w 85% -c 95% -p $ARG1$'
|
||||
|
||||
#
|
||||
# UCD_SNMP equivalents for some of the commands above
|
||||
#
|
||||
|
||||
command[snmp_load]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.10.1.5.1,.1.3.6.1.4.1.2021.10.1.5.2,.1.3.6.1.4.1.2021.10.1.5.3 -w :$ARG2$,:$ARG3$,:$ARG4$ -w :$ARG5$,:$ARG6$,:$ARG7$ -l load
|
||||
|
||||
command[snmp_cpustats]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.11.9.0,.1.3.6.1.4.1.2021.11.10.0,.1.3.6.1.4.1.2021.11.11.0 -l 'CPU usage (user system idle)' -u '%'
|
||||
|
||||
command[snmp_procname]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.2.1.5.$ARG2$ -w $ARG3$:$ARG4$ -c $ARG5$:$ARG6$
|
||||
|
||||
command[snmp_disk]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o 1.3.6.1.4.1.2021.9.1.7.$ARG1$,1.3.6.1.4.1.2021.9.1.9.$ARG1$ -w $ARG2$:,:$ARG3$ -c $ARG4$:,:$ARG5$ -u 'kB free (','% used)' -l 'disk space'
|
||||
|
||||
command[snmp_mem]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.4.6.0,.1.3.6.1.4.1.2021.4.5.0 -w $ARG2$: -c $ARG3$:
|
||||
|
||||
command[snmp_swap]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o .1.3.6.1.4.1.2021.4.4.0,.1.3.6.1.4.1.2021.4.3.0 -w $ARG2$: -c $ARG3$:
|
||||
|
||||
#
|
||||
# Slightly more generic SNMP OIDs
|
||||
# note: using partial textual OIDs here - use numeric oids if you don't have MIBDIRS defined per Net-SNMP (net-snmp.org)
|
||||
|
||||
command[snmp_procs]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrSystem.hrSystemProcesses -w :$ARG2$ -c :$ARG3$ -l processes
|
||||
|
||||
command[snmp_users]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrSystem.hrSystemNumUsers -w :$ARG2$ -c :$ARG3$ -l users
|
||||
|
||||
command[snmp_mem2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.101,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.101 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_swap2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.102,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.102 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_mem3]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.101,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.101 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_swap3]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.102,host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageSize.102 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_disk2]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageUsed.$ARG2$ -w $ARG3$ -c $ARG4$
|
||||
|
||||
command[snmp_tcpopen]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o tcp.tcpCurrEstab.0 -w $ARG2$ -c $ARG3$
|
||||
|
||||
command[snmp_tcpstats]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o tcp.tcpActiveOpens.0,tcp.tcpPassiveOpens.0,tcp.tcpInSegs.0,tcp.tcpOutSegs.0,tcp.tcpRetransSegs.0 -l 'TCP stats'
|
||||
|
||||
|
||||
# Some snmp based network device checks (requires Net::SNMP perl module)
|
||||
|
||||
# check all admin-up interfaces
|
||||
command[check_ifstatus]=@libexecdir@/check_ifstatus -H $HOSTADDRESS$ -C public
|
||||
|
||||
# check particular interface by snmp ifIndex key
|
||||
command[check_ifoperstatus_ifindex]=@libexecdir@/check_ifoperstatus -H $HOSTADDRESS$ -C public -k $ARG1$
|
||||
|
||||
# check particular interface by snmp ifDescr value (verify uniqueness before using)
|
||||
command[check_ifoperstatus_ifdescr]=@libexecdir@/check_ifoperstatus -H $HOSTADDRESS$ -C public -d $ARG1$
|
||||
|
||||
# verify all you BGP session on a device are running (only returns warning due to some hardcoded option - to be fixed soon)
|
||||
command[check_snmp_bgpstate]=@libexecdir@/check_bgpstate -H $HOSTADDRESS$ -C public
|
||||
|
||||
#
|
||||
# SNMP NetApp checks (Jason Truong)
|
||||
#
|
||||
#
|
||||
#command[check_netapp_uptime]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.2.1.1.3.0 --delimiter=')' -l "Uptime is"
|
||||
#
|
||||
#command[check_netapp_cpuload]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.789.1.2.1.3.0 -w 90 -c 95 -u '%' -l "CPU LOAD "
|
||||
#
|
||||
#command[check_netapp_numdisks]=@libexecdir@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.789.1.6.4.1.0,.1.3.6.1.4.1.789.1.6.4.2.0,.1.3.6.1.4.1.789.1.6.4.8.0,.1.3.6.1.4.1.789.1.6.4.7.0 -u 'Total Disks','Active','Spare','Failed' -l ""
|
||||
#
|
||||
|
||||
#
|
||||
# SNMP Compaq Insight Agent (oids courtesy of vol)
|
||||
#
|
||||
# the following 4 return the following codes: other=1, ok=2, degraded=3, failed=4
|
||||
#
|
||||
#command[check_compaq_thermalCondition]=@libexec@/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.232.6.2.1.0,.1.3.6.1.4.1.232.6.2.2.0,.1.3.6.1.4.1.232.6.2.3.0,.1.3.6.1.4.1.232.6.2.4.0 -u 'ThermalCondition','ThermalTemp','ThermalSystem','ThermalCPUFan' -w 2:2,2:2,2:2,2:2 -c 1:2,1:2,1:2,1:2 -l "Thermal status "
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
|
||||
# This command checks to see if a host is "alive" by pinging it. The
|
||||
# check must result in a 100% packet loss or 5 second (5000ms) round
|
||||
# trip average to produce an error.
|
||||
|
||||
# This command checks to see if a host is "alive" by pinging it.
|
||||
command[check-host-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a printer is "alive" by pinging it.
|
||||
command[check-printer-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a switch is "alive" by pinging it.
|
||||
command[check-switch-alive]=@libexecdir@/check_ping $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# This command checks to see if a router is "alive" by pinging it.
|
||||
command[check-router-alive]=@libexecdir@/check_ping -H $HOSTADDRESS$ -w 5000,100% -c 5000,100% -p 1
|
||||
|
||||
# Check if a host is alive by doing a fast ping instead of a regular ping
|
||||
command[check-fast-alive]=@libexecdir@/check_fping -H $HOSTADDRESS$
|
||||
|
||||
# Check if the IMAP service is alive (default port=143)
|
||||
command[check-imap]=@libexecdir@/check_imap -H $HOSTADDRESS$
|
||||
|
||||
# Check RPC services
|
||||
command[check-rpc]=@libexecdir@/check_rpc -H $HOSTADDRESS$ -C $ARG1$
|
||||
|
||||
# Check if the NFS server is running (version 2 and version 3)
|
||||
command[check-nfs]=@libexecdir@/check_rpc -H $HOSTADDRESS$ -C nfs -c2,3
|
||||
|
||||
# Check game servers
|
||||
command[check_quake]=@libexecdir@/check_game qs $HOSTADDRESS$
|
||||
command[check_unreal]=@libexecdir@/check_game uns $HOSTADDRESS$ -p $ARG1$ -pf 8
|
||||
|
||||
# Check a port that should be open
|
||||
command[check_nmap]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 30 -p $ARG1$
|
||||
|
||||
# Check a port that should be open and another that *could* be open,
|
||||
# but no warning is given if optional port is closed.
|
||||
|
||||
command[check_nmap_optional]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -o $ARG2$
|
||||
|
||||
# Specify range to nmap
|
||||
command[check_nmap_range]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -r $ARG2$
|
||||
|
||||
# Specify both optional and range
|
||||
command[check_nmap_opt_range]=@libexecdir@/check_nmap -H $HOSTADDRESS$ -t 60 -p $ARG1$ -o $ARG2$ -r$ARG3$
|
||||
|
||||
# Check Radius
|
||||
command[check_radius]=@libexecdir@/check_radius $ARG1$ $ARG2$ $HOSTADDRESS$ 1812 $ARG3$
|
||||
|
||||
|
||||
# Check HTTP proxy
|
||||
# This is a command for checking squid or other proxy servers which uses check
|
||||
# http to ensure an HTTP 200 comes back ..... i.e. squid actually
|
||||
# serves the page and not an error message.
|
||||
# Using check_http will allow verification of authenticated proxies
|
||||
#
|
||||
# Note:: This used to call "check_reply" which was pretty close to check_tcp
|
||||
# The functionality of check_reply has been merged into check_tcp
|
||||
|
||||
command[check_squid]=@libexecdir@/check_http -H $HOSTADDRESS$ -p $ARG1$ -u $ARG2$ -e 'HTTP/1.0 200 OK'
|
||||
|
||||
|
||||
## Check RealAudio url
|
||||
command[check_real_url]=@libexecdir@/check_real $HOSTADDRESS$ -p $ARG1$ -wt $ARG2$ -ct $ARG3$ -to 5 -u $ARG4$
|
||||
|
||||
## Check RealAudio server response
|
||||
command[check_real]=@libexecdir@/check_real $HOSTADDRESS$ -p $ARG1$ -wt $ARG2$ -ct $ARG3$ -to 5
|
||||
|
||||
# NetWare checks via check_nwstat ( see "check_nwstat -h" for more options)
|
||||
# how many current logins
|
||||
command[check_netware_logins]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOGINS" -w $ARG1$ -c $ARG2$
|
||||
# how many current connections
|
||||
command[check_nwstat_conns]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v CONNS -w $ARG1$ -c $ARG2$
|
||||
# 1 minute avg cpu load
|
||||
command[check_netware_1load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD1" -w 70 -c 90
|
||||
# 5 minute avg cpu load
|
||||
command[check_netware_5load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD5" -w 70 -c 90
|
||||
# 15 minute avg cpu load
|
||||
command[check_netware_15load]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "LOAD15" -w 70 -c 90
|
||||
# Disk volume (% free)
|
||||
command[check_nwstat_vol_p]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v VPF$ARG1$ -w $ARG2$ -c $ARG3$
|
||||
# Disk volume (KB free)
|
||||
command[check_nwstat_vol_k]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v VKF$ARG1$ -w $ARG2$ -c $ARG3$
|
||||
# % Long term cache hits
|
||||
command[check_nwstat_ltch]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v LTCH -w $ARG1$ -c $ARG2$
|
||||
# % (of max) used packet receive buffers
|
||||
command[check_nwstat_puprb]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v PUPRB -w $ARG1$ -c $ARG2$
|
||||
# Check to see if the DS database is open
|
||||
command[check_nwstat_dsdb]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v DSDB
|
||||
|
||||
|
||||
|
||||
# Netware 5 abends
|
||||
command[check_netware_abend]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v "ABENDS" -w 10 -c 30
|
||||
# Netware 5 number of current service procs
|
||||
command[check_nwstat_csprocs]=@libexecdir@/check_nwstat -H $HOSTADDRESS$ -v CSPROCS -w $ARG1$ -c $ARG2$
|
||||
|
||||
|
||||
# Still have to write sample entries for the following:
|
||||
#
|
||||
# check_ldap
|
||||
# check_overcr
|
||||
660
config.rpath
660
config.rpath
|
|
@ -1,660 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2006 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# Known limitations:
|
||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
||||
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
||||
# known workaround is to choose shorter directory names for the build
|
||||
# directory and/or the installation directory.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except MSVC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shrext=.so
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
|
||||
|
||||
for cc_temp in $CC""; do
|
||||
case $cc_temp in
|
||||
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
||||
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
||||
\-*) ;;
|
||||
*) break;;
|
||||
esac
|
||||
done
|
||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
darwin*)
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
mingw* | pw32* | os2*)
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
newsos6)
|
||||
;;
|
||||
linux*)
|
||||
case $cc_basename in
|
||||
icc* | ecc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
pgcc | pgf77 | pgf90)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
ccc*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
como)
|
||||
wl='-lopt='
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ C*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
;;
|
||||
unicos*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
uts4*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
interix*)
|
||||
# we just hope/assume this is gcc and not c89 (= MSVC++)
|
||||
with_gnu_ld=yes
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
# Set some defaults for GNU ld with shared library support. These
|
||||
# are reset later if shared libraries are not supported. Putting them
|
||||
# here allows them to be overridden if necessary.
|
||||
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
||||
# option of GNU ld is called -rpath, not --rpath.
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX/PPC, the GNU linker is very broken
|
||||
if test "$host_cpu" != ia64; then
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we cannot use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
interix3*)
|
||||
hardcode_direct=no
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
linux*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
netbsd*)
|
||||
;;
|
||||
solaris*)
|
||||
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
|
||||
case `$LD -v 2>&1` in
|
||||
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = no; then
|
||||
hardcode_libdir_flag_spec=
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
${CC} ${LDFLAGS} conftest.c -o conftest
|
||||
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
||||
}'`
|
||||
fi
|
||||
if test -z "$aix_libpath"; then
|
||||
aix_libpath="/usr/lib:/lib"
|
||||
fi
|
||||
rm -f conftest.c conftest
|
||||
# End _LT_AC_SYS_LIBPATH_AIX.
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
bsdi[45]*)
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=no
|
||||
if test "$GCC" = yes ; then
|
||||
:
|
||||
else
|
||||
case $cc_basename in
|
||||
xlc*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd* | kfreebsd*-gnu | dragonfly*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
hpux10*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
fi
|
||||
;;
|
||||
hpux11*)
|
||||
if test "$with_gnu_ld" = no; then
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
*)
|
||||
hardcode_direct=yes
|
||||
# hardcode_minus_L: Not really in the search PATH,
|
||||
# but as the default location of the library.
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
case $host_vendor in
|
||||
sni)
|
||||
hardcode_direct=yes # is this really true???
|
||||
;;
|
||||
siemens)
|
||||
hardcode_direct=no
|
||||
;;
|
||||
motorola)
|
||||
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6*)
|
||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||
hardcode_libdir_separator=':'
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
||||
# only about the one the linker finds when passed -lNAME. This is the last
|
||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
||||
# linker has special search rules.
|
||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
||||
libname_spec='lib$name'
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
amigaos*)
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
beos*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
bsdi[45]*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.dll.a $libname.lib'
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shrext=.dylib
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
dgux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
kfreebsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
case "$host_os" in
|
||||
freebsd[123]*)
|
||||
library_names_spec='$libname$shrext$versuffix' ;;
|
||||
*)
|
||||
library_names_spec='$libname$shrext' ;;
|
||||
esac
|
||||
;;
|
||||
gnu*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
case $host_cpu in
|
||||
ia64*)
|
||||
shrext=.so
|
||||
;;
|
||||
hppa*64*)
|
||||
shrext=.sl
|
||||
;;
|
||||
*)
|
||||
shrext=.sl
|
||||
;;
|
||||
esac
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
interix3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
irix5* | irix6* | nonstopux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
case "$host_os" in
|
||||
irix5* | nonstopux*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*oldld* | linux*aout* | linux*coff*)
|
||||
;;
|
||||
linux*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
knetbsd*-gnu)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
netbsd*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
newsos6)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
nto-qnx*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
openbsd*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shrext=.dll
|
||||
library_names_spec='$libname.a'
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
solaris*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sunos4*)
|
||||
library_names_spec='$libname$shrext$versuffix'
|
||||
;;
|
||||
sysv4 | sysv4.3*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
uts4*)
|
||||
library_names_spec='$libname$shrext'
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Format of library name prefix.
|
||||
libname_spec="$escaped_libname_spec"
|
||||
|
||||
# Library names that the linker finds when passed -lNAME.
|
||||
library_names_spec="$escaped_library_names_spec"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
EOF
|
||||
|
|
@ -1,79 +1,77 @@
|
|||
/* Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html
|
||||
* Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at */
|
||||
// Base code taken from http://www-h.eng.cam.ac.uk/help/tpl/unix/fork.html
|
||||
// Fix for redhat suggested by Ptere Pramberger, peter@pramberger.at
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
void popen_sigchld_handler(int);
|
||||
void popen_sigchld_handler (int);
|
||||
int childtermd;
|
||||
|
||||
int main() {
|
||||
char str[1024];
|
||||
int pipefd[2];
|
||||
pid_t pid;
|
||||
int status, died;
|
||||
int main(){
|
||||
char str[1024];
|
||||
int pipefd[2];
|
||||
pid_t pid;
|
||||
int status, died;
|
||||
|
||||
if (signal(SIGCHLD, popen_sigchld_handler) == SIG_ERR) {
|
||||
printf("Cannot catch SIGCHLD\n");
|
||||
if (signal (SIGCHLD, popen_sigchld_handler) == SIG_ERR) {
|
||||
printf ("Cannot catch SIGCHLD\n");
|
||||
_exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
pipe(pipefd);
|
||||
switch (pid = fork()) {
|
||||
case -1:
|
||||
printf("can't fork\n");
|
||||
_exit(-1);
|
||||
pipe (pipefd);
|
||||
switch(pid=fork()){
|
||||
case -1:
|
||||
printf("can't fork\n");
|
||||
_exit(-1);
|
||||
|
||||
case 0 : // this is the code the child runs
|
||||
close(1); // close stdout
|
||||
// pipefd[1] is for writing to the pipe. We want the output
|
||||
// that used to go to the standard output (file descriptor 1)
|
||||
// to be written to the pipe. The following command does this,
|
||||
// creating a new file descripter 1 (the lowest available)
|
||||
// that writes where pipefd[1] goes.
|
||||
dup (pipefd[1]); // points pipefd at file descriptor
|
||||
// the child isn't going to read from the pipe, so
|
||||
// pipefd[0] can be closed
|
||||
close (pipefd[0]);
|
||||
|
||||
case 0: /* this is the code the child runs */
|
||||
close(1); /* close stdout */
|
||||
/* pipefd[1] is for writing to the pipe. We want the output
|
||||
* that used to go to the standard output (file descriptor 1)
|
||||
* to be written to the pipe. The following command does this,
|
||||
* creating a new file descriptor 1 (the lowest available)
|
||||
* that writes where pipefd[1] goes. */
|
||||
dup(pipefd[1]); /* points pipefd at file descriptor */
|
||||
/* the child isn't going to read from the pipe, so
|
||||
* pipefd[0] can be closed */
|
||||
close(pipefd[0]);
|
||||
//These are the commands to run, with success commented. dig and nslookup only problems
|
||||
//execl ("/bin/date","date",0); // 100%
|
||||
//execl ("/bin/cat", "cat", "/etc/hosts", 0); // 100%
|
||||
//execl ("/usr/bin/dig", "dig", "redhat.com", 0); // 69%
|
||||
//execl("/bin/sleep", "sleep", "1", 0); // 100%
|
||||
execl ("/usr/bin/nslookup","nslookup","redhat.com",0); // 90% (after 100 tests), 40% (after 10 tests)
|
||||
//execl ("/bin/ping","ping","-c","1","localhost",0); // 100%
|
||||
//execl ("/bin/ping","ping","-c","1","192.168.10.32",0); // 100%
|
||||
_exit(0);
|
||||
|
||||
/* These are the commands to run, with success commented. dig and nslookup only problems */
|
||||
/*execl ("/bin/date","date",0);*/ /* 100% */
|
||||
/*execl ("/bin/cat", "cat", "/etc/hosts", 0);*/ /* 100% */
|
||||
/*execl ("/usr/bin/dig", "dig", "redhat.com", 0);*/ /* 69% */
|
||||
/*execl("/bin/sleep", "sleep", "1", 0);*/ /* 100% */
|
||||
execl("/usr/bin/nslookup", "nslookup", "redhat.com",
|
||||
0); /* 90% (after 100 tests), 40% (after 10 tests) */
|
||||
/*execl ("/bin/ping","ping","-c","1","localhost",0);*/ /* 100% */
|
||||
/*execl ("/bin/ping","ping","-c","1","192.168.10.32",0);*/ /* 100% */
|
||||
_exit(0);
|
||||
default: // this is the code the parent runs
|
||||
|
||||
default: /* this is the code the parent runs */
|
||||
close(0); // close stdin
|
||||
// Set file descriptor 0 (stdin) to read from the pipe
|
||||
dup (pipefd[0]);
|
||||
// the parent isn't going to write to the pipe
|
||||
close (pipefd[1]);
|
||||
// Now read from the pipe
|
||||
fgets(str, 1023, stdin);
|
||||
//printf("1st line output is %s\n", str);
|
||||
|
||||
close(0); /* close stdin */
|
||||
/* Set file descriptor 0 (stdin) to read from the pipe */
|
||||
dup(pipefd[0]);
|
||||
/* the parent isn't going to write to the pipe */
|
||||
close(pipefd[1]);
|
||||
/* Now read from the pipe */
|
||||
fgets(str, 1023, stdin);
|
||||
/*printf("1st line output is %s\n", str);*/
|
||||
//while (!childtermd); // Uncomment this line to fix
|
||||
|
||||
/*while (!childtermd);*/ /* Uncomment this line to fix */
|
||||
|
||||
died = wait(&status);
|
||||
/*printf("died=%d status=%d\n", died, status);*/
|
||||
if (died > 0) {
|
||||
_exit(0);
|
||||
} else {
|
||||
_exit(1);
|
||||
}
|
||||
}
|
||||
died= wait(&status);
|
||||
//printf("died=%d status=%d\n", died, status);
|
||||
if (died > 0) _exit(0);
|
||||
else _exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void popen_sigchld_handler(int signo) {
|
||||
if (signo == SIGCHLD) {
|
||||
/*printf("Caught sigchld\n");*/
|
||||
childtermd = 1;
|
||||
}
|
||||
void
|
||||
popen_sigchld_handler (int signo)
|
||||
{
|
||||
if (signo == SIGCHLD) {
|
||||
//printf("Caught sigchld\n");
|
||||
childtermd = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
193
contrib-reporting/process_perfdata.pl
Normal file
193
contrib-reporting/process_perfdata.pl
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
# author: Al Tobey <albert.tobey@priority-health.com>
|
||||
# what: process perfdata from Nagios and put it into RRD files
|
||||
# license: GPL - http://www.fsf.org/licenses/gpl.txt
|
||||
#
|
||||
# Todo:
|
||||
# * more documentation (POD) & comments
|
||||
# * clean up a bit, make it more configurable - possibly a config file
|
||||
|
||||
use strict;
|
||||
use lib qw( /opt/nagios/libexec );
|
||||
use utils qw( %ERRORS );
|
||||
use vars qw( $debug_file %data $debug $rrd_base $process_func $rrd_type );
|
||||
use RRDs;
|
||||
$debug_file = undef; #"/var/opt/nagios/perfdata.out";
|
||||
$rrd_base = '/var/opt/nagios/rrds';
|
||||
$process_func = \&process_multi;
|
||||
$rrd_type = 'GAUGE';
|
||||
$data{hostname} = shift(@ARGV);
|
||||
$data{metric} = shift(@ARGV);
|
||||
$data{timestamp} = shift(@ARGV);
|
||||
$data{perfdata} = join( " ", @ARGV ); $data{perfdata} =~ s/\s+/ /g;
|
||||
|
||||
# make sure there's data to work with
|
||||
exit $ERRORS{OK} if ( !defined($data{hostname}) || !defined($data{metric})
|
||||
|| !defined($data{timestamp}) || !defined($data{perfdata})
|
||||
|| $data{perfdata} eq ' ' || $data{perfdata} eq '' );
|
||||
|
||||
if ( defined($debug_file) ) {
|
||||
open( LOGFILE, ">>$debug_file" );
|
||||
print LOGFILE "$data{hostname}\t$data{metric}\t$data{timestamp}\t$data{perfdata}\n\n";
|
||||
}
|
||||
|
||||
# make sure host directory exists
|
||||
if ( !-d "$rrd_base/$data{hostname}" ) {
|
||||
mkdir( "$rrd_base/$data{hostname}" )
|
||||
|| warn "could not create host directory $rrd_base/$data{hostname}: $!";
|
||||
}
|
||||
our $rrd_dir = $rrd_base .'/'. $data{hostname};
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# do some setup based on the name of the metric
|
||||
|
||||
# host data
|
||||
if ( $data{metric} eq "HOSTCHECK" ) {
|
||||
$rrd_dir .= '/hostperf';
|
||||
}
|
||||
# processing disk information
|
||||
elsif ( $data{metric} =~ /_DISK$/ ) {
|
||||
$rrd_dir .= '/disk';
|
||||
}
|
||||
# network interface information
|
||||
elsif ( $data{metric} =~ /^IFACE_/ ) {
|
||||
$rrd_dir .= '/interfaces';
|
||||
$rrd_type = [ 'COUNTER', 'COUNTER' ];
|
||||
}
|
||||
# process performance statistics
|
||||
elsif ( $data{metric} =~ /_PROC$/ ) {
|
||||
$rrd_dir .= '/processes';
|
||||
$process_func = \&process_single;
|
||||
$rrd_type = [ 'COUNTER', 'GAUGE' ];
|
||||
}
|
||||
# a resonable guess
|
||||
elsif ( $data{perfdata} =~ /=/ ) {
|
||||
$process_func = \&process_single;
|
||||
}
|
||||
# everything else
|
||||
else {
|
||||
$rrd_dir .= '/other';
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
# call the proper processing function set up above (functions defined below)
|
||||
our @processed = ( $process_func->() );
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
if ( !-d $rrd_dir ) {
|
||||
mkdir( $rrd_dir ) || warn "could not mkdir( $rrd_dir ): $!";
|
||||
}
|
||||
foreach my $datum ( @processed ) {
|
||||
if ( defined($debug_file) ) {
|
||||
print LOGFILE $datum->{rrd_name}, " = ", join('--',@{$datum->{data}}), "\n"
|
||||
}
|
||||
|
||||
my $rrdfile = $rrd_dir.'/'.$datum->{rrd_name};
|
||||
|
||||
# create the RRD file if it doesn't already exist
|
||||
if ( !-e $rrdfile ) {
|
||||
# create a non-useful datasource title for each "part"
|
||||
RRDs::create( $rrdfile, "-b", $data{timestamp}, "-s", 300, $process_func->($datum, 1),
|
||||
"RRA:AVERAGE:0.5:1:600",
|
||||
"RRA:MAX:0.5:1:600",
|
||||
"RRA:AVERAGE:0.5:6:600",
|
||||
"RRA:MAX:0.5:6:600",
|
||||
"RRA:AVERAGE:0.5:24:600",
|
||||
"RRA:MAX:0.5:24:600",
|
||||
"RRA:AVERAGE:0.5:288:600",
|
||||
"RRA:MAX:0.5:288:600"
|
||||
);
|
||||
if ( my $ERROR = RRDs::error ) { print "ERROR: $ERROR\n"; exit $ERRORS{UNKNOWN}; }
|
||||
}
|
||||
else {
|
||||
# create a template to make sure data goes into the RRD as planned
|
||||
if ( defined($debug_file) ) {
|
||||
print LOGFILE "updating $rrdfile with data:\n\t",
|
||||
join(':', $data{timestamp}, @{$datum->{data}}), "\n";
|
||||
}
|
||||
# update the RRD file
|
||||
RRDs::update( $rrdfile, '-t', $process_func->($datum),
|
||||
join(':', $data{timestamp}, @{$datum->{data}}) );
|
||||
if ( my $ERROR = RRDs::error ) { print "ERROR: $ERROR\n"; exit $ERRORS{UNKNOWN}; }
|
||||
}
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------------------- #
|
||||
|
||||
if ( defined($debug_file) ) {
|
||||
print LOGFILE "-------------------------------------------------------------------------------\n";
|
||||
close( LOGFILE );
|
||||
}
|
||||
|
||||
exit $ERRORS{OK};
|
||||
|
||||
# /opt=value,value,value:/=value,value,value - into multiple rrd's
|
||||
sub process_multi {
|
||||
my( $datum, $create ) = @_;
|
||||
|
||||
# return a string for creating new RRDs
|
||||
if ( defined($create) && $create == 1 ) {
|
||||
my @DS = ();
|
||||
for ( my $i=0; $i<scalar(@{$datum->{data}}); $i++ ) {
|
||||
# allow the RRD type to be set in the switch/if above
|
||||
my $tmp_rrd_type = $rrd_type;
|
||||
if ( ref($rrd_type) eq 'ARRAY' ) { $tmp_rrd_type = $rrd_type->[$i] }
|
||||
# put the new datasource into the list
|
||||
push( @DS, "DS:$data{metric}$i:GAUGE:86400:U:U" );
|
||||
}
|
||||
return @DS;
|
||||
}
|
||||
# return a template for updating an RRD
|
||||
elsif ( defined($datum) && !defined($create) ) {
|
||||
my @template = ();
|
||||
for ( my $i=0; $i<scalar(@{$datum->{data}}); $i++ ) {
|
||||
push( @template, $data{metric}.$i );
|
||||
}
|
||||
return join( ':', @template );
|
||||
}
|
||||
# break the data up into parts for processing (updates and creates)
|
||||
else {
|
||||
my @processed = ();
|
||||
foreach my $part ( split(/:/, $data{perfdata}) ) { # break the line into parts
|
||||
my @parts = split( /,/, $part ); # break the part into parts
|
||||
my $rrd_name = $parts[0]; # figure out a good name for the RRD
|
||||
if ( $parts[0] =~ /^\// ) { # handle /'s in disk names
|
||||
$rrd_name = $parts[0];
|
||||
$rrd_name =~ s#/#_#g; $rrd_name =~ s/^_//; $rrd_name =~ s/_$//;
|
||||
if ( $parts[0] eq '/' ) { $rrd_name = 'root' };
|
||||
}
|
||||
# store our munged data in an array of hashes
|
||||
push( @processed, { rrd_name => $rrd_name, name => shift(@parts), data => [ @parts ] } );
|
||||
}
|
||||
return @processed;
|
||||
}
|
||||
}
|
||||
|
||||
# name=value:name=value - into one rrd
|
||||
sub process_single {
|
||||
my( $datum, $create ) = @_;
|
||||
|
||||
my( @names, @values ) = ();
|
||||
foreach my $part ( split(/:/, $data{perfdata}) ) {
|
||||
my( $name, $value ) = split( /=/, $part );
|
||||
push( @names, $name );
|
||||
push( @values, $value );
|
||||
}
|
||||
|
||||
if ( defined($create) && $create == 1 ) {
|
||||
my @DS = ();
|
||||
for( my $i=0; $i<scalar(@names); $i++ ) {
|
||||
my $tmp_rrd_type = $rrd_type;
|
||||
if ( ref($rrd_type) eq 'ARRAY' ) { $tmp_rrd_type = $rrd_type->[$i] }
|
||||
push( @DS, 'DS:'.$names[$i].":$tmp_rrd_type:86400:U:U" );
|
||||
}
|
||||
return @DS;
|
||||
}
|
||||
elsif ( defined($datum) && !defined($create) ) {
|
||||
return join( ':', @names );
|
||||
}
|
||||
else {
|
||||
return( {rrd_name=>lc($data{metric}), name=>$data{metric}, data=>[@values]} );
|
||||
}
|
||||
}
|
||||
56
contrib/README.TXT
Normal file
56
contrib/README.TXT
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
Contrib Plugins README
|
||||
----------------------
|
||||
|
||||
This directory contains plugins which have been contributed by various people, but that
|
||||
have not yet been incorporated into the core plugins distribution.
|
||||
|
||||
Most Perl plugins should work without modification. Some of the C plugins may require
|
||||
a few tweaks to compile.
|
||||
|
||||
If you have questions regarding the use of these plugins, try contacting the author(s)
|
||||
or post a message to the nagiosplug-help mailing list (nagiosplug-help@lists.sourceforge.net)
|
||||
requesting assistance.
|
||||
|
||||
|
||||
|
||||
Contrib Tarballs
|
||||
----------------
|
||||
|
||||
In addition to the plugins located in this directory, there are some additional tarballs
|
||||
containing plugins in the tarballs/ subdirectory. They have not yet been organized.
|
||||
A brief description of their contents follows.
|
||||
|
||||
|
||||
berger-ping.tar.gz - Perl script version of the check_ping plugin and a corresponding
|
||||
CGI (mtr.cgi) that uses mtr to traceroute a path to a host.
|
||||
(Gary Berger)
|
||||
|
||||
bowen-langley_plugins.tar.gz
|
||||
- Several C plugins including check_inode, check_boot, etc.
|
||||
(Adam Bown & Thomas Langley)
|
||||
|
||||
|
||||
check_bgp-1.0.tar.gz - Perl script intended for monitoring BGP sessions on Cisco routers.
|
||||
Uses Net::Telnet to telnet into a cisco router and
|
||||
run "sh ip bgp"
|
||||
|
||||
check_memory.tgz - C plugin to check available system memory
|
||||
|
||||
check_radius.tar.gz - C program to check RADIUS authentication. This is a hacked version of
|
||||
the Cistron Radiusd program radtest that acts as a plugin for Nagios.
|
||||
The vast majority of the code was written by someone at Livingston
|
||||
Enterprises and Cistron. NOTE: Due to the copyright restrictions in
|
||||
this code, it cannot be distributed under the GPL license, and thus
|
||||
will not appear in the core plugin distribution!
|
||||
(Adam Jacob)
|
||||
|
||||
radius.tar.gz - Code modifications necessary to make the radexample app
|
||||
supplied with the radiusclient code work as a RADIUS plugin
|
||||
for Nagios (Nick Shore)
|
||||
|
||||
fetchlog-0.94.tar.gz - C program: The fetchlog utility displays the last new messages of a
|
||||
logfile. It is similar like tail(1) but offers some extra functionality
|
||||
for output formatting. fetchlog can be used standalone or as a Nagios
|
||||
plugin to monitor local logfiles or together with Net-SNMP to monitor
|
||||
remote logfiles. The README shows how to setup fetchlog for Nagios.
|
||||
(Alexander Haderer)
|
||||
48
contrib/aix/check_failed
Normal file
48
contrib/aix/check_failed
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
#======================
|
||||
# Created May 25, 2000
|
||||
#======================
|
||||
|
||||
# This scripts is for checking for failed root login attempts on
|
||||
# any machine running AIX which has a failedlogin file in /etc/security
|
||||
# The purpose is to thwart (good word) any unauthorised people from
|
||||
# even trying to log in as root. This plugin has been developed for Nagios
|
||||
# running on AIX.
|
||||
# Lonny Selinger SpEnTBoY lonny@abyss.za.org
|
||||
# May
|
||||
|
||||
|
||||
my $server = $ARGV[0];
|
||||
|
||||
if (!$ARGV[0]) {
|
||||
print "You must specify a server to check\n";
|
||||
print "usage: ./check_failed <Server Name>\n";
|
||||
exit (-1);
|
||||
} else {
|
||||
open (DATE, "/bin/date '+%b %d' |");
|
||||
while (<DATE>) {
|
||||
$dline = $_;
|
||||
@dresults = $dline;
|
||||
chop $dresults[0];
|
||||
}
|
||||
open (SULOG, "rsh $server -l root who /etc/security/failedlogin | grep root |");
|
||||
while (<SULOG>) {
|
||||
$line = $_;
|
||||
@results = split (/\s+/,$line);
|
||||
if ($line =~ /^root/) {
|
||||
if (join(' ', @results[2,3]) eq $dresults[0]) {
|
||||
print "FAILED root login on $dresults[0], node: $ARGV[0] from $results[5]\n";
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (join(' ', @results[2,3]) ne $dresults[0]) {
|
||||
print "No Failed Root Logins on This Node\n";
|
||||
exit(0);
|
||||
}
|
||||
exit(0);
|
||||
close(SULOG);
|
||||
close(DATE);
|
||||
|
||||
|
||||
69
contrib/aix/check_io
Normal file
69
contrib/aix/check_io
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#! /bin/sh
|
||||
|
||||
#=================================================================
|
||||
#
|
||||
# I/O Checker (KBPS)
|
||||
# This Script uses iostat to monitor disk io
|
||||
# Useful for notifications of disk thrashing.
|
||||
#
|
||||
# Authors: TheRocker
|
||||
# SpEnTBoY
|
||||
#
|
||||
# Email: therocker@pawprints.2y.net
|
||||
# lonny@abyss.za.org
|
||||
#
|
||||
#================================================================
|
||||
|
||||
NUMBER1=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c1 | line`
|
||||
NUMBER2=`rsh $1 -l root iostat -d | grep -e "hdisk" | tr -s ' ' | cut -d' ' -f2 | sort -2 -r | cut -c2 | line`
|
||||
TMPFILE=/tmp/iotest.hndl
|
||||
TMPTOO=/tmp/iotwo.hndl
|
||||
|
||||
#===========================================================
|
||||
#
|
||||
# We do an evaluation on $NUMBER1 and $NUMBER2 to see if
|
||||
# disk io is exceeding 40%.
|
||||
#
|
||||
#===========================================================
|
||||
|
||||
if [ "$NUMBER1" -gt 4 ] && [ "$NUMBER2" -gt 0 ]
|
||||
then
|
||||
|
||||
`rsh $1 -l root iostat -d | grep -v cd0 | tr -s ' '| cut -d' ' -f1,2 | grep -e "4[0-9]." >> $TMPFILE`
|
||||
|
||||
#====================================================================
|
||||
#
|
||||
# Of course, there may be more than one hard disk on the node
|
||||
# so we use this bit of code to report on more than one instance
|
||||
# of excessive disk IO.
|
||||
#
|
||||
#====================================================================
|
||||
|
||||
LINES=`wc -l /tmp/iotest.hndl | cut -c8`
|
||||
LINESCTL=`wc -l /tmp/iotest.hndl | cut -c8 `
|
||||
echo "WARNING!!! Disk I/O Exceeding 40% on --> \c"
|
||||
|
||||
while [ $LINESCTL != 0 ]
|
||||
do
|
||||
|
||||
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
|
||||
cat $TMPTOO > $TMPFILE
|
||||
LINESCTL=$(( $LINESCTL -1 ))
|
||||
LINES=$(( $LINES -1 ))
|
||||
DATA=`head -1 /tmp/iotest.hndl`
|
||||
echo "( $DATA ) "
|
||||
|
||||
|
||||
done
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
rm -f $TMPTOO
|
||||
exit 1
|
||||
|
||||
else
|
||||
|
||||
print "No Disk I/O Exceeding 40%...OK"
|
||||
exit 0
|
||||
|
||||
fi
|
||||
49
contrib/aix/check_kerberos
Normal file
49
contrib/aix/check_kerberos
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#! /bin/sh
|
||||
|
||||
#=========================================================================
|
||||
# Kerberos Ticket Checker
|
||||
#
|
||||
# This script is handy if you allow kerberos tickets to expire
|
||||
# on your nodes. The script will simply warn you when a node has
|
||||
# kerberos tickets expiring on the current date. This will allow to
|
||||
# re-initialize the tickets if you wish to do so.
|
||||
#
|
||||
# Nothing fancy here, all Nagios will show is the number of tickets
|
||||
# that are going to (or already have) expired.
|
||||
#
|
||||
# An item of note:
|
||||
#
|
||||
# We made no provisions for the weekend. If tickets expire on the
|
||||
# weekend and nobody is around, you won't see a warning on the
|
||||
# Nagios console because we look for expired on the current day
|
||||
# only. It's a good idea to have this warning emailed to the
|
||||
# appropriate admin and if there is something critical that relies
|
||||
# on Kerberos, you might want to send a page.
|
||||
#
|
||||
# Authors: TheRocker
|
||||
# SpEnTBoY
|
||||
#
|
||||
# Email: therocker@pawprints.2y.net
|
||||
# lonny@abyss.za.org
|
||||
#=========================================================================
|
||||
|
||||
TMPFILE=/tmp/kerbtmp.hndl
|
||||
DATE=`date +%b' '%d`
|
||||
|
||||
rsh $1 -l root /usr/lpp/ssp/kerberos/bin/klist | tr -s ' ' | cut -d' ' -f4,5,6 | grep -e "$DATE" > $TMPFILE
|
||||
|
||||
|
||||
if [ -s $TMPFILE ]
|
||||
then
|
||||
|
||||
LINES=`wc -l /tmp/kerbtmp.hndl | cut -c7-8`
|
||||
echo "Kerberos Tickets set to expire --> \c"
|
||||
echo "$LINES \c"
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
exit 1
|
||||
|
||||
fi
|
||||
echo "Kerberos Tickets are valid"
|
||||
exit 0
|
||||
67
contrib/aix/check_queue
Normal file
67
contrib/aix/check_queue
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#! /bin/sh
|
||||
|
||||
#===============================================================
|
||||
# Print Queue Checker
|
||||
#
|
||||
# The print queue checker simply looks for an occurance of a
|
||||
# DOWN queue. A note of warning, if you use remote queues in
|
||||
# AIX to redirect print jobs from the AIX queue to an NT print
|
||||
# server that print through DLC rather than IP, it will be very
|
||||
# s - l - o - w. But it will work.
|
||||
#
|
||||
# Author: TheRocker
|
||||
# Email: therocker@pawprints.2y.net
|
||||
#===============================================================
|
||||
|
||||
TMPFILE=/tmp/qtmp.hndl
|
||||
TMPTOO=/tmp/qtwo.hndl
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# This script will also work on AIX 4.2.1 BUT you have to change
|
||||
# the following line. AIX 4.2.1 does not support the -W option
|
||||
# with lpstat. For AIX 4.2.1 just remove the -W option and it should
|
||||
# work just fine.
|
||||
#
|
||||
#=======================================================================
|
||||
|
||||
`rsh $1 -l root lpstat -W | grep -e "DOWN" | tr -s ' ' | cut -d' ' -f1,3 > /tmp/qtmp.hndl 2> /tmp/q_err`
|
||||
|
||||
if [ -s $TMPFILE ]
|
||||
then
|
||||
|
||||
#=======================================================
|
||||
#
|
||||
# If you've seen the other AIX scripts I wrote you may
|
||||
# notice that I use this bit of code a lot. Well it
|
||||
# works and appears to be all purpose.
|
||||
#
|
||||
#=======================================================
|
||||
|
||||
LINES=`wc -l /tmp/qtmp.hndl | cut -c8`
|
||||
LINESCTL=`wc -l /tmp/qtmp.hndl | cut -c8`
|
||||
|
||||
echo "Print Queue DOWN --> \c"
|
||||
|
||||
while [ $LINESCTL != 0 ]
|
||||
do
|
||||
|
||||
cat $TMPFILE | tail -$LINESCTL > $TMPTOO
|
||||
cat $TMPTOO > $TMPFILE
|
||||
LINESCTL=$(( $LINESCTL -1 ))
|
||||
LINES=$(( $LINES -1 ))
|
||||
DATA=`head -1 /tmp/qtmp.hndl`
|
||||
echo "( $DATA ) \c"
|
||||
|
||||
|
||||
done
|
||||
|
||||
echo "\n"
|
||||
|
||||
rm -f $TMPFILE
|
||||
rm -f $TMPTOO
|
||||
exit 2
|
||||
|
||||
fi
|
||||
echo "Print Queues Running... OK"
|
||||
exit 0
|
||||
45
contrib/aix/pg_stat
Normal file
45
contrib/aix/pg_stat
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/ksh
|
||||
|
||||
#==============================================================================
|
||||
# Script was originally created to collect stats and dump then to a log file
|
||||
# every five minutes. But we like this better (the log file thing is still
|
||||
# good if you want to track availability).
|
||||
#
|
||||
# Authors: SpEnTBoY
|
||||
# TheRocker
|
||||
#
|
||||
# Email: lonny@abyss.za.org
|
||||
# therocker@pawprints.2y.net
|
||||
#==============================================================================
|
||||
|
||||
#=========================================================================================
|
||||
#
|
||||
# The best way to do this is to use Kerberos but we use rsh here because our monitoring
|
||||
# workstation doesn't have Kerberos installed. In order for this to work, the remote
|
||||
# host ($1) must have a .rhosts file that contains a line like:
|
||||
#
|
||||
# monitorhost nagiosuser
|
||||
#
|
||||
#=========================================================================================
|
||||
|
||||
PAGING2=`rsh $1 -l root lsps -a -s | grep -v Paging | tr -s ' '| cut -d' ' -f3 | cut -d'%' -f1`
|
||||
|
||||
|
||||
if [ "$PAGING2" -gt "35" ] && [ "$PAGING2" -lt "50" ]
|
||||
then
|
||||
echo "Paging Space is over 35% ("$PAGING2")%"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PAGING2" -gt "49" ]
|
||||
then
|
||||
echo "WARNING! Paging Space is over 50% ("$PAGING2")%"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$PAGING2" -lt "34" ]
|
||||
then
|
||||
echo "Paging Space is less than 34% ("$PAGING2")%"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
75
contrib/check_adptraid.sh
Normal file
75
contrib/check_adptraid.sh
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Modified check_sensors to check the alarm status of an Adaptec 3200S RAID
|
||||
# controller.
|
||||
#
|
||||
# Scott Lambert -- lambert@lambertfam.org
|
||||
#
|
||||
# Tested on FreeBSD 4.7 with the adptfbsd_323.tgz package installed. This
|
||||
# package installs all it's programs into /usr/dpt.
|
||||
#
|
||||
|
||||
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$' | sed -e 's/[^0-9.]//g'`
|
||||
|
||||
. $PROGPATH/utils.sh
|
||||
|
||||
RAIDUTIL_CMD="/usr/dpt/raidutil -A ?"
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $PROGNAME"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
print_revision $PROGNAME $REVISION
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "This plugin checks alarm status of Adaptec 3200S RAID controller."
|
||||
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
|
||||
;;
|
||||
*)
|
||||
raidutiloutput=`$RAIDUTIL_CMD 2>&1`
|
||||
status=$?
|
||||
if test "$1" = "-v" -o "$1" = "--verbose"; then
|
||||
echo ${raidutiloutput}
|
||||
fi
|
||||
if test ${status} -eq 127; then
|
||||
echo "RAIDUTIL UNKNOWN - command not found (did you install raidutil?)"
|
||||
exit -1
|
||||
elif test ${status} -ne 0 ; then
|
||||
echo "WARNING - raidutil returned state $status"
|
||||
exit 1
|
||||
fi
|
||||
if echo ${raidutiloutput} | egrep On > /dev/null; then
|
||||
echo RAID CRITICAL - RAID alarm detected!
|
||||
exit 2
|
||||
else
|
||||
echo raid ok
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
283
contrib/check_apache.pl
Normal file
283
contrib/check_apache.pl
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# (c)2001 Sebastian Hetze, Linux Information Systems AG
|
||||
# send bug reports to <S.Hetze@Linux-AG.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# Check apache status information provided by mod_status to find
|
||||
# out about the load (number of servers working) and the
|
||||
# performance (average response time for recent requests).
|
||||
#
|
||||
# Usage:
|
||||
# check_apache -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]
|
||||
#
|
||||
# check_apache <host> <warn> <crit> <url> (if you cannot avoid it)
|
||||
#
|
||||
|
||||
use LWP::UserAgent;
|
||||
use URI::URL;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
$version=0.01;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
#
|
||||
# some default values
|
||||
#
|
||||
$perf_w=500;
|
||||
$perf_c=1000;
|
||||
$load_w=20;
|
||||
$load_c=30;
|
||||
$TIMEOUT=15;
|
||||
|
||||
#
|
||||
# get command line options the regular way
|
||||
#
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"l" => \$opt_l, "load" => \$opt_l,
|
||||
"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,
|
||||
"u=s" => \$opt_u, "url=s" => \$opt_u);
|
||||
|
||||
#
|
||||
# handle the verbose stuff first
|
||||
#
|
||||
if ($opt_V) {
|
||||
print "\n";
|
||||
print "check_apache nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General Public License.\n";
|
||||
print "For more information about these matters, see the file named COPYING.\n";
|
||||
print "\n";
|
||||
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#
|
||||
# now get options the weired way and set the defaults
|
||||
# if nothing else is provided
|
||||
#
|
||||
$opt_H = shift unless ($opt_H);
|
||||
print_usage() unless ($opt_H);
|
||||
|
||||
if($opt_l) {
|
||||
$autostring="?auto";
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = $load_w);
|
||||
$warn = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = $load_c);
|
||||
$alert = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
} else {
|
||||
$autostring="";
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = $perf_w);
|
||||
$warn = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = $perf_c);
|
||||
$alert = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
}
|
||||
|
||||
($opt_u) || ($opt_u = shift) || ($opt_u = "/server-status");
|
||||
|
||||
|
||||
#
|
||||
# dont let us wait forever...
|
||||
#
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from HTTP server (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
#
|
||||
# now we set things up for the real work
|
||||
# and fire up the request
|
||||
#
|
||||
$ua = new LWP::UserAgent;
|
||||
$ua->agent("Nagios/0.1 " . $ua->agent);
|
||||
|
||||
|
||||
$urlstring = "http://" . $opt_H . $opt_u . $autostring;
|
||||
$url = url($urlstring);
|
||||
|
||||
my $req = new HTTP::Request 'GET', $url;
|
||||
my $res = $ua->request($req);
|
||||
|
||||
#
|
||||
# hopefully we´ve got something usefull
|
||||
#
|
||||
if ($res->is_success) {
|
||||
if($opt_l) {
|
||||
foreach $_ (split /^/m, $res->content) {
|
||||
next if /^\s*$/;
|
||||
#
|
||||
# this is the load checking section
|
||||
# we parse the whole content, just in case someone
|
||||
# wants to use this some day in the future
|
||||
#
|
||||
if (/^Total Accesses:\s+([0-9.]+)/) { $accesses = $1; next; }
|
||||
if (/^Total kBytes:\s+([0-9.]+)/) { $kbytes = $1; next; }
|
||||
if (/^CPULoad:\s+([0-9.]+)\s+/) { $load = $1; next; }
|
||||
if (/^Uptime:\s+([0-9.]+)\s+/) { $uptime = $1; next; }
|
||||
if (/^ReqPerSec:\s+([0-9.]+)\s+/) { $rps = $1; next; }
|
||||
if (/^BytesPerSec:\s+([0-9.]+)\s+/) { $bps = $1; next; }
|
||||
if (/^BytesPerReq:\s+([0-9.]+)\s+/) { $bpr = $1; next; }
|
||||
if (/^BusyServers:\s+([0-9.]+)\s+/) { $busy = $1; next; }
|
||||
if (/^IdleServers:\s+([0-9.]+)\s+/) { $idle = $1; next; }
|
||||
if (/^Scoreboard:\s+([SRWKDLG_.]+)\s+/) { $score = $1; next; }
|
||||
print "Unknown Status\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
#
|
||||
# now we even parse the whole scoreboard, just for fun
|
||||
#
|
||||
foreach $scorepoint (split //m, $score) {
|
||||
if($scorepoint eq '.') { $scores{'.'}+=1; next; } # Unused
|
||||
if($scorepoint eq '_') { $scores{'_'}+=1; next; } # Waiting
|
||||
if($scorepoint eq 'S') { $scores{'S'}+=1; next; } # Starting
|
||||
if($scorepoint eq 'R') { $scores{'R'}+=1; next; } # Reading
|
||||
if($scorepoint eq 'W') { $scores{'W'}+=1; next; } # Writing
|
||||
if($scorepoint eq 'K') { $scores{'K'}+=1; next; } # Keepalive
|
||||
if($scorepoint eq 'D') { $scores{'D'}+=1; next; } # DNS Lookup
|
||||
if($scorepoint eq 'L') { $scores{'L'}+=1; next; } # Logging
|
||||
if($scorepoint eq 'G') { $scores{'G'}+=1; next; } # Going
|
||||
}
|
||||
|
||||
if($busy>$alert) {
|
||||
printf "HTTPD CRITICAL: %.0f servers running\n", $busy;
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
if($busy>$warn) {
|
||||
printf "HTTPD WARNING: %.0f servers running\n", $busy;
|
||||
exit $ERRORS{"WARNING"};
|
||||
}
|
||||
printf "HTTPD ok: %.0f servers running, %d idle\n", $busy, $idle;
|
||||
exit $ERRORS{"OK"};
|
||||
|
||||
} else {
|
||||
#
|
||||
# this is the performance check section
|
||||
# We are a bit lazy here, no parsing of the initial data
|
||||
# block and the scoreboard.
|
||||
# However, you have the whole set of per server
|
||||
# information to play with ;-)
|
||||
# The actual performance is measured by adding up the
|
||||
# milliseconds required to process the most recent
|
||||
# requests of all instances and then taking the average.
|
||||
#
|
||||
foreach $tablerow (split /<tr>/m, $res->content) {
|
||||
($empty,$Srv,$PID,$Acc,$M,$CPU,$SS,$Req,$Conn,$Child,$Slot,$Client,$VHost,$Request)
|
||||
= split /<td>/, $tablerow;
|
||||
if($Req) {
|
||||
$lines+=1;
|
||||
$req_sum+=$Req;
|
||||
}
|
||||
undef $Req;
|
||||
}
|
||||
$average=$req_sum/$lines;
|
||||
if($average>$alert) {
|
||||
printf "HTTPD CRITICAL: average response time %.0f
|
||||
milliseconds\n", $average;
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
if($average>$warn) {
|
||||
printf "HTTPD WARNING: average response time %.0f
|
||||
milliseconds\n", $average;
|
||||
exit $ERRORS{"WARNING"};
|
||||
}
|
||||
if($average>0) {
|
||||
printf "HTTPD ok: average response time %.0f milliseconds\n",
|
||||
$average;
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
print "Unknown Status\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
} else {
|
||||
print "HTTP request failed\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# ok, now we are almost through
|
||||
# These last subroutines do the things for those that do not
|
||||
# read source code.
|
||||
#
|
||||
sub print_usage () {
|
||||
print "Usage: $0 -H <host> [-lhV] [-w <warn>] [-c <crit>] [-u <url>]\n"; }
|
||||
|
||||
sub print_help () {
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "check_apache nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General Public License.\n";
|
||||
print "For more information about these matters, see the file named COPYING.\n";
|
||||
print "\n";
|
||||
print "Copyright (c) 2001 Sebastian Hetze Linux Information Systems AG\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "This plugin checks the apache HTTP service on the specified host.\n";
|
||||
print "It uses the mod_status facilities provided by the apache server.\n";
|
||||
print "The monitoring server must be authorized in httpd.conf.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "Options:\n";
|
||||
print " -H, --hostname=ADDRESS\n";
|
||||
print " host name argument for server.\n";
|
||||
print " -l, --load\n";
|
||||
print " check load instead of performance.\n";
|
||||
print " -h, --help\n";
|
||||
print " print detailed help screen.\n";
|
||||
print " -V, --version\n";
|
||||
print " print version information.\n";
|
||||
print " -w, --warning=INTEGER\n";
|
||||
print " load / performance level at which a warning message will be gererated.\n";
|
||||
print " -c, --critical=INTEGER\n";
|
||||
print " load / performance level at which a critical message will be gererated.\n";
|
||||
print " -u, --url=PATH\n";
|
||||
print " location to call mod_status.\n";
|
||||
print "\n";
|
||||
print " Defaults for performance checking are $perf_w/$perf_c msec.\n";
|
||||
print " Defaults for load checking are $load_w/$load_c servers running.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
#
|
||||
# the end
|
||||
#
|
||||
307
contrib/check_apc_ups.pl
Normal file
307
contrib/check_apc_ups.pl
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
#! /usr/bin/perl -wT
|
||||
#
|
||||
# Check_apc_ups - Check APC UPS status via SNMP
|
||||
# Shamelessly copied from check_breeze.pl
|
||||
#
|
||||
# To do:
|
||||
# - Send SNMP queries directly, instead of forking `snmpget`.
|
||||
# - Make the status less verbose. Maybe we can send an "onLine, time
|
||||
# remaining: hh:mm:ss" if all is well, and a list of specific problems
|
||||
# if something is broken.
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_H $opt_T $opt_t $opt_R $opt_r
|
||||
$opt_L $opt_l $PROGNAME);
|
||||
use lib utils.pm;
|
||||
use utils qw(%ERRORS &print_revision &support &usage);
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub get_snmp_int_val ($);
|
||||
sub escalate_exitval ($);
|
||||
|
||||
$ENV{'PATH'}='';
|
||||
$ENV{'BASH_ENV'}='';
|
||||
$ENV{'ENV'}='';
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"T=s" => \$opt_T, "temp-critical" => \$opt_T,
|
||||
"t=s" => \$opt_t, "temp-warning" => \$opt_t,
|
||||
"R=s" => \$opt_R, "runtime-critical" => \$opt_R,
|
||||
"r=s" => \$opt_r, "runtime-warning" => \$opt_r,
|
||||
"L=s" => \$opt_L, "load-critical" => \$opt_L,
|
||||
"l=s" => \$opt_l, "load-warning" => \$opt_l,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H);
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision$');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
|
||||
|
||||
($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n");
|
||||
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);
|
||||
($host) || usage("Invalid host: $opt_H\n");
|
||||
|
||||
# Defaults
|
||||
|
||||
$opt_R *= 60 * 100 if (defined $opt_R); # Convert minutes to secs/100
|
||||
$opt_r *= 60 * 100 if (defined $opt_R);
|
||||
|
||||
my $tempcrit = $opt_T || 60;
|
||||
my $tempwarn = $opt_t || 40;
|
||||
my $runtimecrit = $opt_R || 30 * 60 * 100; # Secs / 100
|
||||
my $runtimewarn = $opt_r || 60 * 60 * 100;
|
||||
my $loadcrit = $opt_L || 85;
|
||||
my $loadwarn = $opt_l || 50;
|
||||
|
||||
if ($tempcrit !~ /\d+/) { usage ("Invalid critical temperature threshold.\n"); }
|
||||
if ($tempwarn !~ /\d+/) { usage ("Invalid critical temperature threshold.\n"); }
|
||||
|
||||
if ($runtimecrit !~ /\d+/) {
|
||||
usage ("Invalid critical run time threshold.\n");
|
||||
}
|
||||
if ($runtimewarn !~ /\d+/) {
|
||||
usage ("Invalid warning run time threshold.\n");
|
||||
}
|
||||
|
||||
if ($loadcrit !~ /\d+/ || $loadcrit < 0 || $loadcrit > 100) {
|
||||
usage ("Invalid critical load threshold.\n");
|
||||
}
|
||||
if ($loadwarn !~ /\d+/ || $loadwarn < 0 || $loadwarn > 100) {
|
||||
usage ("Invalid warning load threshold.\n");
|
||||
}
|
||||
|
||||
|
||||
# APC UPS OIDs
|
||||
# APC MIBs are available at ftp://ftp.apcftp.com/software/pnetmib/mib
|
||||
my $upsBasicOutputStatus = ".1.3.6.1.4.1.318.1.1.1.4.1.1.0";
|
||||
my $upsBasicBatteryStatus = ".1.3.6.1.4.1.318.1.1.1.2.1.1.0";
|
||||
my $upsAdvInputLineFailCause = ".1.3.6.1.4.1.318.1.1.1.3.2.5.0";
|
||||
my $upsAdvBatteryTemperature = ".1.3.6.1.4.1.318.1.1.1.2.2.2.0";
|
||||
my $upsAdvBatteryRunTimeRemaining = ".1.3.6.1.4.1.318.1.1.1.2.2.3.0";
|
||||
my $upsAdvBatteryReplaceIndicator = ".1.3.6.1.4.1.318.1.1.1.2.2.4.0";
|
||||
my $upsAdvOutputLoad = ".1.3.6.1.4.1.318.1.1.1.4.2.3.0";
|
||||
my $upsAdvTestDiagnosticsResults = ".1.3.6.1.4.1.318.1.1.1.7.2.3.0";
|
||||
|
||||
my @outputStatVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ undef, undef ], # pad 1
|
||||
[ "onLine", $ERRORS{'OK'} ], # 2
|
||||
[ "onBattery", $ERRORS{'WARNING'} ], # 3
|
||||
[ "onSmartBoost", $ERRORS{'WARNING'} ], # 4
|
||||
[ "timedSleeping", $ERRORS{'WARNING'} ], # 5
|
||||
[ "softwareBypass", $ERRORS{'WARNING'} ], # 6
|
||||
[ "off", $ERRORS{'CRITICAL'} ], # 7
|
||||
[ "rebooting", $ERRORS{'WARNING'} ], # 8
|
||||
[ "switchedBypass", $ERRORS{'WARNING'} ], # 9
|
||||
[ "hardwareFailureBypass", $ERRORS{'CRITICAL'} ], # 10
|
||||
[ "sleepingUntilPowerReturn", $ERRORS{'CRITICAL'} ], # 11
|
||||
[ "onSmartTrim", $ERRORS{'WARNING'} ], # 12
|
||||
);
|
||||
|
||||
my @failCauseVals = (
|
||||
undef,
|
||||
"noTransfer",
|
||||
"highLineVoltage",
|
||||
"brownout",
|
||||
"blackout",
|
||||
"smallMomentarySag",
|
||||
"deepMomentarySag",
|
||||
"smallMomentarySpike",
|
||||
"largeMomentarySpike",
|
||||
"selfTest",
|
||||
"rateOfVoltageChnage",
|
||||
);
|
||||
|
||||
my @battStatVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ undef, undef ], # pad 1
|
||||
[ "batteryNormal", $ERRORS{'OK'} ], # 2
|
||||
[ "batteryLow", $ERRORS{'CRITICAL'} ], # 3
|
||||
);
|
||||
|
||||
my @battReplVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ "noBatteryNeedsReplacing", $ERRORS{'OK'} ], # 1
|
||||
[ "batteryNeedsReplacing", $ERRORS{'CRITICAL'} ], # 2
|
||||
);
|
||||
|
||||
my @diagnosticsResultsVals = (
|
||||
[ undef, undef ], # pad 0
|
||||
[ "OK", $ERRORS{'OK'} ], # 1
|
||||
[ "failed", $ERRORS{'CRITICAL'} ], # 2
|
||||
[ "invalidTest", $ERRORS{'CRITICAL'} ], # 3
|
||||
[ "testInProgress", $ERRORS{'OK'} ], # 4
|
||||
);
|
||||
|
||||
my $exitval = $ERRORS{'UNKNOWN'};
|
||||
my $data;
|
||||
my $onbattery = 3;
|
||||
|
||||
$data = get_snmp_int_val( $upsBasicOutputStatus );
|
||||
|
||||
print "Output status: ";
|
||||
if (defined ($data) && defined ($outputStatVals[$data][0])) {
|
||||
print "$outputStatVals[$data][0] | ";
|
||||
escalate_exitval($outputStatVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryRunTimeRemaining );
|
||||
|
||||
print "Rem time: ";
|
||||
if (defined ($data)) {
|
||||
my $hrs = int($data / (60 * 60 * 100)); # Data is hundredths of a second
|
||||
my $mins = int($data / (60 * 100)) % 60;
|
||||
my $secs = ($data % 100) / 100;
|
||||
printf "%d:%02d:%05.2f | ", $hrs, $mins, $secs;
|
||||
if ($data <= $runtimecrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data <= $runtimewarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsBasicBatteryStatus );
|
||||
|
||||
print "Battery status: ";
|
||||
if (defined ($data) && defined ($battStatVals[$data][0])) {
|
||||
my $failcause = "unknown";
|
||||
my $fc = get_snmp_int_val( $upsAdvInputLineFailCause );
|
||||
if ($data == $onbattery) {
|
||||
if (defined ($failCauseVals[$fc])) { $failcause = $failCauseVals[$fc]; }
|
||||
print "$battStatVals[$data][0] ($failcause) | ";
|
||||
} else {
|
||||
print "$battStatVals[$data][0] | ";
|
||||
}
|
||||
escalate_exitval($battStatVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryTemperature );
|
||||
|
||||
print "Battery temp(C): ";
|
||||
if (defined ($data)) {
|
||||
print "$data | ";
|
||||
if ($data >= $tempcrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data >= $tempwarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvBatteryReplaceIndicator );
|
||||
|
||||
print "Battery repl: ";
|
||||
if (defined ($data) && defined ($battReplVals[$data][0])) {
|
||||
print "$battReplVals[$data][0] | ";
|
||||
escalate_exitval($battReplVals[$data][1]);
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvOutputLoad );
|
||||
|
||||
print "Output load (%): ";
|
||||
if (defined ($data)) {
|
||||
print "$data | ";
|
||||
if ($data >= $loadcrit) {
|
||||
escalate_exitval($ERRORS{'CRITICAL'});
|
||||
} elsif ($data >= $loadwarn) {
|
||||
escalate_exitval($ERRORS{'WARNING'});
|
||||
} else {
|
||||
escalate_exitval($ERRORS{'OK'});
|
||||
}
|
||||
} else {
|
||||
print "unknown | ";
|
||||
}
|
||||
|
||||
$data = get_snmp_int_val( $upsAdvTestDiagnosticsResults );
|
||||
|
||||
print "Diag result: ";
|
||||
if (defined ($data) && defined ($diagnosticsResultsVals[$data][0])) {
|
||||
print "$diagnosticsResultsVals[$data][0]\n";
|
||||
escalate_exitval($diagnosticsResultsVals[$data][1]);
|
||||
} else {
|
||||
print "unknown\n";
|
||||
}
|
||||
|
||||
|
||||
exit $exitval;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -T temp -t temp -R minutes -r minutes\n";
|
||||
print " -L percent -l percent\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$');
|
||||
print "Copyright (c) 2001 Gerald Combs/Jeffrey Blank/Karl DeBisschop
|
||||
|
||||
This plugin reports the status of an APC UPS equipped with an SNMP management
|
||||
module.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print "
|
||||
-H, --hostname=HOST
|
||||
Name or IP address of host to check
|
||||
-T --temp-critical
|
||||
Battery degrees C above which a CRITICAL status will result (default: 60)
|
||||
-t --temp-warning
|
||||
Battery degrees C above which a WARNING status will result (default: 40)
|
||||
-R --runtime-critical
|
||||
Minutes remaining below which a CRITICAL status will result (default: 30)
|
||||
-r --runtime-warning
|
||||
Minutes remaining below which a WARNING status will result (default: 60)
|
||||
-L --load-critical
|
||||
Output load pct above which a CRITICAL status will result (default: 85
|
||||
-l --load-warning
|
||||
Output load pct above which a WARNING status will result (default: 50
|
||||
|
||||
";
|
||||
support();
|
||||
}
|
||||
|
||||
sub get_snmp_int_val ($) {
|
||||
my $val=0;
|
||||
my $oid = shift(@_);
|
||||
|
||||
$val = `/usr/bin/snmpget $host public $oid 2> /dev/null`;
|
||||
my @test = split(/ /,$val,3);
|
||||
|
||||
return undef unless (defined ($test[2]));
|
||||
|
||||
if ($test[2] =~ /\(\d+\)/) { # Later versions of UCD SNMP
|
||||
($val) = ($test[2] =~ /\((\d+)\)/);
|
||||
} elsif ($test[2] =~ /: \d+/) {
|
||||
($val) = ($test[2] =~ /: (\d+)/);
|
||||
} else {
|
||||
$val = $test[2];
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
sub escalate_exitval ($) {
|
||||
my $newval = shift(@_);
|
||||
|
||||
if ($newval > $exitval) { $exitval = $newval; }
|
||||
}
|
||||
210
contrib/check_appletalk.pl
Normal file
210
contrib/check_appletalk.pl
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
#! /usr/bin/perl -wT
|
||||
#
|
||||
# check_atalk_ping plugin for nagios
|
||||
#
|
||||
# usage:
|
||||
# check_atalk_ping atalkaddress
|
||||
#
|
||||
# Checks if an atalkhost responds to an atalk echo
|
||||
# using "aecho"
|
||||
#
|
||||
# initial version: 23 October 2002 by Stefan Beck, IT Software Solutions
|
||||
# current status: $Revision$
|
||||
#
|
||||
# Copyright Notice: GPL
|
||||
#
|
||||
BEGIN {
|
||||
if ( $0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/ ) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
delete $ENV{'LANG'};
|
||||
}
|
||||
|
||||
use strict;
|
||||
use lib utils.pm;
|
||||
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use vars qw($PROGNAME);
|
||||
|
||||
$PROGNAME = "check_atalk";
|
||||
|
||||
my (
|
||||
$verbose, $host, $warning_avg, $warning_loss,
|
||||
$critical_avg, $critical_loss, $count, $cmd,
|
||||
$avg, $loss, $line
|
||||
);
|
||||
my ( $opt_c, $opt_w, $opt_H, $opt_p );
|
||||
$opt_c = $opt_w = $opt_p = $opt_H = '';
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
# Just in case of problems, let's not hang NetSaint
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "Plugin Timeout\n";
|
||||
exit 2;
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
delete @ENV{ 'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV' };
|
||||
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure( 'bundling', 'no_ignore_case' );
|
||||
GetOptions(
|
||||
"V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"p|packets=i" => \$opt_p,
|
||||
"c|critical=s" => \$opt_c,
|
||||
"w|warning=s" => \$opt_w,
|
||||
"H|hostname=s" => \$opt_H
|
||||
);
|
||||
|
||||
|
||||
# appletalk hostname ot address
|
||||
$opt_H = shift unless ($opt_H);
|
||||
unless ($opt_H) { print_usage (); exit $ERRORS{'UNKNOWN'}; }
|
||||
if ( $opt_H && $opt_H =~ m/^([-a-zA-Z\.\:0-9]+)$/ ) {
|
||||
$host = $1;
|
||||
}
|
||||
else {
|
||||
print "$opt_H is not a valid host name\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
# number of packets
|
||||
$opt_p = 5 unless $opt_p;
|
||||
if ( $opt_p && $opt_p =~ m/^([1-9]+[0-9]*)$/ ) {
|
||||
$count = $1;
|
||||
}
|
||||
else {
|
||||
print "$opt_p is not a valid packet number\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ( $opt_w && $opt_w =~ m/^([1-9]+[0-9]*),([1-9][0-9]*)%$/ ) {
|
||||
$warning_avg = $1;
|
||||
$warning_loss = $2;
|
||||
}
|
||||
else {
|
||||
print "$opt_w is not a valid threshold\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ( $opt_c && $opt_c =~ m/^([1-9]+[0-9]*),([1-9][0-9]*)%$/ ) {
|
||||
$critical_avg = $1;
|
||||
$critical_loss = $2;
|
||||
}
|
||||
else {
|
||||
print "$opt_c is not a valid threshold\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
$cmd = "/usr/bin/aecho -c $count $host 2>&1 |";
|
||||
print "$cmd\n" if ($verbose);
|
||||
open CMD, $cmd;
|
||||
|
||||
while (<CMD>) {
|
||||
print $_ if ($verbose);
|
||||
$line = $_;
|
||||
|
||||
# 5 packets sent, 5 packets received, 0% packet loss
|
||||
# round-trip (ms) min/avg/max = 0/0/0
|
||||
|
||||
if (/received, ([0-9]+)% packet loss/) {
|
||||
$loss = $1;
|
||||
}
|
||||
if (/min\/avg\/max = [0-9]+\/([0-9]+)\/[0-9]+/) {
|
||||
$avg = $1;
|
||||
}
|
||||
}
|
||||
|
||||
sub print_help() {
|
||||
print_revision( $PROGNAME, '$Revision$ ' );
|
||||
print "Copyright (c) 2002 Stefan Beck\n";
|
||||
print "\n";
|
||||
print "Check if an atalkhost responds to an atalk echo using\n";
|
||||
print " aecho -c <packets> <atalkhost>\n";
|
||||
print "\n";
|
||||
print_usage ();
|
||||
print "\n";
|
||||
print "-H, --hostname=HOST\n";
|
||||
print " host to ping\n";
|
||||
print "-w, --warning=THRESHOLD\n";
|
||||
print " warning threshold pair\n";
|
||||
print "-c, --critical=THRESHOLD\n";
|
||||
print " critical threshold pair\n";
|
||||
print "-p, --packets=INTEGER\n";
|
||||
print " number of ICMP ECHO packets to send (Default: 5)\n";
|
||||
print "\n";
|
||||
print
|
||||
"THRESHOLD is <rta>,<pl>% where <rta> is the round trip average
|
||||
travel\n";
|
||||
print
|
||||
"time (ms) which triggers a WARNING or CRITICAL state, and <pl>
|
||||
is the\n";
|
||||
print "percentage of packet loss to trigger an alarm state.\n";
|
||||
print "\n";
|
||||
|
||||
support();
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "$PROGNAME -H atalkhost -w <wrta>,<wpl>% -c <crta>,<cpl>%\n";
|
||||
print " [-p packets] [-t timeout] [-L]\n";
|
||||
print "$PROGNAME [-h | --help]\n";
|
||||
print "$PROGNAME [-V | --version]\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision( $PROGNAME, '$Revision$ ' );
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help ();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
my $state = "OK";
|
||||
my $answer = undef;
|
||||
|
||||
if ( defined $loss && defined $avg ) {
|
||||
if ( $loss >= $critical_loss ) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ( $avg >= $critical_avg ) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ( $loss >= $warning_loss ) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
elsif ( $avg >= $warning_avg ) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
else {
|
||||
$state = "OK";
|
||||
}
|
||||
$answer = "Appletalk PING $state - Packet loss = $loss%, RTA = $avg
|
||||
ms\n";
|
||||
}
|
||||
else {
|
||||
$state = "UNKNOWN";
|
||||
$answer = "UNKNOWN - $line";
|
||||
}
|
||||
print $answer;
|
||||
exit $ERRORS{$state};
|
||||
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
This sf.net email is sponsored by:ThinkGeek
|
||||
Welcome to geek heaven.
|
||||
http://thinkgeek.com/sf
|
||||
_______________________________________________
|
||||
Nagios-devel mailing list
|
||||
Nagios-devel@lists.sourceforge.net
|
||||
https://lists.sourceforge.net/lists/listinfo/nagios-devel
|
||||
120
contrib/check_arping.pl
Normal file
120
contrib/check_arping.pl
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# check_arping.pl - Nagios plugin to check host status via ARP ping
|
||||
#
|
||||
# usage:
|
||||
# check_arping -H hostname -I interface -T timeout
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2003 Kenny Root
|
||||
#
|
||||
# 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: kenny@the-b.org, nagiosplug-help@lists.sf.net
|
||||
|
||||
use POSIX;
|
||||
use strict;
|
||||
use lib "/usr/lib/nagios/plugins" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
use Net::Arping;
|
||||
use Getopt::Long;
|
||||
|
||||
my $PROGNAME = "check_arping";
|
||||
|
||||
my($status, $state, $answer);
|
||||
my($opt_V, $opt_h, $opt_t, $opt_I, $opt_H);
|
||||
|
||||
|
||||
#Option checking
|
||||
$status = GetOptions(
|
||||
"V|version" => \$opt_V,
|
||||
"help" => \$opt_h,
|
||||
"I|interface=s" => \$opt_I,
|
||||
"H|host=s" => \$opt_H,
|
||||
"t|timeout=i" => \$opt_t);
|
||||
|
||||
if ($status == 0)
|
||||
{
|
||||
print_help() ;
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_t) {
|
||||
if ($opt_t ne int($opt_t)) {
|
||||
print "Timeout not in seconds!\n";
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
$opt_t = int($opt_t);
|
||||
} else {
|
||||
$opt_t = 3;
|
||||
}
|
||||
|
||||
if (! utils::is_hostname($opt_H)){
|
||||
usage();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
my $ping = Net::Arping->new();
|
||||
|
||||
my $reply = $ping->arping(Host => $opt_H, Interface => $opt_I, Timeout => $opt_t);
|
||||
|
||||
if ($reply eq "0") {
|
||||
$state = "CRITICAL";
|
||||
print "$state: no reply from $opt_H on interface $opt_I in $opt_t seconds.\n";
|
||||
exit $ERRORS{$state};
|
||||
} else {
|
||||
$state = "OK";
|
||||
$answer = "replied with MAC address $reply";
|
||||
}
|
||||
|
||||
print "ARPING $state - $answer\n";
|
||||
exit $ERRORS{$state};
|
||||
|
||||
|
||||
sub usage {
|
||||
print "\nMissing arguments!\n";
|
||||
print "\n";
|
||||
print "check_arping -I <interface> -H <host IP> [-t <timeout>]\n";
|
||||
print "\n\n";
|
||||
support();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
sub print_help {
|
||||
print "check_arping pings hosts that normally wouldn't allow\n";
|
||||
print "ICMP packets but are still on the local network.\n";
|
||||
print "\nUsage:\n";
|
||||
print " -H (--host) IP to query - (required)\n";
|
||||
print " -I (--interface) Interface to use.\n";
|
||||
print " -t (--timeout) Timeout in seconds.\n";
|
||||
print " -V (--version) Plugin version\n";
|
||||
print " -h (--help) usage help \n\n";
|
||||
print_revision($PROGNAME, '$Revision$');
|
||||
|
||||
}
|
||||
259
contrib/check_asterisk.pl
Normal file
259
contrib/check_asterisk.pl
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use IO::Socket;
|
||||
use Getopt::Long;
|
||||
$|=1;
|
||||
|
||||
my (
|
||||
$host, $username, $password, $verbose, $help, $command, $mode,
|
||||
$ipaddr, $respaddr, $sendto, $msg, $recvfrom,
|
||||
$version, $response, $message, $line,
|
||||
$sock, $port, $reply,
|
||||
$warning, $critical,
|
||||
%warnval, %critval,
|
||||
%channels,
|
||||
$runmode,
|
||||
$key,
|
||||
$s,
|
||||
);
|
||||
my $stop = 0;
|
||||
my $mgr_port = 5038;
|
||||
my $iax_port = 4569;
|
||||
my $exitcode = 0;
|
||||
my $cause = "";
|
||||
|
||||
my $iax_answer = 0;
|
||||
my $iax_maxlen = 1024;
|
||||
my $iax_timeout = 5;
|
||||
my $iax_src_call = "8000"; #8000 most siginificant bit is IAX packet type full ... required for a poke etc...
|
||||
my $iax_dst_call = "0000";
|
||||
my $iax_timestamp = "00000000";
|
||||
my $iax_outbound_seq = "00";
|
||||
my $iax_inbound_seq = "00";
|
||||
my $iax_type = "06"; #IAX_Control
|
||||
|
||||
sub ok {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "OK: $s\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
sub warning {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "WARNING: $s\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sub error {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "ERROR: $s\n";
|
||||
exit(2);
|
||||
}
|
||||
|
||||
sub unknown {
|
||||
$s = shift;
|
||||
$s =~ s/[\r\n]//g;
|
||||
print "UNKNOWN: $s\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
sub syntax {
|
||||
$s = shift;
|
||||
unless ($s =~ m/Help:/) {
|
||||
$s = "Error: (".$s.")" or $s = 'Unknown';
|
||||
}
|
||||
print "$s\n" unless ($help);
|
||||
print "Syntax: $0 -m mgr -h <host> -u <username> -p <password> [-cwv]\n";
|
||||
print "Syntax: $0 -m iax -h <host> [-v]\n";
|
||||
print "* --host -h Host\n";
|
||||
print "* --mode -m Mode - eithr 'mgr' or 'iax'\n";
|
||||
print " --username -u Username\n";
|
||||
print " --password -p Password\n";
|
||||
print " --port -P n Port (if not using $mgr_port for manager or $iax_port for IAX)\n";
|
||||
print " --warning xxx=n Return warning if > n channels of type xxx.\n";
|
||||
print " --critical xxx=n Return critical if > n channels of type xxx.\n";
|
||||
print " --verbose -v Verbose\n";
|
||||
print " --help -h This help\n";
|
||||
exit(3);
|
||||
}
|
||||
|
||||
Getopt::Long::Configure('bundling');
|
||||
GetOptions
|
||||
("p=s" => \$password, "password=s" => \$password,
|
||||
"u=s" => \$username, "username=s" => \$username,
|
||||
"h=s" => \$host, "host=s" => \$host,
|
||||
"P=i" => \$port, "port=i" => \$port,
|
||||
"H" => \$help, "help" => \$help,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"m=s" => \$mode, "mode=s" => \$mode,
|
||||
"critical=s" => \$critical, "warning=s" => \$warning);
|
||||
|
||||
syntax("Help:") if ($help);
|
||||
syntax("Missing host") unless (defined($host));
|
||||
syntax("Missing mode") unless (defined($mode));
|
||||
if ($mode =~ /^iax$/i) {
|
||||
print "Running in IAX mode\n" if ($verbose);
|
||||
$runmode = 1;
|
||||
} elsif ($mode =~ /^mgr$/i) {
|
||||
print "Running in Manager mode\n" if ($verbose);
|
||||
$runmode = 2;
|
||||
} else {
|
||||
syntax("Unknown mode $mode")
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
|
||||
if ($runmode == 2) {
|
||||
$port = $mgr_port;
|
||||
syntax("Missing username") unless (defined($username));
|
||||
syntax("Missing password") unless (defined($password));
|
||||
if (defined($warning)) {
|
||||
foreach $s (split(/,/, $warning)) {
|
||||
syntax("Warning value given, $s, is invalid")
|
||||
unless ($s =~ /^(\w+)=(\d+)$/);
|
||||
$warnval{$1} = $2;
|
||||
print "Clear to give WARNING after $2 connections on $1\n" if ($verbose);
|
||||
}
|
||||
}
|
||||
if (defined($critical)) {
|
||||
foreach $s (split(/,/, $critical)) {
|
||||
syntax("Critical value given, $s, is invalid")
|
||||
unless ($s =~ /^(\w+)=(\d+)$/);
|
||||
$critval{$1} = $2;
|
||||
print "Clear to give CRITICAL after $2 connections on $1\n" if ($verbose);
|
||||
}
|
||||
}
|
||||
|
||||
print "Connecting to $host:$port\n" if ($verbose);
|
||||
unless ($sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, Proto => 'tcp')) {
|
||||
print("Could not connect to asterisk server ".$host.":".$port."\n");
|
||||
exit(2);
|
||||
}
|
||||
print "Connected to $host:$port\n" if ($verbose);
|
||||
$version = <$sock>;
|
||||
print $version if ($verbose);
|
||||
|
||||
print $sock "Action: Login\r\nUsername: $username\r\nSecret: $password\r\nEvents: off\r\n\r\n";
|
||||
print "Action: Login\r\nUsername: $username\r\nSecret: $password\r\n\r\n" if ($verbose);
|
||||
$response = <$sock>;
|
||||
$message = <$sock>;
|
||||
$s = <$sock>;
|
||||
print $response.$message if ($verbose);
|
||||
print $s if ($verbose);
|
||||
|
||||
exit(1) unless ($response =~ m/^Response:\s+(.*)$/i);
|
||||
exit(1) unless ($1 =~ m/Success/i);
|
||||
|
||||
print $sock "Action: Status\r\n\r\n";
|
||||
print "Action: Status\r\n\r\n" if ($verbose);
|
||||
|
||||
$response = <$sock>;
|
||||
$message = <$sock>;
|
||||
print $response.$message if ($verbose);
|
||||
|
||||
&unknown("Unknown answer $response (wanted Response: something)") unless ($response =~ m/^Response:\s+(.*)$/i);
|
||||
&unknown("$response didn't say Success") unless ($1 =~ m/Success/i);
|
||||
&unknown("Unknown answer $response (wanted Message: something)") unless ($message =~ m/^Message:\s+(.*)$/i);
|
||||
&unknown("didn't understand message $message") unless ($1 =~ m/Channel status will follow/i);
|
||||
|
||||
$stop=0;
|
||||
while (($stop == 0) && ($line = <$sock>)) {
|
||||
print "$line" if ($verbose);
|
||||
if ($line =~ m/Channel:\s+(\w+)\//) {
|
||||
$channels{$1}++;
|
||||
print "Found $1 channel\n" if ($verbose);
|
||||
}
|
||||
if ($line =~ m/Event:\s*StatusComplete/i) {
|
||||
$stop++;
|
||||
}
|
||||
}
|
||||
|
||||
# Log out
|
||||
print $sock "Action: Logoff\r\n\r\n";
|
||||
|
||||
undef($s);
|
||||
foreach $key (keys %channels) {
|
||||
$s .= " " . $key . " (" . $channels{$key} . ")";
|
||||
}
|
||||
|
||||
foreach $key (keys %critval) {
|
||||
print "key = $key\n" if ($verbose);
|
||||
if (defined($channels{$key}) && ($channels{$key} > $critval{$key})) {
|
||||
$exitcode = 2;
|
||||
$cause .= $channels{$key} . " $key channels detected. ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($exitcode < 2) {
|
||||
foreach $key (keys %warnval) {
|
||||
print "key = $key\n" if ($verbose);
|
||||
if (defined($channels{$key}) && ($channels{$key} > $warnval{$key})) {
|
||||
$exitcode = 1;
|
||||
$cause .= $channels{$key} . " $key channels detected. ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($exitcode == 0) {
|
||||
print "OK ";
|
||||
} elsif ($exitcode == 1) {
|
||||
print "WARNING ";
|
||||
} elsif ($exitcode == 2) {
|
||||
print "CRITICAL ";
|
||||
} elsif ($exitcode > 2) {
|
||||
print "UNKNOWN ";
|
||||
}
|
||||
if (defined($s)) {
|
||||
$cause .= " Channels:$s";
|
||||
} else {
|
||||
$cause .= " (idle)";
|
||||
}
|
||||
|
||||
print $cause;
|
||||
|
||||
print "\n" if ($verbose);
|
||||
|
||||
exit($exitcode);
|
||||
} elsif ($runmode == 1) {
|
||||
$port = $iax_port;
|
||||
|
||||
socket(PING, PF_INET, SOCK_DGRAM, getprotobyname("udp"));
|
||||
|
||||
$msg = pack "H24", $iax_src_call . $iax_dst_call . $iax_timestamp .
|
||||
$iax_outbound_seq . $iax_inbound_seq . $iax_type . $iax_type;
|
||||
|
||||
$ipaddr = inet_aton($host);
|
||||
$sendto = sockaddr_in($port,$ipaddr);
|
||||
|
||||
send(PING, $msg, 0, $sendto) == length($msg) or die "cannot send to $host : $port : $!\n";
|
||||
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die("alarm time out"); };
|
||||
alarm $iax_timeout;
|
||||
|
||||
while (1) {
|
||||
$recvfrom = recv(PING, $msg, $iax_maxlen, 0) or die "recv: $!";
|
||||
($port, $ipaddr) = sockaddr_in($recvfrom);
|
||||
$respaddr = inet_ntoa($ipaddr);
|
||||
$iax_answer++;
|
||||
# print "Response from $respaddr : $port\n";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if ($iax_answer) {
|
||||
if ($iax_answer == 1) {
|
||||
$reply = "reply";
|
||||
} else {
|
||||
$reply = "replies";
|
||||
}
|
||||
&ok("Got $iax_answer $reply");
|
||||
} else {
|
||||
&error("Got no reply");
|
||||
}
|
||||
}
|
||||
|
||||
95
contrib/check_axis.sh
Normal file
95
contrib/check_axis.sh
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
#!/bin/sh
|
||||
|
||||
box=$1
|
||||
port=$2
|
||||
usr=$3
|
||||
pass=$4
|
||||
|
||||
if [ ! "$#" == "4" ]; then
|
||||
echo -e "\nYou did not supply enough command line arguments. \nUsage: ./check_axis.sh <host> <port> <username> <password> \n \nCheck_axis.sh checks the status of LPT ports on Axis print servers. \nIt was written by Tom De Blende (tom.deblende@village.uunet.be) in 2002. \n" && exit "3"
|
||||
fi
|
||||
|
||||
tempfile=/tmp/status-$box.tmp
|
||||
exit="3"
|
||||
|
||||
ftp -in $box &>/dev/null <<EOF
|
||||
user $usr $pass
|
||||
passive
|
||||
prompt off
|
||||
lcd /tmp
|
||||
ascii
|
||||
get status $tempfile
|
||||
EOF
|
||||
|
||||
if [ ! -e "$tempfile" ]; then
|
||||
stdio="Status file could not be transferred from the Axis box." && rm -f $tempfile && echo $stdio && exit 2;
|
||||
fi
|
||||
|
||||
lines=`cat $tempfile | grep -i $port`
|
||||
status=`echo $lines | awk '{ print $3 }'`
|
||||
if [ "$status" == "Printing" ]; then
|
||||
bytes=`echo $lines | awk '{ print $4 }'`;
|
||||
comments=`echo $lines | tr -d "
|
||||
" | awk '{ print $5 " " $6 }'`;
|
||||
else
|
||||
comments=`echo $lines | tr -d "
|
||||
" | awk '{ print $4 " " $5 }'`;
|
||||
fi
|
||||
|
||||
comma=`echo $comments | grep , | wc -l`
|
||||
if [ "$comma" -eq "1" ]; then
|
||||
comments=`echo $comments | cut -d, -f1`
|
||||
fi
|
||||
|
||||
|
||||
if [ "$status" == "Available" ]; then
|
||||
if [ "$comments" == "Paper out" ]; then
|
||||
exit="1" && stdio="WARNING - Out of paper.";
|
||||
elif [ "$comments" == " " ]; then
|
||||
exit="0" && stdio="OK - Printer is available but returns no comments.";
|
||||
elif [ "$comments" == "No error" ]; then
|
||||
exit="0" && stdio="OK - No error.";
|
||||
elif [ "$comments" == "Ready " ]; then
|
||||
exit="0" && stdio="OK - Ready.";
|
||||
elif [ "$comments" == "Off line" ]; then
|
||||
exit="1" && stdio="WARNING - Printer is off line.";
|
||||
elif [ "$comments" == "Out of" ]; then
|
||||
exit="1" && stdio="WARNING - Out of paper.";
|
||||
elif [ "$comments" == "Busy Out" ]; then
|
||||
exit="1" && stdio="WARNING - Busy, out of paper.";
|
||||
elif [ "$comments" == "Printer off-line" ]; then
|
||||
exit="1" && stdio="WARNING - Printer is off line.";
|
||||
elif [ "$comments" == "Printer fault" ]; then
|
||||
exit="2" && stdio="CRITICAL - Printer fault.";
|
||||
else
|
||||
exit="3" && stdio="Comments: $comments";
|
||||
fi
|
||||
elif [ "$status" == "Printing" ]; then
|
||||
if [ "$comments" == "Printer busy" ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "No error" ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Paper out" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Out of paper.";
|
||||
elif [ "$comments" == "Out of" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Out of paper. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Busy Out" ]; then
|
||||
exit="1" && stdio="WARNING - Busy, out of paper.";
|
||||
elif [ "$comments" == "Ready " ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Printer off-line" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Printer is off line.";
|
||||
elif [ "$comments" == "Busy " ]; then
|
||||
exit="0" && stdio="OK - PRINTING. Busy. Bytes printed: $bytes.";
|
||||
elif [ "$comments" == "Off line" ]; then
|
||||
exit="1" && stdio="WARNING - PRINTING. Printer is off line.";
|
||||
elif [ "$comments" == "Printer fault" ]; then
|
||||
exit="2" && stdio="CRITICAL - PRINTING. Printer fault. Bytes printed: $bytes.";
|
||||
else
|
||||
exit="3" && stdio="Comments: $comments.";
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f $tempfile
|
||||
echo $stdio
|
||||
exit $exit
|
||||
114
contrib/check_backup.pl
Normal file
114
contrib/check_backup.pl
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
#! /usr/bin/perl -wT
|
||||
|
||||
# (c)2001 Patrick Greenwell, Stealthgeeks, LLC. (patrick@stealthgeeks.net)
|
||||
# Licensed under the GNU GPL
|
||||
# http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
# check_backup: Checks a directory to see if at least one file was
|
||||
# created within a specified period of time that is of equal to or greater
|
||||
# than a given size.
|
||||
|
||||
# Version 1.0
|
||||
# Last Updated: 9/12/01
|
||||
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
require 5.004;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_H $opt_d $opt_s $opt_t $verbose $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support &is_error);
|
||||
|
||||
sub help ();
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub version ();
|
||||
sub display_res($$);
|
||||
my ($filesize, $answer) = ();
|
||||
my $state = $ERRORS{'UNKNOWN'};
|
||||
|
||||
# Directory to check.
|
||||
my $dir = "/backup/";
|
||||
|
||||
# Time period(in seconds)
|
||||
my $within = "3600";
|
||||
|
||||
# Minimum size of file (in bytes)
|
||||
my $minsize = "40000000";
|
||||
|
||||
delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$verbose,
|
||||
"d|directory=s" => \$opt_d,
|
||||
"s|minsize=s" => \$opt_s,
|
||||
"t|timeout=s" => \$opt_t,
|
||||
);
|
||||
|
||||
($opt_s) || ($opt_s = shift) || usage("Minimum File size not specified\n");
|
||||
usage("File size must be numeric value") unless ($opt_s =~ m/^[0-9]+$/);
|
||||
|
||||
(($opt_t) && ($TIMEOUT = $opt_t)) || ($TIMEOUT = 120);
|
||||
usage("TIMEOUT must be numeric value") unless ($TIMEOUT =~ m/^[0-9]+$/);
|
||||
|
||||
# Don't hang if there are timeout issues
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from ftp server (alarm)\n");
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
# Do stuff
|
||||
|
||||
my $time = time;
|
||||
|
||||
opendir(THISDIR, "$dir") or die "Can't open directory! $!";
|
||||
my @allfiles = grep !/^\./, readdir THISDIR;
|
||||
closedir THISDIR;
|
||||
while (my $file = $dir . pop @allfiles){
|
||||
my ($size, $mtime) = (stat($file))[7,9];
|
||||
if (((my $a = ($time - $mtime)) <= $within) and ($size >= $opt_s)){
|
||||
display_res("OK: File $file is <= $within and >=$opt_s bytes.\n","OK");
|
||||
}
|
||||
}
|
||||
|
||||
# If we got here nothing matched....
|
||||
display_res("CRITICAL: No files in $dir are <= $within and >= $minsize.", "CRITICAL");
|
||||
|
||||
exit;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -s <minimum file size in bytes> -t <timeout> \n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$ Revision: 1.0 $ ');
|
||||
print_usage();
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$ Revision: 1.0 $ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub display_res ($$) {
|
||||
my ($answer, $state) = @_;
|
||||
print $answer;
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
215
contrib/check_bgpstate.pl
Normal file
215
contrib/check_bgpstate.pl
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_bgpstate.pl - nagios plugin
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
# whois programm for RIPE database queries
|
||||
my $whois = '/usr/bin/whois';
|
||||
my $status;
|
||||
my $TIMEOUT = 30;
|
||||
|
||||
# critical bgp sessions
|
||||
my %uplinks = ( 1273, 'Uplink ECRC',
|
||||
1755, 'Uplink EBONE',
|
||||
3300, 'Uplink AUCS'
|
||||
);
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
my %bgpPeerState = (
|
||||
'1',"idle",
|
||||
'2',"connect",
|
||||
'3',"active",
|
||||
'4',"opensent",
|
||||
'5',"openconfirm",
|
||||
'6',"established"
|
||||
);
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
my $snmpbgpPeerState = '1.3.6.1.2.1.15.3.1.2';
|
||||
my $snmpbgpPeerLocalAddr = '1.3.6.1.2.1.15.3.1.5';
|
||||
my $snmpbgpPeerRemoteAddr = '1.3.6.1.2.1.15.3.1.7';
|
||||
my $snmpbgpPeerRemoteAs = '1.3.6.1.2.1.15.3.1.9';
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %bgpStatus;
|
||||
my $bgpestablished =0 ;
|
||||
my $bgpcritical =0;
|
||||
my $bgpdown =0;
|
||||
my $bgpidle =0;
|
||||
my $bgpmessage;
|
||||
my $asname;
|
||||
my $remoteas;
|
||||
my @output;
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl bgpstate plugin for Nagios\n";
|
||||
printf "monitors all BGP sessions\n";
|
||||
printf "usage: \n";
|
||||
printf "check_bgpstate.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>\n";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_bgpstate.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"};
|
||||
}
|
||||
|
||||
# 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);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
push(@snmpoids, $snmpbgpPeerState);
|
||||
push(@snmpoids, $snmpbgpPeerLocalAddr);
|
||||
push(@snmpoids, $snmpbgpPeerRemoteAddr);
|
||||
push(@snmpoids, $snmpbgpPeerRemoteAs);
|
||||
|
||||
foreach $snmpoid (@snmpoids) {
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_table($snmpoid))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$snmpkey");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
foreach $snmpkey (keys %{$response}) {
|
||||
$snmpkey =~ m/.*\.(\d+\.\d+\.\d+\.\d+$)/;
|
||||
$key = $1;
|
||||
# printf "debug: $snmpkey: $key -> $response->{$snmpkey}\n";
|
||||
$bgpStatus{$key}{$snmpoid} = $response->{$snmpkey};
|
||||
}
|
||||
$session->close;
|
||||
}
|
||||
|
||||
foreach $key (keys %bgpStatus) {
|
||||
if ($bgpStatus{$key}{$snmpbgpPeerState} == 6 ) {
|
||||
$bgpestablished++;
|
||||
}
|
||||
elsif ($bgpStatus{$key}{$snmpbgpPeerState} == 1 ) {
|
||||
$bgpidle++;
|
||||
}
|
||||
else {
|
||||
$bgpdown++ ;
|
||||
if (exists($uplinks{$bgpStatus{$key}{$snmpbgpPeerRemoteAs}}) ) {
|
||||
$bgpcritical++;
|
||||
}
|
||||
@output = `$whois -T aut-num AS$bgpStatus{$key}{$snmpbgpPeerRemoteAs}`;
|
||||
|
||||
$asname = "";
|
||||
foreach (@output) {
|
||||
if (m/as-name/) {
|
||||
$asname = $_;
|
||||
$asname =~ s/as-name://;
|
||||
last;
|
||||
}
|
||||
if ( $asname =~ "" && m/descr/ ) {
|
||||
$asname = $_;
|
||||
$asname =~ s/descr://;
|
||||
}
|
||||
}
|
||||
$asname =~ s/^\s*//;
|
||||
$asname =~ s/\s*$//;
|
||||
$bgpmessage .= sprintf("Peering with AS%s not established -> %s<BR>",
|
||||
$bgpStatus{$key}{$snmpbgpPeerRemoteAs},
|
||||
$asname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($bgpdown > 0) {
|
||||
if ($bgpcritical > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
else {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
$answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d<BR>",
|
||||
$hostname,
|
||||
$bgpestablished,
|
||||
$bgpdown, $bgpidle);
|
||||
$answer = $answer . $bgpmessage . "\n";
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
$answer = sprintf("host '%s', sessions up: %d, down: %d, shutdown: %d\n",
|
||||
$hostname,
|
||||
$bgpestablished,
|
||||
$bgpdown,$bgpidle);
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
||||
22
contrib/check_breeze.pl
Normal file
22
contrib/check_breeze.pl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Plugin to test signal strength on Breezecom wireless equipment
|
||||
# Contributed by Jeffrey Blank
|
||||
|
||||
$Host=$ARGV[0];
|
||||
$sig_crit=$ARGV[1];
|
||||
$sig_warn=$ARGV[2];
|
||||
$sig=0;
|
||||
$sig = `snmpget $Host public .1.3.6.1.4.1.710.3.2.3.1.3.0`;
|
||||
@test=split(/ /,$sig);
|
||||
$sig=@test[2];
|
||||
$sig=int($sig);
|
||||
if ($sig>100){$sig=100}
|
||||
|
||||
print "Signal Strength at: $sig%\n";
|
||||
if ($sig<$sig_crit)
|
||||
{exit(2)}
|
||||
if ($sig<$sig_warn)
|
||||
{exit(1)}
|
||||
|
||||
exit(0);
|
||||
332
contrib/check_cluster.c
Normal file
332
contrib/check_cluster.c
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* CHECK_CLUSTER.C - Host and Service Cluster Plugin for NetSaint
|
||||
*
|
||||
* Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)
|
||||
* License: GPL
|
||||
* Last Modified: 07-08-2000
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CHECK_SERVICES 1
|
||||
#define CHECK_HOSTS 2
|
||||
|
||||
#define MAX_INPUT_BUFFER 1024
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3
|
||||
|
||||
typedef struct clustermember_struct{
|
||||
char *host_name;
|
||||
char *svc_description;
|
||||
struct clustermember_struct *next;
|
||||
}clustermember;
|
||||
|
||||
|
||||
int check_cluster_status(void);
|
||||
int add_clustermember(char *,char *);
|
||||
void free_memory(void);
|
||||
|
||||
clustermember *clustermember_list=NULL;
|
||||
|
||||
int total_services_ok=0;
|
||||
int total_services_warning=0;
|
||||
int total_services_unknown=0;
|
||||
int total_services_critical=0;
|
||||
|
||||
int total_hosts_up=0;
|
||||
int total_hosts_down=0;
|
||||
int total_hosts_unreachable=0;
|
||||
|
||||
char status_log[MAX_INPUT_BUFFER]="";
|
||||
int warning_threshold=0;
|
||||
int critical_threshold=0;
|
||||
|
||||
int check_type=CHECK_SERVICES;
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *host_name;
|
||||
char *svc_description;
|
||||
int return_code=STATE_OK;
|
||||
int error=FALSE;
|
||||
|
||||
if(argc!=5){
|
||||
|
||||
printf("Invalid arguments supplied\n");
|
||||
printf("\n");
|
||||
|
||||
printf("Host/Service Cluster Plugin for NetSaint\n");
|
||||
printf("Copyright (c) 2000 Ethan Galstad (netsaint@netsaint.org)\n");
|
||||
printf("Last Modified: 07-08-2000\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <--service | --host> <status_log> <warn_threshold> <crit_threshold>\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" --service = Check service cluster status\n");
|
||||
printf(" --host = Check host cluster status\n");
|
||||
printf(" <status_log> = This is the location of the NetSaint status log\n");
|
||||
printf(" <warn_threshold> = This is the number of hosts or services in\n");
|
||||
printf(" the cluster that must be in a non-OK state\n");
|
||||
printf(" in order to result in a warning status level\n");
|
||||
printf(" <crit_threshold> = This is the number of hosts or services in\n");
|
||||
printf(" the cluster that must be in a non-OK state\n");
|
||||
printf(" in order to result in a critical status level\n");
|
||||
printf("\n");
|
||||
printf("Notes:\n");
|
||||
printf("Members of the host or service cluster are read from STDIN.\n");
|
||||
printf("One host or service can be specified per line, services must\n");
|
||||
printf("be in the format of <host_name>;<svc_description>\n");
|
||||
printf("\n");
|
||||
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* see if we're checking a host or service clust */
|
||||
if(!strcmp(argv[1],"--host"))
|
||||
check_type=CHECK_HOSTS;
|
||||
else
|
||||
check_type=CHECK_SERVICES;
|
||||
|
||||
/* get the status log */
|
||||
strncpy(status_log,argv[2],sizeof(status_log)-1);
|
||||
status_log[sizeof(status_log)-1]='\x0';
|
||||
|
||||
/* get the warning and critical thresholds */
|
||||
warning_threshold=atoi(argv[3]);
|
||||
critical_threshold=atoi(argv[4]);
|
||||
|
||||
|
||||
/* read all data from STDIN until there isn't anymore */
|
||||
while(fgets(input_buffer,sizeof(input_buffer)-1,stdin)){
|
||||
|
||||
if(feof(stdin))
|
||||
break;
|
||||
|
||||
/*strip(input_buffer);*/
|
||||
|
||||
if(!strcmp(input_buffer,""))
|
||||
continue;
|
||||
|
||||
if(!strcmp(input_buffer,"\n"))
|
||||
continue;
|
||||
|
||||
/* get the host name */
|
||||
if(check_type==CHECK_SERVICES)
|
||||
host_name=(char *)strtok(input_buffer,";");
|
||||
else
|
||||
host_name=(char *)strtok(input_buffer,"\n");
|
||||
if(host_name==NULL || !strcmp(host_name,"")){
|
||||
printf("Error: Host name is NULL!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
|
||||
/* get the service description */
|
||||
svc_description=(char *)strtok(NULL,"\n");
|
||||
if(svc_description==NULL || !strcmp(svc_description,"")){
|
||||
printf("Error: Service description is NULL!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* add the cluster member to the list in memory */
|
||||
if(add_clustermember(host_name,svc_description)!=OK)
|
||||
printf("Error: Could not add cluster member\n");
|
||||
#ifdef DEBUG
|
||||
else
|
||||
printf("Added cluster member\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* check the status of the cluster */
|
||||
if(check_cluster_status()==OK){
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
if((total_services_warning+total_services_unknown+total_services_critical) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_services_warning+total_services_unknown+total_services_critical) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
|
||||
printf("Service cluster %s: %d ok, %d warning, %d unknown, %d critical\n",(return_code==STATE_OK)?"ok":"problem",total_services_ok,total_services_warning,total_services_unknown,total_services_critical);
|
||||
}
|
||||
else{
|
||||
if((total_hosts_down+total_hosts_unreachable) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_hosts_down+total_hosts_unreachable) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
|
||||
printf("Host cluster %s: %d up, %d down, %d unreachable\n",(return_code==STATE_OK)?"ok":"problem",total_hosts_up,total_hosts_down,total_hosts_unreachable);
|
||||
}
|
||||
}
|
||||
else
|
||||
return_code=STATE_UNKNOWN;
|
||||
|
||||
free_memory();
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int add_clustermember(char *hst,char *svc){
|
||||
clustermember *new_clustermember;
|
||||
|
||||
new_clustermember=(clustermember *)malloc(sizeof(clustermember));
|
||||
if(new_clustermember==NULL)
|
||||
return ERROR;
|
||||
|
||||
new_clustermember->host_name=NULL;
|
||||
new_clustermember->svc_description=NULL;
|
||||
|
||||
if(hst!=NULL){
|
||||
new_clustermember->host_name=(char *)malloc(strlen(hst)+1);
|
||||
if(new_clustermember->host_name==NULL){
|
||||
free(new_clustermember);
|
||||
return ERROR;
|
||||
}
|
||||
strcpy(new_clustermember->host_name,hst);
|
||||
}
|
||||
|
||||
if(svc!=NULL){
|
||||
new_clustermember->svc_description=(char *)malloc(strlen(svc)+1);
|
||||
if(new_clustermember->svc_description==NULL){
|
||||
if(new_clustermember->host_name!=NULL)
|
||||
free(new_clustermember->host_name);
|
||||
free(new_clustermember);
|
||||
return ERROR;
|
||||
}
|
||||
strcpy(new_clustermember->svc_description,svc);
|
||||
}
|
||||
|
||||
new_clustermember->next=clustermember_list;
|
||||
clustermember_list=new_clustermember;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
void free_memory(void){
|
||||
clustermember *this_clustermember;
|
||||
clustermember *next_clustermember;
|
||||
|
||||
for(this_clustermember=clustermember_list;this_clustermember!=NULL;this_clustermember=next_clustermember){
|
||||
next_clustermember=this_clustermember->next;
|
||||
if(this_clustermember->host_name!=NULL)
|
||||
free(this_clustermember->host_name);
|
||||
if(this_clustermember->svc_description!=NULL)
|
||||
free(this_clustermember->svc_description);
|
||||
free(this_clustermember);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int check_cluster_status(void){
|
||||
FILE *fp;
|
||||
clustermember *temp_clustermember;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char matching_entry[MAX_INPUT_BUFFER];
|
||||
|
||||
fp=fopen(status_log,"r");
|
||||
if(fp==NULL){
|
||||
printf("Error: Could not open status log '%s' for reading\n",status_log);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
if(check_type==CHECK_HOSTS)
|
||||
printf("Cluster member: '%s'\n",temp_clustermember->host_name);
|
||||
else
|
||||
printf("Cluster member: '%s'/'%s'\n",temp_clustermember->host_name,temp_clustermember->svc_description);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp);!feof(fp);fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
|
||||
/* this is a host entry */
|
||||
if(strstr(input_buffer,"] HOST;") && check_type==CHECK_HOSTS){
|
||||
|
||||
/* this this a match? */
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
|
||||
snprintf(matching_entry,sizeof(matching_entry)-1,";%s;",temp_clustermember->host_name);
|
||||
|
||||
if(strstr(input_buffer,matching_entry)){
|
||||
if(strstr(input_buffer,";DOWN;"))
|
||||
total_hosts_down++;
|
||||
else if(strstr(input_buffer,";UNREACHABLE;"))
|
||||
total_hosts_unreachable++;
|
||||
else if(strstr(input_buffer,";UP;"))
|
||||
total_hosts_up++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* this is a service entry */
|
||||
else if(strstr(input_buffer,"] SERVICE;") && check_type==CHECK_SERVICES){
|
||||
|
||||
/* this this a match? */
|
||||
for(temp_clustermember=clustermember_list;temp_clustermember!=NULL;temp_clustermember=temp_clustermember->next){
|
||||
|
||||
snprintf(matching_entry,sizeof(matching_entry)-1,";%s;%s;",temp_clustermember->host_name,temp_clustermember->svc_description);
|
||||
|
||||
if(strstr(input_buffer,matching_entry)){
|
||||
if(strstr(input_buffer,";HOST DOWN;") || strstr(input_buffer,";UNREACHABLE;") || strstr(input_buffer,";CRITICAL;"))
|
||||
total_services_critical++;
|
||||
else if(strstr(input_buffer,";WARNING;"))
|
||||
total_services_warning++;
|
||||
else if(strstr(input_buffer,";UNKNOWN;"))
|
||||
total_services_unknown++;
|
||||
else if(strstr(input_buffer,";OK;") || strstr(input_buffer,";RECOVERY;"))
|
||||
total_services_ok++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
232
contrib/check_cluster2.c
Normal file
232
contrib/check_cluster2.c
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* CHECK_CLUSTER2.C - Host and Service Cluster Plugin for Nagios 2.x
|
||||
*
|
||||
* Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
|
||||
* License: GPL
|
||||
* Last Modified: 03-11-2004
|
||||
*
|
||||
* License:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -1
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CHECK_SERVICES 1
|
||||
#define CHECK_HOSTS 2
|
||||
|
||||
#define MAX_INPUT_BUFFER 1024
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3
|
||||
|
||||
int total_services_ok=0;
|
||||
int total_services_warning=0;
|
||||
int total_services_unknown=0;
|
||||
int total_services_critical=0;
|
||||
|
||||
int total_hosts_up=0;
|
||||
int total_hosts_down=0;
|
||||
int total_hosts_unreachable=0;
|
||||
|
||||
int warning_threshold=1;
|
||||
int critical_threshold=1;
|
||||
|
||||
int check_type=CHECK_SERVICES;
|
||||
|
||||
char *data_vals=NULL;
|
||||
char *label=NULL;
|
||||
|
||||
|
||||
int process_arguments(int,char **);
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *ptr;
|
||||
int data_val;
|
||||
int return_code=STATE_OK;
|
||||
int error=FALSE;
|
||||
|
||||
if(process_arguments(argc,argv)==ERROR){
|
||||
|
||||
printf("Invalid arguments supplied\n");
|
||||
printf("\n");
|
||||
|
||||
printf("Host/Service Cluster Plugin for Nagios 2\n");
|
||||
printf("Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 03-11-2004\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s (-s | -h) [-l label] [-w threshold] [-c threshold] [-d val1,val2,...,valn]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" -s, --service = Check service cluster status\n");
|
||||
printf(" -h, --host = Check host cluster status\n");
|
||||
printf(" -l, --label = Optional prepended text output (i.e. \"Host cluster\")\n");
|
||||
printf(" -w, --warning = Specifies the number of hosts or services in cluster that must be in\n");
|
||||
printf(" a non-OK state in order to return a WARNING status level\n");
|
||||
printf(" -c, --critical = Specifies the number of hosts or services in cluster that must be in\n");
|
||||
printf(" a non-OK state in order to return a CRITICAL status level\n");
|
||||
printf(" -d, --data = The status codes of the hosts or services in the cluster, separated\n");
|
||||
printf(" by commas\n");
|
||||
printf("\n");
|
||||
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* check the data values */
|
||||
for(ptr=strtok(data_vals,",");ptr!=NULL;ptr=strtok(NULL,",")){
|
||||
|
||||
data_val=atoi(ptr);
|
||||
|
||||
if(check_type==CHECK_SERVICES){
|
||||
switch(data_val){
|
||||
case 0:
|
||||
total_services_ok++;
|
||||
break;
|
||||
case 1:
|
||||
total_services_warning++;
|
||||
break;
|
||||
case 2:
|
||||
total_services_critical++;
|
||||
break;
|
||||
case 3:
|
||||
total_services_unknown++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch(data_val){
|
||||
case 0:
|
||||
total_hosts_up++;
|
||||
break;
|
||||
case 1:
|
||||
total_hosts_down++;
|
||||
break;
|
||||
case 2:
|
||||
total_hosts_unreachable++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* return the status of the cluster */
|
||||
if(check_type==CHECK_SERVICES){
|
||||
if((total_services_warning+total_services_unknown+total_services_critical) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_services_warning+total_services_unknown+total_services_critical) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
printf("%s %s: %d ok, %d warning, %d unknown, %d critical\n",(label==NULL)?"Service cluster":label,(return_code==STATE_OK)?"ok":"problem",total_services_ok,total_services_warning,total_services_unknown,total_services_critical);
|
||||
}
|
||||
else{
|
||||
if((total_hosts_down+total_hosts_unreachable) >= critical_threshold)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if((total_hosts_down+total_hosts_unreachable) >= warning_threshold)
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
printf("%s %s: %d up, %d down, %d unreachable\n",(label==NULL)?"Host cluster":label,(return_code==STATE_OK)?"ok":"problem",total_hosts_up,total_hosts_down,total_hosts_unreachable);
|
||||
}
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int process_arguments(int argc, char **argv){
|
||||
int c;
|
||||
int option=0;
|
||||
static struct option longopts[]={
|
||||
{"data", required_argument,0,'d'},
|
||||
{"warning", required_argument,0,'w'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
{"label", required_argument,0,'l'},
|
||||
{"host", no_argument, 0,'h'},
|
||||
{"service", no_argument, 0,'s'},
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
/* no options were supplied */
|
||||
if(argc<2)
|
||||
return ERROR;
|
||||
|
||||
while(1){
|
||||
|
||||
c=getopt_long(argc,argv,"hsw:c:d:l:",longopts,&option);
|
||||
|
||||
if(c==-1 || c==EOF || c==1)
|
||||
break;
|
||||
|
||||
switch(c){
|
||||
|
||||
case 'h': /* host cluster */
|
||||
check_type=CHECK_HOSTS;
|
||||
break;
|
||||
|
||||
case 's': /* service cluster */
|
||||
check_type=CHECK_SERVICES;
|
||||
break;
|
||||
|
||||
case 'w': /* warning threshold */
|
||||
warning_threshold=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'c': /* warning threshold */
|
||||
critical_threshold=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'd': /* data values */
|
||||
data_vals=(char *)strdup(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* text label */
|
||||
label=(char *)strdup(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
return ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(data_vals==NULL)
|
||||
return ERROR;
|
||||
|
||||
return OK;
|
||||
}
|
||||
296
contrib/check_compaq_insight.pl
Normal file
296
contrib/check_compaq_insight.pl
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
From mm@elabnet.de Mon Nov 18 09:59:04 2002
|
||||
Date: Mon, 18 Nov 2002 12:19:04 +0100
|
||||
From: Michael Markstaller <mm@elabnet.de>
|
||||
To: nagiosplug-devel@lists.sourceforge.net
|
||||
Subject: [Nagiosplug-devel] Submission: check_insight / checking Compaq
|
||||
Insight Agent status
|
||||
|
||||
Hi,
|
||||
|
||||
I've been looking to check the status/health of Compaq Insight Agents on
|
||||
servers and found a spong plugin
|
||||
(http://spong.sourceforge.net/downloads/plugins/spong-network/check_insi
|
||||
ght) which I've slightly changed to work with Nagios.
|
||||
I have pretty no idea of perl at all, just wanted to make it work for
|
||||
me, so please don't shoot me for this copy-paste-code. I've tested some
|
||||
basic things, it seems to work at least to report a warning if smthg is
|
||||
degraded and OK of xcourse ;)
|
||||
I'm also quite unsure if this is the right way to submit, so I'll just
|
||||
try ;)
|
||||
There're some "unknown" components on all servers I've checked so far,
|
||||
if anybody has a documentation of what's exactly returned when getting
|
||||
the OID 1.3.6.1.4.1.232.11.2.10.1.0 (CPQHOST_MIB isn't very descriptive)
|
||||
I'd be happy to fix this.
|
||||
|
||||
--- cut ---
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# (c)2002 Michael Markstaller, Elaborated Networks GmbH
|
||||
# send bug reports to <mm@elabnet.de>
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# Check Comapq Insight Management Agents Systems Status by SNMP
|
||||
# based on the spong-plugin check_insight from:
|
||||
#
|
||||
http://spong.sourceforge.net/downloads/plugins/spong-network/check_insig
|
||||
ht
|
||||
#
|
||||
# Usage:
|
||||
# check_insight -H <host> -C community
|
||||
#
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure('bundling');
|
||||
|
||||
$version=0.01;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
#
|
||||
# some default values
|
||||
#
|
||||
$TIMEOUT=15;
|
||||
|
||||
#
|
||||
# get command line options the regular way
|
||||
#
|
||||
GetOptions
|
||||
("V" => \$opt_V, "version" => \$opt_V,
|
||||
"h" => \$opt_h, "help" => \$opt_h,
|
||||
"v" => \$verbose, "verbose" => \$verbose,
|
||||
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
|
||||
"C=s" => \$opt_C, "community=s" => \$opt_C);
|
||||
|
||||
#
|
||||
# handle the verbose stuff first
|
||||
#
|
||||
if ($opt_V) {
|
||||
print "\n";
|
||||
print "check_insight nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You
|
||||
may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General
|
||||
Public License.\n";
|
||||
print "For more information about these matters, see the file
|
||||
named COPYING.\n";
|
||||
print "\n";
|
||||
print "(c)2002 Michael Markstaller, Elaborated Networks GmbH\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#
|
||||
# now get options the weired way and set the defaults
|
||||
# if nothing else is provided
|
||||
#
|
||||
$opt_H = shift unless ($opt_H);
|
||||
print_usage() unless ($opt_H);
|
||||
|
||||
#
|
||||
# dont let us wait forever...
|
||||
#
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: No response from server (alarm)\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
#
|
||||
# now we set things up for the real work
|
||||
# and fire up the request
|
||||
#
|
||||
|
||||
########################################################################
|
||||
########
|
||||
my ($host) = ($opt_H);
|
||||
my ($color, $summary, $message ) = ( "green", "", "" );
|
||||
($opt_C) || ($opt_C = shift) || ($opt_C = "public");
|
||||
my ($community) = $opt_C;
|
||||
|
||||
# We use some look up tables for checking some config options.
|
||||
my (@State) = ("Not Available", "Other", "OK", "Degraded", "Failed");
|
||||
|
||||
my (@MIBName) = ("", "Std", "Unknown", "Array",
|
||||
"Netware", "SCSI", "Health","Unknown",
|
||||
"Store", "SM2", "Thresh", "OS", "UPS",
|
||||
"Unknown", "IDE", "Clusters", "Fibre",
|
||||
"MIB", "NIC");
|
||||
|
||||
# These are the positions within the table to actually look at.
|
||||
my (@MIBs) = (1, 2, 3, 5, 6, 10, 11, 14, 18);
|
||||
|
||||
my ($oid) = "1.3.6.1.4.1.232.11.2.10.1.0"; # SysArray
|
||||
|
||||
# Open the connection.
|
||||
my ($session, $error) = Net::SNMP->session(Hostname => $host,
|
||||
Community => $community);
|
||||
|
||||
# If we can't open a connection, just return red straight away.
|
||||
if (! defined $session) {
|
||||
print ("ERROR: Unable to contact server '$opt_H'\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
|
||||
$session->translate;
|
||||
my ($response) = $session->get_request($oid);
|
||||
|
||||
if (!defined $response) {
|
||||
# If there's no response, something screwy is going on, give up.
|
||||
$summary = $session->error;
|
||||
print ("ERROR: $summary\n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
$session->close;
|
||||
} else {
|
||||
$session->close;
|
||||
|
||||
# I'm not convinced that this is the easiest way to go about this,
|
||||
this is
|
||||
# from some code which I've inherited and I've modified for use in
|
||||
here.
|
||||
# Hi George!
|
||||
%h = %$response;
|
||||
my ($d) = $h{$oid};
|
||||
|
||||
my (@list) = ();
|
||||
|
||||
# Gobble the first two char's.
|
||||
$d = substr $d,2;
|
||||
|
||||
while (length($d) > 0) {
|
||||
my ($v) = substr($d,0,2);
|
||||
$v = hex($v);
|
||||
$d = substr $d,2;
|
||||
push @list, $v;
|
||||
}
|
||||
|
||||
# Value in $MIBs[1] is the overall status of the machine...
|
||||
my ($cond) = $MIBs[1];
|
||||
$message .= "Status: $State[$cond] ";
|
||||
|
||||
foreach my $v (@MIBs) {
|
||||
$cond = $list[($v*4)+1]; # A little bit of magic.
|
||||
|
||||
# We only bother printing the status out if it's actually
|
||||
available,
|
||||
# as if it's N/A or Unknown then it's probably because the machine
|
||||
# isn't available.
|
||||
$message .= "$MIBName[$v]: $State[$cond] " if $cond > 1;
|
||||
next if $cond < 2;
|
||||
|
||||
# What follows is some trickery to try and not to override a
|
||||
previous
|
||||
# message at the same or lower color.
|
||||
if ($cond == 4) {
|
||||
if ($color ne 'red') {
|
||||
$color = 'red';
|
||||
$summary = "$MIBName[$v] is failed";
|
||||
}
|
||||
} elsif ($cond == 3) {
|
||||
if ($color ne 'red') {
|
||||
$color = 'yellow';
|
||||
$summary = "$MIBName[$v] is degraded" if $summary eq "";
|
||||
}
|
||||
} elsif ($cond < 2) {
|
||||
if ($color eq 'green') {
|
||||
$color = 'yellow';
|
||||
$summary = "$MIBName[$v] is unknown ($cond)" if $summary eq
|
||||
"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$summary = "Ok" if $summary eq "";
|
||||
|
||||
# return ($color, $summary, $message);
|
||||
|
||||
if ($color eq 'red') {
|
||||
print ("red Output: $message\n");
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
} elsif ($color eq 'yellow') {
|
||||
print ("$summary $message\n");
|
||||
exit $ERRORS{"WARNING"};
|
||||
} elsif ($color eq 'green') {
|
||||
print ("$message\n");
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $0 -H <host> -C <community> \n"; }
|
||||
|
||||
sub print_help () {
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "check_insight nagios plugin version $version\n";
|
||||
print "\n";
|
||||
print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You
|
||||
may redistribute\n";
|
||||
print "copies of the plugins under the terms of the GNU General
|
||||
Public License.\n";
|
||||
print "For more information about these matters, see the file
|
||||
named COPYING.\n";
|
||||
print "\n";
|
||||
print "(c)2002 Michael Markstaller, Elaborated Networks GmbH\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print "This plugin checks the Compaq Insight Management agents
|
||||
system status via SNMP on the specified host.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "Options:\n";
|
||||
print " -H, --hostname=ADDRESS\n";
|
||||
print " host name argument for server.\n";
|
||||
print " -C, --community=STRING\n";
|
||||
print " SNMP Read-community string.\n";
|
||||
print " -h, --help\n";
|
||||
print " print detailed help screen.\n";
|
||||
print " -V, --version\n";
|
||||
print " print version information.\n";
|
||||
print "\n";
|
||||
print "\n";
|
||||
}
|
||||
--- cut ---
|
||||
|
||||
Michael
|
||||
|
||||
|
||||
-------------------------------------------------------
|
||||
This sf.net email is sponsored by: To learn the basics of securing
|
||||
your web site with SSL, click here to get a FREE TRIAL of a Thawte
|
||||
Server Certificate: http://www.gothawte.com/rd524.html
|
||||
_______________________________________________
|
||||
Nagiosplug-devel mailing list
|
||||
Nagiosplug-devel@lists.sourceforge.net
|
||||
https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
|
||||
430
contrib/check_cpqarray.c
Normal file
430
contrib/check_cpqarray.c
Normal file
|
|
@ -0,0 +1,430 @@
|
|||
/*
|
||||
check_cpqarray, an extension for Netsaint / Nagios to check the
|
||||
status of a Compaq SmartArray controller from the commandline.
|
||||
Copyright (C) 2003 Guenther Mair
|
||||
|
||||
based on the work and using main parts of
|
||||
|
||||
CpqArray Deamon, a program to monitor and remotely configure a
|
||||
SmartArray controller.
|
||||
Copyright (C) 1999 Hugo Trippaers
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "/usr/src/linux/drivers/block/ida_ioctl.h"
|
||||
#include "/usr/src/linux/drivers/block/ida_cmd.h"
|
||||
#include "/usr/src/linux/drivers/block/cpqarray.h"
|
||||
|
||||
|
||||
const char *controllers[] =
|
||||
{
|
||||
"/dev/ida/c0d0",
|
||||
"/dev/ida/c1d0",
|
||||
"/dev/ida/c2d0",
|
||||
"/dev/ida/c3d0",
|
||||
"/dev/ida/c4d0",
|
||||
"/dev/ida/c5d0",
|
||||
"/dev/ida/c6d0",
|
||||
"/dev/ida/c7d0"
|
||||
};
|
||||
|
||||
const char *statusstr[] = {
|
||||
"Logical drive /dev/ida/c%dd%d: OK\n",
|
||||
"Logical drive /dev/ida/c%dd%d: FAILED\n",
|
||||
"Logical drive /dev/ida/c%dd%d: not configured.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: using interim recovery mode, %3.2f%% done.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: ready for recovery operation.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: is currently recovering, %3.2f%% done.\n",
|
||||
"Wrong physical drive was replaced.\n",
|
||||
"A physical drive is not properly connected.\n",
|
||||
"Hardware is overheating.\n",
|
||||
"Hardware has overheated.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: currently expanding, %3.2f%% done.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: not yet available.\n",
|
||||
"Logical drive /dev/ida/c%dd%d: queued for expansion.\n",
|
||||
};
|
||||
|
||||
extern char *optarg;
|
||||
extern int optind, opterr, optopt;
|
||||
|
||||
int ctrls_found_num;
|
||||
int exit_code = 0;
|
||||
struct controller ctrls_found[8];
|
||||
|
||||
#define DEBUG(x) fprintf(stderr, x)
|
||||
|
||||
struct opts
|
||||
{
|
||||
char debug;
|
||||
};
|
||||
|
||||
struct slog_disk
|
||||
{
|
||||
int status;
|
||||
float pvalue;
|
||||
};
|
||||
|
||||
struct controller
|
||||
{
|
||||
char ctrl_devicename[20];
|
||||
int num_logd_found;
|
||||
struct slog_disk log_disk[16];
|
||||
};
|
||||
|
||||
|
||||
|
||||
int status_check (struct opts opts)
|
||||
{
|
||||
int devicefd;
|
||||
int ctrl_cntr;
|
||||
int logd_cntr;
|
||||
ida_ioctl_t io, io2;
|
||||
int status, nr_blks, blks_tr;
|
||||
float pvalue;
|
||||
int counter;
|
||||
|
||||
for ( ctrl_cntr=0;
|
||||
ctrl_cntr < ctrls_found_num;
|
||||
ctrl_cntr++) {
|
||||
|
||||
devicefd = open (controllers[ctrl_cntr], O_RDONLY);
|
||||
|
||||
for ( logd_cntr=0;
|
||||
logd_cntr < ctrls_found[ctrl_cntr].num_logd_found;
|
||||
logd_cntr++) {
|
||||
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = SENSE_LOG_DRV_STAT;
|
||||
io.unit = logd_cntr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
perror ("SENSE_LOG_DRV_STAT ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
status=io.c.sense_log_drv_stat.status;
|
||||
|
||||
if ((status == 3) || (status == 5) || (status == 7)) {
|
||||
/* is a progress indicator required?
|
||||
*/
|
||||
memset (&io2, 0, sizeof (io));
|
||||
|
||||
io2.cmd = ID_LOG_DRV;
|
||||
io2.unit = logd_cntr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io2) < 0)
|
||||
{
|
||||
perror ("ID_LOG_DRV ioctl");
|
||||
/* return 0; no return this isn't fatal for now */
|
||||
}
|
||||
else
|
||||
{
|
||||
nr_blks = io2.c.id_log_drv.nr_blks;
|
||||
blks_tr = io.c.sense_log_drv_stat.blks_to_recover;
|
||||
|
||||
pvalue = ((float)(nr_blks - blks_tr)/(float)nr_blks) * 100;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pvalue = 0.0;
|
||||
}
|
||||
|
||||
if (opts.debug) {
|
||||
fprintf(stdout, "DEBUG: Status of controller %d unit %d is %d\n",
|
||||
ctrl_cntr, logd_cntr, status);
|
||||
fprintf(stdout, "DEBUG: ");
|
||||
fprintf(stdout, statusstr[status],
|
||||
ctrl_cntr, logd_cntr, pvalue);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
printf(statusstr[status], ctrl_cntr, logd_cntr, pvalue);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 6:
|
||||
case 7:
|
||||
case 9:
|
||||
/* CRITICAL */
|
||||
exit_code = 2;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 8:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
/* WARNING (only if not yet at CRITICAL LEVEL) */
|
||||
if (exit_code < 2) exit_code = 1;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
/* do nothing */
|
||||
break;
|
||||
}
|
||||
|
||||
ctrls_found[ctrl_cntr].log_disk[logd_cntr].pvalue = pvalue;
|
||||
ctrls_found[ctrl_cntr].log_disk[logd_cntr].status = status;
|
||||
}
|
||||
close (devicefd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int discover_controllers (struct opts opts)
|
||||
{
|
||||
int cntr;
|
||||
int foundone = 0;
|
||||
|
||||
for (cntr = 0; cntr < 8; cntr++)
|
||||
{
|
||||
/* does this device exist ? */
|
||||
if ((access (controllers[cntr], R_OK | F_OK)) == 0)
|
||||
{
|
||||
/* it does :) */
|
||||
if (interrogate_controller (opts, cntr))
|
||||
{
|
||||
foundone = 1;
|
||||
if (opts.debug)
|
||||
fprintf (stderr, "DEBUG: %s is a existing controller\n",
|
||||
controllers[cntr]);
|
||||
}
|
||||
}
|
||||
else if (opts.debug)
|
||||
{
|
||||
fprintf (stderr, "DEBUG: Device %s could not be opened\n", controllers[cntr]);
|
||||
perror ("DEBUG: reason");
|
||||
}
|
||||
}
|
||||
return foundone;
|
||||
}
|
||||
|
||||
void boardid2str (unsigned long board_id, char *name)
|
||||
{
|
||||
switch (board_id)
|
||||
{
|
||||
case 0x0040110E: /* IDA */
|
||||
strcpy (name, "Compaq IDA");
|
||||
break;
|
||||
case 0x0140110E: /* IDA-2 */
|
||||
strcpy (name, "Compaq IDA-2");
|
||||
break;
|
||||
case 0x1040110E: /* IAES */
|
||||
strcpy (name, "Compaq IAES");
|
||||
break;
|
||||
case 0x2040110E: /* SMART */
|
||||
strcpy (name, "Compaq SMART");
|
||||
break;
|
||||
case 0x3040110E: /* SMART-2/E */
|
||||
strcpy (name, "Compaq SMART-2/E");
|
||||
break;
|
||||
case 0x40300E11: /* SMART-2/P or SMART-2DH */
|
||||
strcpy (name, "Compaq SMART-2/P (2DH)");
|
||||
break;
|
||||
case 0x40310E11: /* SMART-2SL */
|
||||
strcpy (name, "Compaq SMART-2SL");
|
||||
break;
|
||||
case 0x40320E11: /* SMART-3200 */
|
||||
strcpy (name, "Compaq SMART-3200");
|
||||
break;
|
||||
case 0x40330E11: /* SMART-3100ES */
|
||||
strcpy (name, "Compaq SMART-3100ES");
|
||||
break;
|
||||
case 0x40340E11: /* SMART-221 */
|
||||
strcpy (name, "Compaq SMART-221");
|
||||
break;
|
||||
case 0x40400E11: /* Integrated Array */
|
||||
strcpy (name, "Compaq Integrated Array");
|
||||
break;
|
||||
case 0x40500E11: /* Smart Array 4200 */
|
||||
strcpy (name, "Compaq Smart Array 4200");
|
||||
break;
|
||||
case 0x40510E11: /* Smart Array 4250ES */
|
||||
strcpy (name, "Compaq Smart Array 4250ES");
|
||||
break;
|
||||
case 0x40580E11: /* Smart Array 431 */
|
||||
strcpy (name, "Compaq Smart Array 431");
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Well, its a SMART-2 or better, don't know which
|
||||
* kind.
|
||||
*/
|
||||
strcpy (name, "Unknown Controller Type");
|
||||
}
|
||||
}
|
||||
|
||||
int interrogate_controller (struct opts opts, int contrnum)
|
||||
{
|
||||
int devicefd;
|
||||
ida_ioctl_t io;
|
||||
char buffer[30];
|
||||
int foundone = 0;
|
||||
int cntr;
|
||||
|
||||
devicefd = open (controllers[contrnum], O_RDONLY);
|
||||
/* no checks, did that before */
|
||||
|
||||
/* clear io */
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = ID_CTLR;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
if (opts.debug) perror ("DEBUG: ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
boardid2str (io.c.id_ctlr.board_id, buffer);
|
||||
|
||||
strncpy (ctrls_found[ctrls_found_num].ctrl_devicename,
|
||||
buffer, 20);
|
||||
|
||||
ctrls_found[ctrls_found_num].num_logd_found = 0;
|
||||
|
||||
for (cntr = 0; cntr < io.c.id_ctlr.nr_drvs; cntr++)
|
||||
{
|
||||
if (interrogate_logical (opts, devicefd, cntr))
|
||||
{
|
||||
/* logical drive found, this could be used later one */
|
||||
foundone = 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch (ctrls_found[ctrls_found_num].num_logd_found)
|
||||
{
|
||||
case 0:
|
||||
printf("Found a %s with no logical drives.\n", buffer);
|
||||
break;
|
||||
case 1:
|
||||
printf("Found a %s with one Logical drive.\n", buffer,
|
||||
ctrls_found[ctrls_found_num].num_logd_found);
|
||||
break;
|
||||
default:
|
||||
printf("Found a %s with %d Logical drives.\n", buffer,
|
||||
ctrls_found[ctrls_found_num].num_logd_found);
|
||||
break;
|
||||
}
|
||||
|
||||
ctrls_found_num++;
|
||||
|
||||
close (devicefd);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int interrogate_logical (struct opts opts, int devicefd, int unit_nr)
|
||||
{
|
||||
ida_ioctl_t io;
|
||||
ida_ioctl_t io2;
|
||||
int nr_blks, blks_tr;
|
||||
|
||||
if (opts.debug) printf ("DEBUG: interrogating unit %d\n", unit_nr);
|
||||
|
||||
memset (&io, 0, sizeof (io));
|
||||
|
||||
io.cmd = ID_LOG_DRV;
|
||||
io.unit = unit_nr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io) < 0)
|
||||
{
|
||||
perror ("FATAL: ID_LOG_DRV ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset (&io2, 0, sizeof (io2));
|
||||
|
||||
io2.cmd = SENSE_LOG_DRV_STAT;
|
||||
io2.unit = unit_nr | UNITVALID;
|
||||
|
||||
if (ioctl (devicefd, IDAPASSTHRU, &io2) < 0)
|
||||
{
|
||||
perror ("FATAL: SENSE_LOG_DRV_STAT ioctl");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ctrls_found[ctrls_found_num].num_logd_found++;
|
||||
/* ctrls_found[ctrls_found_num].log_disk[unit_nr].status =
|
||||
* io2.c.sense_log_drv_stat.status;
|
||||
|
||||
* nr_blks = io2.c.id_log_drv.nr_blks;
|
||||
* blks_tr = io.c.sense_log_drv_stat.blks_to_recover;
|
||||
* ctrls_found[ctrls_found_num].log_disk[unit_nr].pvalue =
|
||||
* ((float)(nr_blks - blks_tr)/(float)nr_blks) * 100;
|
||||
*/
|
||||
ctrls_found[ctrls_found_num].log_disk[unit_nr].status = 0;
|
||||
ctrls_found[ctrls_found_num].log_disk[unit_nr].pvalue = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void print_usage()
|
||||
{
|
||||
printf("cpqarrayd [options]\n");
|
||||
printf(" -h prints this text\n");
|
||||
printf(" -d enables debugging\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char option;
|
||||
struct opts opts; /* commandline options */
|
||||
|
||||
memset(&opts, 0, sizeof(struct opts));
|
||||
|
||||
/* check options */
|
||||
while ((option = getopt (argc, argv, "dh:")) != EOF)
|
||||
{
|
||||
switch (option)
|
||||
{
|
||||
case 'd':
|
||||
opts.debug = 1;
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
default:
|
||||
print_usage();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for existance of array controllers */
|
||||
if (!discover_controllers(opts)) {
|
||||
printf("No array controller found!\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
status_check(opts);
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
252
contrib/check_digitemp.pl
Executable file
252
contrib/check_digitemp.pl
Executable file
|
|
@ -0,0 +1,252 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# check_digitemp.pl Copyright (C) 2002 by Brian C. Lane <bcl@brianlane.com>
|
||||
#
|
||||
# This is a NetSaint plugin script to check the temperature on a local
|
||||
# machine. Remote usage may be possible with SSH
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
#
|
||||
# ===========================================================================
|
||||
# Howto Install in NetSaint (tested with v0.0.7)
|
||||
#
|
||||
# 1. Copy this script to /usr/local/netsaint/libexec/ or wherever you have
|
||||
# placed your NetSaint plugins
|
||||
#
|
||||
# 2. Create a digitemp config file in /usr/local/netsaint/etc/
|
||||
# eg. digitemp -i -s/dev/ttyS0 -c /usr/local/netsaint/etc/digitemp.conf
|
||||
#
|
||||
# 3. Make sure that the webserver user has permission to access the serial
|
||||
# port being used.
|
||||
#
|
||||
# 4. Add a command to /usr/local/netsaint/etc/commands.cfg like this:
|
||||
# command[check-temp]=$USER1$/check_digitemp.pl -w $ARG1$ -c $ARG2$ \
|
||||
# -t $ARG3$ -f $ARG4$
|
||||
# (fold into one line)
|
||||
#
|
||||
# 5. Tell NetSaint to monitor the temperature by adding a service line like
|
||||
# this to your hosts.cfg file:
|
||||
# service[kermit]=Temperature;0;24x7;3;5;1;home-admins;120;24x7;1;1;1;; \
|
||||
# check-temp!65!75!1!/usr/local/netsaint/etc/digitemp.conf
|
||||
# (fold into one line)
|
||||
# 65 is the warning temperature
|
||||
# 75 is the critical temperature
|
||||
# 1 is the sensor # (as reported by digitemp -a) to monitor
|
||||
# digitemp.conf is the path to the config file
|
||||
#
|
||||
# 6. If you use Centigrade instead of Fahrenheit, change the commands.cfg
|
||||
# line to include the -C argument. You can then pass temperature limits in
|
||||
# Centigrade in the service line.
|
||||
#
|
||||
# ===========================================================================
|
||||
# Howto Install in Nagios (tested with v1.0b4)
|
||||
#
|
||||
# 1. Copy this script to /usr/local/nagios/libexec/ or wherever you have
|
||||
# placed your Nagios plugins
|
||||
#
|
||||
# 2. Create a digitemp config file in /usr/local/nagios/etc/
|
||||
# eg. digitemp -i -s/dev/ttyS0 -c /usr/local/nagios/etc/digitemp.conf
|
||||
#
|
||||
# 3. Make sure that the webserver user has permission to access the serial
|
||||
# port being used.
|
||||
#
|
||||
# 4. Add a command to /usr/local/nagios/etc/checkcommands.cfg like this:
|
||||
#
|
||||
# #DigiTemp temperature check command
|
||||
# define command{
|
||||
# command_name check_temperature
|
||||
# command_line $USER1$/check_digitemp.pl -w $ARG1$ -c $ARG2$ \
|
||||
# -t $ARG3$ -f $ARG4$
|
||||
# (fold above into one line)
|
||||
# }
|
||||
#
|
||||
# 5. Tell NetSaint to monitor the temperature by adding a service line like
|
||||
# this to your service.cfg file:
|
||||
#
|
||||
# #DigiTemp Temperature check Service definition
|
||||
# define service{
|
||||
# use generic-service
|
||||
# host_name kermit
|
||||
# service_description Temperature
|
||||
# is_volatile 0
|
||||
# check_period 24x7
|
||||
# max_check_attempts 3
|
||||
# normal_check_interval 5
|
||||
# retry_check_interval 2
|
||||
# contact_groups home-admins
|
||||
# notification_interval 240
|
||||
# notification_period 24x7
|
||||
# notification_options w,u,c,r
|
||||
# check_command check_temperature!65!75!1! \
|
||||
# /usr/local/nagios/etc/digitemp.conf
|
||||
# (fold into one line)
|
||||
# }
|
||||
#
|
||||
# 65 is the warning temperature
|
||||
# 75 is the critical temperature
|
||||
# 1 is the sensor # (as reported by digitemp -a) to monitor
|
||||
# digitemp.conf is the path to the config file
|
||||
#
|
||||
# 6. If you use Centigrade instead of Fahrenheit, change the checkcommands.cfg
|
||||
# line to include the -C argument. You can then pass temperature limits in
|
||||
# Centigrade in the service line.
|
||||
#
|
||||
# ===========================================================================
|
||||
|
||||
# Modules to use
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
# Define all our variable usage
|
||||
use vars qw($opt_c $opt_f $opt_t $opt_w $opt_F $opt_C
|
||||
$temperature $conf_file $sensor $temp_fmt
|
||||
$crit_level $warn_level $null
|
||||
%exit_codes
|
||||
$percent $fmt_pct
|
||||
$verb_err $command_line);
|
||||
|
||||
|
||||
# Predefined exit codes for NetSaint
|
||||
%exit_codes = ('UNKNOWN' ,-1,
|
||||
'OK' , 0,
|
||||
'WARNING' , 1,
|
||||
'CRITICAL', 2,);
|
||||
|
||||
# Default to Fahrenheit input and result (use -C to change this)
|
||||
$temp_fmt = 3;
|
||||
|
||||
|
||||
# Get the options
|
||||
if ($#ARGV le 0)
|
||||
{
|
||||
&usage;
|
||||
} else {
|
||||
getopts('f:t:FCc:w:');
|
||||
}
|
||||
|
||||
# Shortcircuit the switches
|
||||
if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0)
|
||||
{
|
||||
print "*** You must define WARN and CRITICAL levels!";
|
||||
&usage;
|
||||
}
|
||||
|
||||
# Check if levels are sane
|
||||
if ($opt_w >= $opt_c)
|
||||
{
|
||||
print "*** WARN level must not be greater than CRITICAL when checking temperature!";
|
||||
&usage;
|
||||
}
|
||||
|
||||
|
||||
$warn_level = $opt_w;
|
||||
$crit_level = $opt_c;
|
||||
|
||||
# Default sensor to read is #0
|
||||
if(!$opt_t)
|
||||
{
|
||||
$sensor = 0;
|
||||
} else {
|
||||
$sensor = $opt_t;
|
||||
}
|
||||
|
||||
# Default config file is /etc/digitemp.conf
|
||||
if(!$opt_f)
|
||||
{
|
||||
$conf_file = "/etc/digitemp.conf";
|
||||
} else {
|
||||
$conf_file = $opt_f;
|
||||
}
|
||||
|
||||
# Check for config file
|
||||
if( !-f $conf_file ) {
|
||||
print "*** You must have a digitemp.conf file\n";
|
||||
&usage;
|
||||
}
|
||||
|
||||
|
||||
if($opt_C)
|
||||
{
|
||||
$temp_fmt = 2;
|
||||
}
|
||||
|
||||
# Read the output from digitemp
|
||||
# Output in form 0\troom\tattic\tdrink
|
||||
open( DIGITEMP, "/usr/local/bin/digitemp -c $conf_file -t $sensor -q -o $temp_fmt |" );
|
||||
|
||||
# Process the output from the command
|
||||
while( <DIGITEMP> )
|
||||
{
|
||||
# print "$_\n";
|
||||
chomp;
|
||||
|
||||
if( $_ =~ /^nanosleep/i )
|
||||
{
|
||||
print "Error reading sensor #$sensor\n";
|
||||
close(DIGITEMP);
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
} else {
|
||||
# Check for an error from digitemp, and report it instead
|
||||
if( $_ =~ /^Error.*/i ) {
|
||||
print $_;
|
||||
close(DIGITEMP);
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
} else {
|
||||
($null,$temperature) = split(/\t/);
|
||||
}
|
||||
}
|
||||
}
|
||||
close( DIGITEMP );
|
||||
|
||||
if( $temperature and $temperature >= $crit_level )
|
||||
{
|
||||
print "Temperature CRITICAL - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
} elsif ($temperature and $temperature >= $warn_level ) {
|
||||
print "Temperature WARNING - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'WARNING'};
|
||||
} elsif( $temperature ) {
|
||||
print "Temperature OK - Sensor #$sensor = $temperature ";
|
||||
if( $temp_fmt == 3 ) { print "F\n"; } else { print "C\n"; }
|
||||
exit $exit_codes{'OK'};
|
||||
} else {
|
||||
print "Error parsing result for sensor #$sensor\n";
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
||||
|
||||
# Show usage
|
||||
sub usage()
|
||||
{
|
||||
print "\ncheck_digitemp.pl v1.0 - NetSaint Plugin\n";
|
||||
print "Copyright 2002 by Brian C. Lane <bcl\@brianlane.com>\n";
|
||||
print "See source for License\n";
|
||||
print "usage:\n";
|
||||
print " check_digitemp.pl -t <sensor> -f <config file> -w <warnlevel> -c <critlevel>\n\n";
|
||||
print "options:\n";
|
||||
print " -f DigiTemp Config File\n";
|
||||
print " -t DigiTemp Sensor #\n";
|
||||
print " -F Temperature in Fahrenheit\n";
|
||||
print " -C Temperature in Centigrade\n";
|
||||
print " -w temperature temperature >= to warn\n";
|
||||
print " -c temperature temperature >= when critical\n";
|
||||
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
||||
74
contrib/check_disk_snmp.pl
Normal file
74
contrib/check_disk_snmp.pl
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/perl
|
||||
# cm@financial.com 07/2002
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
use Getopt::Std;
|
||||
|
||||
my %opts =(
|
||||
u => 'nobody', # snmp user
|
||||
l => 'authNoPriv', # snmp security level
|
||||
a => 'MD5', # snmp authentication protocol
|
||||
A => 'nopass', # authentication protocol pass phrase.
|
||||
x => 'DES', # privacy protocol
|
||||
m => 'localhost', # host
|
||||
d => 1, # devicenumber
|
||||
w => 70, # warnratio
|
||||
c => 85, # critical ratio
|
||||
h => 0,
|
||||
);
|
||||
|
||||
getopts('m:u:l:a:A:x:d:w:c:h',\%opts);
|
||||
|
||||
if ( $opts{'h'} ) {
|
||||
print "Usage: $0 [ -u <username> ] [ -l <snmp security level>] [ -a <snmp authentication protocol> ] [ -A <authentication protocol pass phrase> ] [ -x <snmp privacy protocol> ] [ -m <hostname>] [ -d <devicenumber> ] [ -w <warning ratio> ] [ -c <critical ratio ]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ($opts{'w'} >= $opts{'c'}) {
|
||||
print "Errorratio must be higher then Warnratio!\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $opts{'m'},
|
||||
-nonblocking => 0x0,
|
||||
-username => $opts{'u'},
|
||||
-authpassword => $opts{'A'},
|
||||
-authprotocol => $opts{'a'},
|
||||
-version => '3',
|
||||
);
|
||||
|
||||
if ($@) {
|
||||
print "SNMP-Error occured";
|
||||
exit 1;
|
||||
}
|
||||
my $result=undef;
|
||||
|
||||
|
||||
my $deviceSize=".1.3.6.1.2.1.25.2.3.1.5.$opts{'d'}";
|
||||
my $deviceUsed=".1.3.6.1.2.1.25.2.3.1.6.$opts{'d'}";
|
||||
my $deviceName=".1.3.6.1.2.1.25.2.3.1.3.$opts{'d'}";
|
||||
my @OID=($deviceSize, $deviceUsed, $deviceName);
|
||||
$result = $session->get_request(
|
||||
-varbindlist => \@OID,
|
||||
);
|
||||
|
||||
if (!defined($result)) {
|
||||
printf("ERROR: %s.\n", $session->error);
|
||||
$session->close;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $ratio=$result->{$deviceUsed}*100/$result->{$deviceSize};
|
||||
|
||||
if ($ratio > $opts{'c'}){
|
||||
printf("CRITICAL: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
|
||||
exit 2;
|
||||
}
|
||||
if ($ratio > $opts{'w'}){
|
||||
printf("WARNING: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
|
||||
exit 1;
|
||||
}
|
||||
|
||||
printf("OK: %s usage %.2f%%\n", $result->{$deviceName}, $ratio);
|
||||
exit 0;
|
||||
221
contrib/check_dlswcircuit.pl
Executable file
221
contrib/check_dlswcircuit.pl
Executable file
|
|
@ -0,0 +1,221 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_dlswcircuit.pl - nagios plugin
|
||||
#
|
||||
# Checks if a Cisco Dlsw circuit is connected.
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Carsten Foss & Christoph Kron
|
||||
#
|
||||
# Basically this is an adapted version of Christoph Kron's (ck@zet.net) check_ifoperstatus.pl plugin.
|
||||
# most of the thanks should go to him.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Arguments : -s <SourceMac> -d <DestMac> -c <READCOMMUNITY> -p <PORT> <HOSTNAME or IP-Addr>
|
||||
# -
|
||||
# Source & Dest Mac/Sap arguments must be given in Hex as this example : 40.00.01.37.45.01.ss (Where ss is the sap)
|
||||
#
|
||||
# Sample command line : check_dlswcircuit.pl -s 40.00.01.37.45.01.04 -d 40.00.02.37.45.02.04 -c secret 1.2.3.4
|
||||
#
|
||||
# Sample host.cfg entry :
|
||||
#service[Dlsw-xx]=NCP1-NCP2;0;24x7;3;5;1;router-admins;240;24x7;1;1;0;;check_dlswcircuit!-s 40.00.01.37.45.01.04!-d 40.00..01.37.45.02.04!-c secret!1.2.3.4
|
||||
# remember to add the service to commands.cfg , something like this:
|
||||
# command[check_dlswcircuit]=$USER1$/check_dlswcircuit.pl $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$
|
||||
#
|
||||
# Report bugs to: cfo@dmdata.dk
|
||||
#
|
||||
# 11.03.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 15;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
my %dlswCircuitStatus = (
|
||||
'1','disconnected',
|
||||
'2','circuitStart',
|
||||
'3','resolvePending',
|
||||
'4','circuitPending',
|
||||
'5','circuitEstablished',
|
||||
'6','connectPending',
|
||||
'7','contactPending',
|
||||
'8','connected',
|
||||
'9','disconnectPending',
|
||||
'10','haltPending',
|
||||
'11','haltPendingNoack',
|
||||
'13','circuitRestart',
|
||||
'14','restartPending');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $smac = "";
|
||||
my $dmac = "";
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
#Dlsw Circuit Oid enterprises.9.10.9.1.5.2.1.17.6.0.96.148.47.230.166.4.6.64.0.1.55.69.2.4 = 8
|
||||
my $enterpriseOid = "1.3.6.1.4.1";
|
||||
my $ciscoDlswCircuitOid = ".9.10.9.1.5.2.1.17.";
|
||||
my $unknownOid = "6.";
|
||||
my $smacOid = "";
|
||||
my $dmacOid = "";
|
||||
my $tmpOid = "";
|
||||
my @tmparg;
|
||||
my $snmpoid;
|
||||
my @snmpoids;
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my $p = "";
|
||||
my $q = "";
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check Cisco Dlsw Circuit State plugin for Nagios\n";
|
||||
printf "checks operational status of specified DLSW Circuit\n";
|
||||
printf "usage: \n";
|
||||
printf "check_dlswcircuit.pl -s <SourceMac> -d <DestMac> -c <READCOMMUNITY> -p <PORT> <HOSTNAME>";
|
||||
printf "\nCopyright (C) 2000 Carsten Foss\n";
|
||||
printf "check_dlswcircuit.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"};
|
||||
}
|
||||
|
||||
# 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);
|
||||
|
||||
|
||||
$status = GetOptions("sourcemac=s",\$smac,"destmac=s",\$dmac,
|
||||
"community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#
|
||||
#Convert Source Mac & Sap
|
||||
#
|
||||
@tmparg = split(/\./,$smac);
|
||||
#print "-$smac-\n";
|
||||
#print "@tmparg\n";
|
||||
#print "$#tmparg\n";
|
||||
if($#tmparg != 6)
|
||||
{
|
||||
print "SourceMac/Sap format $smac not valid\n";
|
||||
&usage;
|
||||
}
|
||||
while($p = shift @tmparg)
|
||||
{
|
||||
$q = hex($p);
|
||||
$smacOid = $smacOid.$q;
|
||||
$smacOid = $smacOid.'.';
|
||||
}
|
||||
|
||||
#print "@tmparg1\n";
|
||||
#print "$smacOid\n";
|
||||
|
||||
#
|
||||
#Convert Dest Mac & Sap
|
||||
#
|
||||
@tmparg = split(/\./,$dmac);
|
||||
#print "-$dmac-\n";
|
||||
#print "@tmparg\n";
|
||||
#print "$#tmparg\n";
|
||||
if($#tmparg != 6)
|
||||
{
|
||||
print "DestMac/Sap format $dmac not valid\n";
|
||||
&usage;
|
||||
}
|
||||
|
||||
while($p = shift @tmparg)
|
||||
{
|
||||
$q = hex($p);
|
||||
$dmacOid = $dmacOid.$q;
|
||||
$dmacOid = $dmacOid.'.';
|
||||
}
|
||||
# Remove Trailing Dot
|
||||
$dmacOid = substr($dmacOid,0,length($dmacOid)-1);
|
||||
|
||||
|
||||
#print "@tmparg1\n";
|
||||
#print "$dmacOid\n";
|
||||
#Build the Dlsw Oic to use
|
||||
$snmpoid = $enterpriseOid.$ciscoDlswCircuitOid.$unknownOid.$smacOid.$unknownOid.$dmacOid ;
|
||||
#print "$snmpoid\n";
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
push(@snmpoids,$snmpoid);
|
||||
#push(@snmpoids,$snmpLocIfDescr);
|
||||
|
||||
if (!defined($response = $session->get_request(@snmpoids))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community,$smac - $dmac");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
$answer = sprintf("dlsw circuit %s - %s at host '%s',is %s\n",
|
||||
$smac,
|
||||
$dmac,
|
||||
$hostname,
|
||||
$dlswCircuitStatus{$response->{$snmpoid}}
|
||||
);
|
||||
|
||||
$session->close;
|
||||
|
||||
if ( $response->{$snmpoid} == 8 ) {
|
||||
$state = 'OK';
|
||||
}
|
||||
else {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
74
contrib/check_dns_random.pl
Normal file
74
contrib/check_dns_random.pl
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#!/usr/bin/perl
|
||||
# ------------------------------------------------------------------------------
|
||||
# File Name: check_dns_random.pl
|
||||
# Author: Richard Mayhew - South Africa
|
||||
# Date: 2000/01/26
|
||||
# Version: 1.0
|
||||
# Description: This script will check to see if dns resolves hosts
|
||||
# randomly from a list using the check_dns plugin.
|
||||
# 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 :)
|
||||
# License GPL
|
||||
# ------------------------------------------------------------------------------
|
||||
# Date Author Reason
|
||||
# ---- ------ ------
|
||||
# 1999/09/26 RM Creation
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------[ Require ]--
|
||||
require 5.004;
|
||||
|
||||
# --------------------------------------------------------------------[ Uses ]--
|
||||
use Socket;
|
||||
use strict;
|
||||
|
||||
# --------------------------------------------------------------[ Enviroment ]--
|
||||
$ENV{PATH} = "/bin";
|
||||
$ENV{BASH_ENV} = "";
|
||||
$|=1;
|
||||
|
||||
my $host = shift || &usage;
|
||||
|
||||
my $domainfile = "/usr/local/nagios/etc/domains.list";
|
||||
my $wc = `/usr/bin/wc -l $domainfile`;
|
||||
my $check = "/usr/local/nagios/libexec/check_dns";
|
||||
my $x = 0;
|
||||
my $srv_file = "";
|
||||
my $z = "";
|
||||
my $y = "";
|
||||
|
||||
open(DOMAIN,"<$domainfile") or die "Error Opening $domainfile File!\n";
|
||||
while (<DOMAIN>) {
|
||||
$srv_file .= $_;
|
||||
}
|
||||
close(DOMAIN);
|
||||
my @data = split(/\n/,$srv_file);
|
||||
|
||||
chomp $wc;
|
||||
$wc =~ s/ //g;
|
||||
$wc =~ s/domains//g;
|
||||
|
||||
$x = rand $wc;
|
||||
($z,$y) = split(/\./,$x);
|
||||
|
||||
system($check, $data[$z], $host);
|
||||
exit ($? / 256);
|
||||
|
||||
sub usage
|
||||
{
|
||||
print "Minimum arguments not supplied!\n";
|
||||
print "\n";
|
||||
print "Perl Check Random DNS plugin for Nagios\n";
|
||||
print "Copyright (c) 2000 Richard Mayhew\n";
|
||||
print "\n";
|
||||
print "Usage: check_dns_random.pl <host>\n";
|
||||
print "\n";
|
||||
print "<host> = DNS server you would like to query.\n";
|
||||
exit -1;
|
||||
|
||||
}
|
||||
|
||||
309
contrib/check_email_loop.pl
Normal file
309
contrib/check_email_loop.pl
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# (c)2000 Benjamin Schmid, blueshift@gmx.net (emergency use only ;-)
|
||||
# Copyleft by GNU GPL
|
||||
#
|
||||
#
|
||||
# check_email_loop Nagios Plugin
|
||||
#
|
||||
# This script sends a mail with a specific id in the subject via
|
||||
# an given smtp-server to a given email-adress. When the script
|
||||
# is run again, it checks for this Email (with its unique id) on
|
||||
# a given pop3 account and send another mail.
|
||||
#
|
||||
#
|
||||
# Example: check_email_loop.pl -poph=mypop -popu=user -pa=password
|
||||
# -smtph=mailer -from=returnadress@yoursite.com
|
||||
# -to=remaileradress@friend.com -pendc=2 -lostc=0
|
||||
#
|
||||
# This example will send eacht time this check is executed a new
|
||||
# mail to remaileradress@friend.com using the SMTP-Host mailer.
|
||||
# Then it looks for any back-forwarded mails in the POP3 host
|
||||
# mypop. In this Configuration CRITICAL state will be reached if
|
||||
# more than 2 Mails are pending (meaning that they did not came
|
||||
# back till now) or if a mails got lost (meaning a mail, that was
|
||||
# send later came back prior to another mail).
|
||||
#
|
||||
# Michael Markstaller, mm@elabnet.de various changes/additions
|
||||
# MM 021003: fixed some unquoted strings
|
||||
# MM 021116: fixed/added pendwarn/lostwarn
|
||||
# MM 030515: added deleting of orphaned check-emails
|
||||
# changed to use "top" instead of get to minimize traffic (required changing match-string from "Subject: Email-ping [" to "Email-Ping ["
|
||||
|
||||
use Net::POP3;
|
||||
use Net::SMTP;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
# ----------------------------------------
|
||||
|
||||
my $TIMEOUT = 120;
|
||||
my %ERRORS = ('OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
'UNKNOWN' , '3');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
|
||||
my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
|
||||
my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
|
||||
$debug = 0;
|
||||
|
||||
# Internal Vars
|
||||
my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
|
||||
my (%other_smtp_opts);
|
||||
my ($matchcount,$statfile) = (0,"check_email_loop.stat");
|
||||
|
||||
# Subs declaration
|
||||
sub usage;
|
||||
sub messagematchs;
|
||||
sub nsexit;
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: $0 Time-Out $TIMEOUT s \n");
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
};
|
||||
alarm($TIMEOUT);
|
||||
|
||||
|
||||
# Evaluate Command Line Parameters
|
||||
my $status = GetOptions(
|
||||
"from=s",\$sender,
|
||||
"to=s",\$receiver,
|
||||
"debug", \$debug,
|
||||
"pophost=s",\$pophost,
|
||||
"popuser=s",\$popuser,
|
||||
"passwd=s",\$poppasswd,
|
||||
"poptimeout=i",\$poptimeout,
|
||||
"smtphost=s",\$smtphost,
|
||||
"smtptimeout=i",\$smtptimeout,
|
||||
"statfile=s",\$statfile,
|
||||
"interval=i",\$pinginterval,
|
||||
"lostwarn=i",\$lostwarn,
|
||||
"lostcrit=i",\$lostcrit,
|
||||
"pendwarn=i",\$pendwarn,
|
||||
"pendcrit=i",\$pendcrit,
|
||||
"maxmsg=i",\$maxmsg,
|
||||
"keeporphaned=s",\$keeporphaned,
|
||||
);
|
||||
usage() if ($status == 0 || ! ($pophost && $popuser && $poppasswd &&
|
||||
$smtphost && $receiver && $sender ));
|
||||
|
||||
# Try to read the ids of the last send emails out of statfile
|
||||
if (open STATF, "$statfile") {
|
||||
@messageids = <STATF>;
|
||||
chomp @messageids;
|
||||
close STATF;
|
||||
}
|
||||
|
||||
# Try to open statfile for writing
|
||||
if (!open STATF, ">$statfile") {
|
||||
nsexit("Failed to open mail-ID database $statfile for writing",'CRITICAL');
|
||||
}
|
||||
|
||||
# Ok - check if it's time to release another mail
|
||||
|
||||
# ...
|
||||
|
||||
# creating new serial id
|
||||
my $serial = time();
|
||||
$serial = "ID#" . $serial . "#$$";
|
||||
|
||||
|
||||
# sending new ping email
|
||||
%other_smtp_opts=();
|
||||
if ( $debug == 1 ) {
|
||||
$other_smtp_opts{'Debug'} = 1;
|
||||
}
|
||||
|
||||
my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts)
|
||||
|| nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
|
||||
($smtp->mail($sender) &&
|
||||
$smtp->to($receiver) &&
|
||||
$smtp->data() &&
|
||||
$smtp->datasend("To: $receiver\nSubject: E-Mail Ping [$serial]\n\n".
|
||||
"This is an automatically sent E-Mail.\n".
|
||||
"It is not intended for a human reader.\n\n".
|
||||
"Serial No: $serial\n") &&
|
||||
$smtp->dataend() &&
|
||||
$smtp->quit
|
||||
) || nsexit("Error delivering message",'CRITICAL');
|
||||
|
||||
# no the interessting part: let's if they are receiving ;-)
|
||||
|
||||
$pop = Net::POP3->new( $pophost,
|
||||
Timeout=>$poptimeout)
|
||||
|| nsexit("POP3 connect timeout (>$poptimeout s, host: $pophost)",'CRITICAL');
|
||||
|
||||
$msgcount=$pop->login($popuser,$poppasswd);
|
||||
|
||||
$statinfo="$msgcount mails on POP3";
|
||||
|
||||
nsexit("POP3 login failed (user:$popuser)",'CRITICAL') if (!defined($msgcount));
|
||||
|
||||
# Check if more than maxmsg mails in pop3-box
|
||||
nsexit(">$maxmsg Mails ($msgcount Mails on POP3); Please delete !",'WARNING') if ($msgcount > $maxmsg);
|
||||
|
||||
my ($mid, $nid);
|
||||
# Count messages, that we are looking 4:
|
||||
while ($msgcount > 0) {
|
||||
@msglines = @{$pop->top($msgcount,1)};
|
||||
for (my $i=0; $i < scalar @messageids; $i++) {
|
||||
if (messagematchsid(\@msglines,$messageids[$i])) {
|
||||
$matchcount++;
|
||||
# newest received mail than the others, ok remeber id.
|
||||
if (!defined $newestid) {
|
||||
$newestid = $messageids[$i];
|
||||
} else {
|
||||
$messageids[$i] =~ /\#(\d+)\#/;
|
||||
$mid = $1;
|
||||
$newestid =~ /\#(\d+)\#/;
|
||||
$nid = $1;
|
||||
if ($mid > $nid) {
|
||||
$newestid = $messageids[$i];
|
||||
}
|
||||
}
|
||||
$pop->delete($msgcount); # remove E-Mail from POP3 server
|
||||
splice @messageids, $i, 1;# remove id from List
|
||||
last; # stop looking in list
|
||||
}
|
||||
}
|
||||
# Delete orphaned Email-ping msg
|
||||
my @msgsubject = grep /^Subject/, @msglines;
|
||||
chomp @msgsubject;
|
||||
# Scan Subject if email is an Email-Ping. In fact we match and delete also successfully retrieved messages here again.
|
||||
if (!defined $keeporphaned && $msgsubject[0] =~ /E-Mail Ping \[/) {
|
||||
$pop->delete($msgcount); # remove E-Mail from POP3 server
|
||||
}
|
||||
|
||||
$msgcount--;
|
||||
}
|
||||
|
||||
$pop->quit(); # necessary for pop3 deletion!
|
||||
|
||||
# traverse through the message list and mark the lost mails
|
||||
# that mean mails that are older than the last received mail.
|
||||
if (defined $newestid) {
|
||||
$newestid =~ /\#(\d+)\#/;
|
||||
$newestid = $1;
|
||||
for (my $i=0; $i < scalar @messageids; $i++) {
|
||||
$messageids[$i] =~ /\#(\d+)\#/;
|
||||
my $akid = $1;
|
||||
if ($akid < $newestid) {
|
||||
$messageids[$i] =~ s/^ID/LI/; # mark lost
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Write list to id-Database
|
||||
foreach my $id (@messageids) {
|
||||
print STATF "$id\n";
|
||||
}
|
||||
print STATF "$serial\n"; # remember send mail of this session
|
||||
close STATF;
|
||||
|
||||
# ok - count lost and pending mails;
|
||||
my @tmp = grep /^ID/, @messageids;
|
||||
my $pendingm = scalar @tmp;
|
||||
@tmp = grep /^LI/, @messageids;
|
||||
my $lostm = scalar @tmp;
|
||||
|
||||
# Evaluate the Warnin/Crit-Levels
|
||||
if (defined $pendwarn && $pendingm > $pendwarn) { $state = 'WARNING'; }
|
||||
if (defined $lostwarn && $lostm > $lostwarn) { $state = 'WARNING'; }
|
||||
if (defined $pendcrit && $pendingm > $pendcrit) { $state = 'CRITICAL'; }
|
||||
if (defined $lostcrit && $lostm > $lostcrit) { $state = 'CRITICAL'; }
|
||||
|
||||
if ((defined $pendwarn || defined $pendcrit || defined $lostwarn
|
||||
|| defined $lostcrit) && ($state eq 'UNKNOWN')) {$state='OK';}
|
||||
|
||||
|
||||
# Append Status info
|
||||
$statinfo = $statinfo . ", $matchcount mail(s) came back,".
|
||||
" $pendingm pending, $lostm lost.";
|
||||
|
||||
# Exit in a Nagios-compliant way
|
||||
nsexit($statinfo);
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
sub usage {
|
||||
print "check_email_loop 1.1 Nagios Plugin - Real check of a E-Mail system\n";
|
||||
print "=" x 75,"\nERROR: Missing or wrong arguments!\n","=" x 75,"\n";
|
||||
print "This script sends a mail with a specific id in the subject via an given\n";
|
||||
print "smtp-server to a given email-adress. When the script is run again, it checks\n";
|
||||
print "for this Email (with its unique id) on a given pop3 account and sends \n";
|
||||
print "another mail.\n";
|
||||
print "\nThe following options are available:\n";
|
||||
print " -from=text email adress of send (for mail returnr on errors)\n";
|
||||
print " -to=text email adress to which the mails should send to\n";
|
||||
print " -pophost=text IP or name of the POP3-host to be checked\n";
|
||||
print " -popuser=text Username of the POP3-account\n";
|
||||
print " -passwd=text Password for the POP3-user\n";
|
||||
print " -poptimeout=num Timeout in seconds for the POP3-server\n";
|
||||
print " -smtphost=text IP oder name of the SMTP host\n";
|
||||
print " -smtptimeout=num Timeout in seconds for the SMTP-server\n";
|
||||
print " -statfile=text File to save ids of messages ($statfile)\n";
|
||||
print " -interval=num Time (in minutes) that must pass by before sending\n";
|
||||
print " another Ping-mail (gibe a new try);\n";
|
||||
print " -lostwarn=num WARNING-state if more than num lost emails\n";
|
||||
print " -lostcrit=num CRITICAL \n";
|
||||
print " -pendwarn=num WARNING-state if more than num pending emails\n";
|
||||
print " -pendcrit=num CRITICAL \n";
|
||||
print " -maxmsg=num WARNING if more than num emails on POP3 (default 50)\n";
|
||||
print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n";
|
||||
print " -debug send SMTP tranaction info to stderr\n\n";
|
||||
print " Options may abbreviated!\n";
|
||||
print " LOST mails are mails, being sent before the last mail arrived back.\n";
|
||||
print " PENDING mails are those, which are not. (supposed to be on the way)\n";
|
||||
print "\nExample: \n";
|
||||
print " $0 -poph=host -pa=pw -popu=popts -smtph=host -from=root\@me.com\n ";
|
||||
print " -to=remailer\@testxy.com -lostc=0 -pendc=2\n";
|
||||
print "\nCopyleft 19.10.2000, Benjamin Schmid / 2003 Michael Markstaller, mm\@elabnet.de\n";
|
||||
print "This script comes with ABSOLUTELY NO WARRANTY\n";
|
||||
print "This programm is licensed under the terms of the ";
|
||||
print "GNU General Public License\n\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
sub nsexit {
|
||||
my ($msg,$code) = @_;
|
||||
$code=$state if (!defined $code);
|
||||
print "$code: $msg\n" if (defined $msg);
|
||||
exit $ERRORS{$code};
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
sub messagematchsid {
|
||||
my ($mailref,$id) = (@_);
|
||||
my (@tmp);
|
||||
my $match = 0;
|
||||
|
||||
# ID
|
||||
$id =~ s/^LI/ID/; # evtl. remove lost mail mark
|
||||
@tmp = grep /E-Mail Ping \[/, @$mailref;
|
||||
chomp @tmp;
|
||||
if (($tmp[0] =~ /$id/))
|
||||
{ $match = 1; }
|
||||
|
||||
# Sender:
|
||||
# @tmp = grep /^From:\s+/, @$mailref;
|
||||
# if (@tmp && $sender ne "")
|
||||
# { $match = $match && ($tmp[0]=~/$sender/); }
|
||||
|
||||
# Receiver:
|
||||
# @tmp = grep /^To: /, @$mailref;
|
||||
# if (@tmp && $receiver ne "")
|
||||
# { $match = $match && ($tmp[0]=~/$receiver/); }
|
||||
|
||||
return $match;
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
133
contrib/check_fan_cpq_present
Normal file
133
contrib/check_fan_cpq_present
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
#
|
||||
# check_most.pl -i <ip address> -p <port> -c community -o <oid> [warn] [critical]
|
||||
#
|
||||
# NetSaint host script to get the disk usage from NT snmp
|
||||
#
|
||||
# Changes and Modifications
|
||||
# =========================
|
||||
# 3-Aug-2000 - Xavier Dusart
|
||||
# Created
|
||||
# 2003 - Rainer Duffner
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
#use strict;
|
||||
use Getopt::Std ;
|
||||
use BER;
|
||||
require 'SNMP_Session.pm';
|
||||
use vars qw($opt_H $opt_p $opt_C $opt_f $opt_h $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support);
|
||||
use snmputil qw(%CPQ_LOCALE %CPQ_FAN_PRESENT %CPQ_FAN_OVERALL_COND %CPQ_FAN_SPEED);
|
||||
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
|
||||
|
||||
getopts('H:p:C:f:hV') ;
|
||||
|
||||
my $ip_address=undef ;
|
||||
|
||||
if ($opt_h) {&help();}
|
||||
|
||||
if ($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]*)*)$/) {
|
||||
$ip_address = $opt_H ;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
print "IP-Address format wrong\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#if ($opt_p =~ m/^[0-9]
|
||||
|
||||
my $port = $opt_p;
|
||||
|
||||
my $community = $opt_C;
|
||||
|
||||
my $fan = $opt_f ;
|
||||
|
||||
#my $err_counter=0 ;
|
||||
#my $err_status="";
|
||||
|
||||
my $fan_locale_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,3,0,$fan );
|
||||
# not used for the moment - gives no usable output
|
||||
# if reused, enter at end of list to avoid renumbering !
|
||||
my $fan_present_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,4,0,$fan );
|
||||
my $fan_speed_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,6,0,$fan );
|
||||
my $fan_condition_oid = encode_oid (1,3,6,1,4,1,232,6,2,6,7,1,9,0,$fan );
|
||||
my $count=1 ;
|
||||
my $label ;
|
||||
my @r_array=();
|
||||
my $q ;
|
||||
my $diff ;
|
||||
$warning=$warning/100 ;
|
||||
$crititcal=$critical/100 ;
|
||||
|
||||
|
||||
# get temperature, temperature_threshold bfore shutdown
|
||||
my $session=SNMP_Session->open ($ip_address, $community, $port) || die "couldn't open SNMP-session to host" ;
|
||||
|
||||
if ($session->get_request_response ($fan_present_oid, $fan_locale_oid, $fan_speed_oid, $fan_condition_oid )) {
|
||||
(my $bindings) = $session->decode_get_response ($session->{pdu_buffer});
|
||||
while ($bindings ne '') {
|
||||
($binding, $bindings) = &decode_sequence ($bindings) ;
|
||||
($oid,$value) = &decode_by_template ($binding,"%O%@");
|
||||
$r_array[$count]=&pretty_print($value);
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
print "No response from agent\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
$result_fan_present= $r_array[1];
|
||||
$result_fan_locale= $r_array[2];
|
||||
$result_fan_speed= $r_array[3];
|
||||
$result_fan_condition=$r_array[4];
|
||||
|
||||
|
||||
if ( $result_fan_present != 3 || $result_fan_speed !=2 ) {
|
||||
print "Fan ". $fan . " ".$CPQ_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - Critical: Fan ".$CPQ_FAN_PRESENT{$result_fan_present}.". Speed: ". $CPQ_FAN_SPEED{$result_fan_speed}.". Overall condition: ". $CPQ_FAN_OVERALL_COND{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'CRITICAL'} ;
|
||||
}
|
||||
else {
|
||||
print "Fan " .$fan . " ".$CPQ_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - OK: Fan ".$CPQ_FAN_PRESENT{$result_fan_present}.". Speed: ". $CPQ_FAN_SPEED{$result_fan_speed}.". Overall condition: ". $CPQ_FAN_OVERALL_COND{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -p <port> -C <community> -f <fannumber>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$\n ');
|
||||
print "Copyright (c) 2003 Rainer Duffner\n ";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<host> = IP-Address or DNS-Name of the W2K-Server\n";
|
||||
print "<port> = SNMP-Port (normaly 161)\n";
|
||||
print "<community> = SNMP v1 community\n";
|
||||
print "<fannumber> = Fannumber (1, 2, 3 etc.)\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
135
contrib/check_fan_fsc_present
Normal file
135
contrib/check_fan_fsc_present
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
#
|
||||
# check_most.pl -i <ip address> -p <port> -c community -o <oid> [warn] [critical]
|
||||
#
|
||||
# NetSaint host script to get the disk usage from NT snmp
|
||||
#
|
||||
# Changes and Modifications
|
||||
# =========================
|
||||
# 3-Aug-2000 - Xavier Dusart
|
||||
# Created
|
||||
# 2003 - Rainer Duffner
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) {
|
||||
$runtimedir = $1;
|
||||
$PROGNAME = $2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
#use strict;
|
||||
use Getopt::Std ;
|
||||
use BER;
|
||||
require 'SNMP_Session.pm';
|
||||
use vars qw($opt_H $opt_p $opt_C $opt_f $opt_h $PROGNAME);
|
||||
use lib $main::runtimedir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &usage &support);
|
||||
use snmputil qw(%FSC_LOCALE %FSC_FAN_STATUS);
|
||||
|
||||
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
|
||||
|
||||
getopts('H:p:C:f:hV') ;
|
||||
|
||||
my $ip_address=undef ;
|
||||
|
||||
if ($opt_h) {&help();}
|
||||
|
||||
if ($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]*)*)$/) {
|
||||
$ip_address = $opt_H ;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
print "IP-Address format wrong\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
#if ($opt_p =~ m/^[0-9]
|
||||
|
||||
my $port = $opt_p;
|
||||
|
||||
my $community = $opt_C;
|
||||
|
||||
my $fan = $opt_f ;
|
||||
|
||||
#my $err_counter=0 ;
|
||||
#my $err_status="";
|
||||
|
||||
my $fan_locale_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,4,0,$fan-1 );
|
||||
# not used for the moment - gives no usable output
|
||||
# if reused, enter at end of list to avoid renumbering !
|
||||
my $fan_cur_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,8,0,$fan-1 );
|
||||
my $fan_nom_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,9,0,$fan-1 );
|
||||
my $fan_cur_max_speed_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,10,0,$fan-1 );
|
||||
my $fan_condition_oid = encode_oid (1,3,6,1,4,1,231,2,10,2,2,5,2,2,1,3,0,$fan-1 );
|
||||
my $count=1 ;
|
||||
my $label ;
|
||||
my @r_array=();
|
||||
my $q ;
|
||||
my $diff ;
|
||||
$warning=$warning/100 ;
|
||||
$crititcal=$critical/100 ;
|
||||
|
||||
|
||||
# get temperature, temperature_threshold bfore shutdown
|
||||
my $session=SNMP_Session->open ($ip_address, $community, $port) || die "couldn't open SNMP-session to host" ;
|
||||
|
||||
if ($session->get_request_response ($fan_locale_oid, $fan_cur_speed_oid, $fan_nom_max_speed_oid, $fan_cur_max_speed_oid, $fan_condition_oid )) {
|
||||
(my $bindings) = $session->decode_get_response ($session->{pdu_buffer});
|
||||
while ($bindings ne '') {
|
||||
($binding, $bindings) = &decode_sequence ($bindings) ;
|
||||
($oid,$value) = &decode_by_template ($binding,"%O%@");
|
||||
$r_array[$count]=&pretty_print($value);
|
||||
$count++;
|
||||
}
|
||||
} else {
|
||||
print "No response from agent\n";
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
}
|
||||
$result_fan_locale= $r_array[1];
|
||||
$result_fan_cur_speed= $r_array[2];
|
||||
$result_fan_nom_max_speed= $r_array[3];
|
||||
$result_fan_cur_max_speed= $r_array[4];
|
||||
$result_fan_condition=$r_array[5];
|
||||
|
||||
|
||||
if ( $result_fan_condition != "3" ) {
|
||||
print "Fan ". $fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - Critical: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'CRITICAL'} ;
|
||||
}
|
||||
else {
|
||||
print "Fan " .$fan . " ".$FSC_LOCALE{$result_fan_locale}. " (".$result_fan_locale.") - OK: Cur./Nom./Cur-Max-Speed: ". $result_fan_cur_speed."/". $result_fan_nom_max_speed."/".$result_fan_cur_max_speed.". Overall condition: ". $FSC_FAN_STATUS{$result_fan_condition} ."\n" ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> -p <port> -C <community> -f <fannumber>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$\n ');
|
||||
print "Copyright (c) 2003 Rainer Duffner\n ";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<host> = IP-Address or DNS-Name of the W2K-Server\n";
|
||||
print "<port> = SNMP-Port (normaly 161)\n";
|
||||
print "<community> = SNMP v1 community\n";
|
||||
print "<fannumber> = Fannumber (1, 2, 3 etc.)\n";
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
82
contrib/check_flexlm.pl
Normal file
82
contrib/check_flexlm.pl
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#!/usr/local/bin/perl
|
||||
#
|
||||
# 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
|
||||
# current status: looks like working
|
||||
#
|
||||
# Copyright Notice: Do as you please, credit me, but don't blame me
|
||||
#
|
||||
|
||||
# Just in case of problems, let's not hang Nagios
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "No Answer from Client\n";
|
||||
exit 2;
|
||||
};
|
||||
alarm(20);
|
||||
|
||||
$lmstat = "/opt/lic/sw/cadadm/default/bin/lmstat";
|
||||
|
||||
$licfile = shift;
|
||||
|
||||
#print "$licfile \n";
|
||||
|
||||
open CMD,"$lmstat -c $licfile |";
|
||||
|
||||
$serverup = 0;
|
||||
|
||||
while ( <CMD> ) {
|
||||
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;
|
||||
}
|
||||
|
||||
exit 0 if ( $servers == $lf1 + $lf2 + $lf3 );
|
||||
exit 1 if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );
|
||||
exit 2;
|
||||
151
contrib/check_frontpage
Normal file
151
contrib/check_frontpage
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Check that FrontPage extensions appear to be working on a specified host.
|
||||
# Currently only checks that the hit counter is not returning an error.
|
||||
#
|
||||
# Probably not a good idea to use this on a host that someone's counting
|
||||
# the hits on, so create a separate vhost for frontpage extensions testing,
|
||||
# or just install the extensions on the default/root host for your server, and
|
||||
# point it against that hostname, running it against all vhosts on a server is
|
||||
# probably rather wasteful.
|
||||
#
|
||||
# Kev Green, oRe Net (http://www.orenet.co.uk/).
|
||||
|
||||
|
||||
use strict;
|
||||
use lib "/usr/lib/nagios/plugins";
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use vars qw($PROGNAME);
|
||||
use Getopt::Long;
|
||||
use LWP;
|
||||
use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H);
|
||||
my ($tt,$url,$response,$stime, $etime,$warning,$critical,$mimetype,$failtype,$temp,$message);
|
||||
my $rt = 0;
|
||||
|
||||
$PROGNAME = "check_frontpage";
|
||||
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$'); #'
|
||||
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-9]+(\.[a-zA-Z0-9][-a-zA-Z0-9]+)*)$/);
|
||||
print_usage() unless $host;
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = 120);
|
||||
if ($opt_c =~ /([0-9]+)/) {
|
||||
$critical = $1;
|
||||
} else {
|
||||
$critical = 10;
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = 60);
|
||||
if ($opt_w =~ /([0-9]+)/) {
|
||||
$warning = $1;
|
||||
} else {
|
||||
$warning = 5;
|
||||
}
|
||||
|
||||
# Guts go here, once we're through argument parsing and have warning and
|
||||
# critical thresholds.
|
||||
my $browser = LWP::UserAgent->new;
|
||||
|
||||
my @urls = (
|
||||
# This is the "Hit Counter", which continues to work if frontpage extensions
|
||||
# are 'uninstall'ed from the site, but not when they are 'fulluninstall'ed.
|
||||
{
|
||||
url => "_vti_bin/fpcount.exe?Page=_borders/right.htm|Image=4",
|
||||
mimetype => "image/gif",
|
||||
message => "None, or broken frontpage extensions on server, or virtual site 'fulluninstall'ed?",
|
||||
failtype => "CRITICAL"
|
||||
},
|
||||
# This is the "FrontPage Configuration Information" file, which is removed
|
||||
# when you 'uninstall' the extensions from a site.
|
||||
{
|
||||
url => "_vti_inf.html",
|
||||
mimetype => "text/html",
|
||||
message => "Someone 'uninstall'ed extensions on virtual site?",
|
||||
failtype => "WARNING"
|
||||
}
|
||||
);
|
||||
|
||||
print "FRONTPAGE: ";
|
||||
|
||||
foreach $temp (@urls) {
|
||||
$url = $temp->{'url'};
|
||||
$mimetype = $temp->{'mimetype'};
|
||||
$failtype = $temp->{'failtype'};
|
||||
$message = $temp->{'message'};
|
||||
$stime = time();
|
||||
$response=$browser->get("http://".$host."/".$url);
|
||||
$etime = time();
|
||||
$tt = $etime - $stime;
|
||||
|
||||
# If we got a server error, or unknown output type, report back as critical.
|
||||
if ($response->status_line !~ "^200") {
|
||||
print $message." (".$response->status_line.")\r\n";
|
||||
exit $ERRORS{$failtype};
|
||||
} elsif ($response->content_type !~ $mimetype) {
|
||||
print $message." (Wrong Content-type: ".$response->content_type.")\r\n";
|
||||
exit $ERRORS{$failtype};
|
||||
} else {
|
||||
# Because we're dealing with multiple URL's
|
||||
$rt += $tt;
|
||||
}
|
||||
|
||||
# Decide if the response time was critical or not.
|
||||
#
|
||||
if ($rt > $critical) {
|
||||
print "Response time ".$rt." over critical threshold ".$critical."\r\n";
|
||||
exit($ERRORS{'CRITICAL'});
|
||||
} elsif ($rt > $warning) {
|
||||
print "Response time ".$rt." over warning threshold ".$warning."\r\n";
|
||||
exit($ERRORS{'WARNING'});
|
||||
}
|
||||
}
|
||||
printf(" %s - %s second response time, ",$response->status_line, $rt);
|
||||
|
||||
# If all the required URL's give the right responses quick enough, then we
|
||||
# should be okay.
|
||||
exit($ERRORS{'OK'});
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <host> [-w <warn>] [-c <crit>]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$');
|
||||
print "Copyright (c) 2003 Kev Green\n";
|
||||
print "\n";
|
||||
print "FrontPage remains a copyright/trademark of Microsoft Corporation.\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<warn> = Unknown.\n";
|
||||
print "<crit> = Server error from FrontPage extensions.\n\n";
|
||||
support();
|
||||
}
|
||||
209
contrib/check_hltherm.c
Normal file
209
contrib/check_hltherm.c
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
/******************************************************************************************
|
||||
*
|
||||
* CHECK_HLTHERM.C
|
||||
*
|
||||
* Program: Hot Little Therm temperature plugin for Nagios
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: 02-28-2002
|
||||
*
|
||||
* Command line: check_hltherm <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This plugin checks the temperature of a given temperature probe on a
|
||||
* Hot Little Therm digital thermometer. The plugin uses the 'therm' utility
|
||||
* that is included with the HLT software to check the probe temperature. Both
|
||||
* the HLT digital thermometer and software are produced by Spiderplant. See
|
||||
* their website at http://www.spiderplant.com/hlt for more information.
|
||||
*
|
||||
*****************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "popen.h"
|
||||
|
||||
#define DEFAULT_TIMEOUT 10 /* default timeout in seconds */
|
||||
|
||||
#define HLTHERM_COMMAND "/usr/local/bin/therm" /* this should be moved out to the configure script */
|
||||
|
||||
|
||||
static void timeout_alarm_handler(int); /* author must provide */
|
||||
int process_arguments(int, char **);
|
||||
|
||||
int timeout_interval=DEFAULT_TIMEOUT;
|
||||
|
||||
double wtemp=0.0L;
|
||||
double ctemp=0.0L;
|
||||
|
||||
int check_lower_temps=FALSE;
|
||||
|
||||
char probe[MAX_INPUT_BUFFER]="";
|
||||
char label[MAX_INPUT_BUFFER]="Temperature";
|
||||
char scale[MAX_INPUT_BUFFER]="Degrees";
|
||||
|
||||
FILE *fp;
|
||||
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int result=STATE_OK;
|
||||
char command[MAX_INPUT_BUFFER];
|
||||
double temp=0.0L;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
int found=0;
|
||||
|
||||
/* process command line arguments */
|
||||
result=process_arguments(argc,argv);
|
||||
|
||||
/* display usage if there was a problem */
|
||||
if(result==ERROR){
|
||||
printf("Incorrect arguments supplied\n");
|
||||
printf("\n");
|
||||
printf("Hot Little Therm temperature plugin for Nagios\n");
|
||||
printf("Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 02-28-2002\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" <wtemp> = Temperature necessary to result in a WARNING state\n");
|
||||
printf(" <ctemp> = Temperature necessary to result in a CRITICAL state\n");
|
||||
printf(" [label] = A descriptive label for the probe. Example: \"Outside Temp\"\n");
|
||||
printf(" [scale] = A descriptive label for the temperature scale. Example: \"Celsius\"\n");
|
||||
printf(" [-lower] = Evaluate temperatures with lower values being more critical\n");
|
||||
printf("\n");
|
||||
printf("This plugin checks the temperature of a given temperature probe on a\n");
|
||||
printf("Hot Little Therm digital thermometer. The plugin uses the 'therm' utility\n");
|
||||
printf("included with the HLT software to check the probe temperature. Both the\n");
|
||||
printf("HLT digital thermometer and software are produced by Spiderplant. See\n");
|
||||
printf("their website at http://www.spiderplant.com/hlt for more information.\n");
|
||||
printf("\n");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
result=STATE_OK;
|
||||
|
||||
/* Set signal handling and alarm */
|
||||
if(signal(SIGALRM,timeout_alarm_handler)==SIG_ERR){
|
||||
printf("Cannot catch SIGALRM");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* handle timeouts gracefully */
|
||||
alarm(timeout_interval);
|
||||
|
||||
/* create the command line we're going to use */
|
||||
snprintf(command,sizeof(command),"%s %s",HLTHERM_COMMAND,probe);
|
||||
command[sizeof(command)-1]='\x0';
|
||||
|
||||
/* run the command to check the temperature on the probe */
|
||||
fp=spopen(command);
|
||||
if(fp==NULL){
|
||||
printf("Could not open pipe: %s\n",command);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
if(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
found=1;
|
||||
temp=(double)atof(input_buffer);
|
||||
}
|
||||
|
||||
/* close the pipe */
|
||||
spclose(fp);
|
||||
|
||||
if(result==STATE_OK){
|
||||
|
||||
if(found==0){
|
||||
printf("Therm problem - Could not read program output\n");
|
||||
result=STATE_CRITICAL;
|
||||
}
|
||||
else{
|
||||
if(check_lower_temps==TRUE){
|
||||
if(temp<=ctemp)
|
||||
result=STATE_CRITICAL;
|
||||
else if(temp<=wtemp)
|
||||
result=STATE_WARNING;
|
||||
}
|
||||
else{
|
||||
if(temp>=ctemp)
|
||||
result=STATE_CRITICAL;
|
||||
else if(temp>=wtemp)
|
||||
result=STATE_WARNING;
|
||||
}
|
||||
|
||||
printf("Therm %s: %s = %2.1f %s\n",(result==STATE_OK)?"ok":"problem",label,temp,scale);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* process command-line arguments */
|
||||
int process_arguments(int argc, char **argv){
|
||||
int x;
|
||||
|
||||
/* not enough options were supplied */
|
||||
if(argc<4)
|
||||
return ERROR;
|
||||
|
||||
/* first option is always the probe name */
|
||||
strncpy(probe,argv[1],sizeof(probe)-1);
|
||||
probe[sizeof(probe)-1]='\x0';
|
||||
|
||||
/* 2nd and 3rd options are temperature thresholds */
|
||||
wtemp=(double)atof(argv[2]);
|
||||
ctemp=(double)atof(argv[3]);
|
||||
|
||||
/* process all remaining arguments */
|
||||
for(x=5;x<=argc;x++){
|
||||
|
||||
/* we got the lower temperature option */
|
||||
if(!strcmp(argv[x-1],"-lower"))
|
||||
check_lower_temps=TRUE;
|
||||
|
||||
/* we got the label */
|
||||
else if(!strcmp(argv[x-1],"-l")){
|
||||
if(x<argc){
|
||||
strncpy(label,argv[x],sizeof(label));
|
||||
label[sizeof(label)-1]='\x0';
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* we got the scale */
|
||||
else if(!strcmp(argv[x-1],"-s")){
|
||||
if(x<argc){
|
||||
strncpy(scale,argv[x],sizeof(scale));
|
||||
scale[sizeof(scale)-1]='\x0';
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* else we got something else... */
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* handle timeouts gracefully... */
|
||||
static void timeout_alarm_handler(int signo){
|
||||
|
||||
if(signo==SIGALRM){
|
||||
|
||||
kill(childpid[fileno(fp)],SIGKILL);
|
||||
printf("Therm problem - Check timed out after %d seconds\n",timeout_interval);
|
||||
exit(STATE_CRITICAL);
|
||||
}
|
||||
}
|
||||
221
contrib/check_hprsc.pl
Executable file
221
contrib/check_hprsc.pl
Executable file
|
|
@ -0,0 +1,221 @@
|
|||
#!/usr/bin/perl -wT
|
||||
#
|
||||
# Copyright (c) 2000 Hugo Gayosso
|
||||
#
|
||||
# Description:
|
||||
# Nagios plug-in that monitors the resources on an HP-UX machine
|
||||
# by querying the SNMP daemon
|
||||
#
|
||||
# License: General Public License (GPL)
|
||||
# http://www.gnu.org/copyleft/gpl.txt
|
||||
#
|
||||
# ChangeLog
|
||||
#
|
||||
|
||||
# Requirements: Perl 5.005 or higher
|
||||
|
||||
# Variable initialization
|
||||
$ENV{'PATH'}="";
|
||||
$ENV{'ENV'}="";
|
||||
$ENV{'BASH_ENV'}="";
|
||||
|
||||
|
||||
if (-e "/usr/bin/snmpwalk") {
|
||||
$snmpwalk = "/usr/bin/snmpwalk";
|
||||
} elsif (-e "/usr/local/bin/snmpwalk") {
|
||||
$snmpwalk = "/usr/local/bin/snmpwalk";
|
||||
}
|
||||
|
||||
|
||||
# HP-UX SNMP OIDs
|
||||
$filesystemID1_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.1";
|
||||
$mounted_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.3";
|
||||
$totalspace_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.4";
|
||||
$freespace_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.6";
|
||||
$path_OID = ".1.3.6.1.4.1.11.2.3.1.2.2.1.10";
|
||||
$cpu_5min_OID = ".1.3.6.1.4.1.11.2.3.1.1.4";
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
GetOptions( "check-filesystem" => \$chk_fs,
|
||||
"show-filesystems" => \$show_fs,
|
||||
"check-filesystemID" => \$chk_fsid,
|
||||
"check-cpu" => \$chk_cpu,
|
||||
"host=s" => \$target_host,
|
||||
"community=s" => \$target_community,
|
||||
"filesystemID1=i" => \$fsid1_opt,
|
||||
"filesystem=s" => \$fs_opt,
|
||||
"protocol:s" => \$proto_opt,
|
||||
"warning=i" => \$warning_opt,
|
||||
"critical=i" => \$critical_opt);
|
||||
|
||||
$proto_opt = 1
|
||||
unless $proto_opt == 1 ||
|
||||
$proto_opt == '2c' ||
|
||||
$proto_opt == 3;
|
||||
|
||||
if ($chk_fs) {
|
||||
walk_data($snmpwalk, $target_host, $target_community, $mounted_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $totalspace_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $freespace_OID,$proto_opt ); check_filesystem($fs_opt, $warning_opt, $critical_opt);
|
||||
} elsif ($show_fs) {
|
||||
walk_data($snmpwalk, $target_host, $target_community, $filesystemID1_OID,$proto_opt);
|
||||
walk_data($snmpwalk, $target_host, $target_community, $mounted_OID,$proto_opt );
|
||||
walk_data($snmpwalk, $target_host, $target_community, $path_OID,$proto_opt);
|
||||
show_filesystem();
|
||||
} elsif ($chk_fsid){
|
||||
$totalspace_fsID_OID = "$totalspace_OID.$fsid1_opt";
|
||||
$freespace_fsID_OID = "$freespace_OID.$fsid1_opt";
|
||||
walk_data($snmpwalk, $target_host, $target_community, $totalspace_fsID_OID,$proto_opt);
|
||||
walk_data($snmpwalk, $target_host, $target_community, $freespace_fsID_OID,$proto_opt);
|
||||
check_filesystemID1($fsid1_opt, $warning_opt, $critical_opt);
|
||||
} elsif ($chk_cpu) {
|
||||
get_cpu_load($snmpwalk, $target_host, $target_community, $cpu_5min_OID,$proto_opt);
|
||||
check_cpu_5min($cpu, $warning_opt, $critical_opt);
|
||||
} else {
|
||||
print "\n\nUsage:\n";
|
||||
print "Checking 5-min CPU Load:\n";
|
||||
print " $0 --check-cpu -warning <threshold> --critical <threshold> --host <yourhost> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking local filesystem mounted on a host:\n";
|
||||
print " $0 --show-filesystems --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking by filesystem name:\n";
|
||||
print " $0 --check-filesystem --filesystem </dev/vg00/lvol1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
print "Checking by filesystem ID:\n";
|
||||
print " $0 --check-filesystemID --filesystemID <filesystemID1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community> --protocol <SNMP version [1|2c|3]>\n\n";
|
||||
}
|
||||
|
||||
sub get_cpu_load {
|
||||
my ($snmpwalk, $target_host, $target_community, $OID,$vers) = @_;
|
||||
die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
|
||||
|
||||
if ($pid) { # parent
|
||||
while (<SNMPWALK>) {
|
||||
my @snmpdata = split(/:/,$_);
|
||||
$cpu = $snmpdata[1]/100;
|
||||
}
|
||||
close(SNMPWALK) or warn "kid exited $?";
|
||||
} else { # child
|
||||
exec($snmpwalk,'-c',$target_community,'-v',$vers,$target_host,$OID) or die "can't exec program: $!";
|
||||
}
|
||||
}
|
||||
|
||||
sub walk_data {
|
||||
#This function queries the SNMP daemon for the specific OID
|
||||
my ($snmpwalk, $target_host, $target_community, $OID,$vers) = @_;
|
||||
|
||||
die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
|
||||
|
||||
if ($pid) { # parent
|
||||
while (<SNMPWALK>) {
|
||||
$output = $_;
|
||||
sort_walk_data($output);
|
||||
}
|
||||
close(SNMPWALK) or warn "kid exited $?";
|
||||
} else { # child
|
||||
exec($snmpwalk,'-c',$target_community,'-v',$vers,$target_host,$OID) or die "can't exec program: $!";
|
||||
}
|
||||
}
|
||||
|
||||
sub sort_walk_data {
|
||||
my ($snmp_data) = @_;
|
||||
@fields = split(/\./,$snmp_data);
|
||||
$item = $fields[8];
|
||||
$filesystemID1 = $fields[9];
|
||||
@fields2 = split(/=/,$fields[10]);
|
||||
# $filesystemID2 = $fields2[0];
|
||||
$value = $fields2[1];
|
||||
chomp($value);
|
||||
if ($value =~ /"/) {
|
||||
@fields3 = split(/"/,$value);
|
||||
$value = $fields3[1];
|
||||
}
|
||||
if ($item == 3) {
|
||||
$mounted{$filesystemID1} = "$value";
|
||||
} elsif ($item == 4) {
|
||||
$totalspace{$filesystemID1} = "$value";
|
||||
} elsif ($item == 6) {
|
||||
$freespace{$filesystemID1} = "$value";
|
||||
} elsif ($item == 10) {
|
||||
$filesystempath{$filesystemID1} = "$value";
|
||||
}
|
||||
}
|
||||
|
||||
sub show_filesystem {
|
||||
print "\n\nfilesystemID1\tmounted filesystem\tfilesystem path\n";
|
||||
foreach $element (keys %mounted) {
|
||||
print "$element\t$mounted{$element}\t\t$filesystempath{$element}\n";
|
||||
}
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
sub check_filesystem {
|
||||
|
||||
# Warning = percentage of used space >= $warning and < $critical
|
||||
# Critical = percentage of used space > $warning and >= $critical
|
||||
# OK = percentage of used space < $warning and < $critical
|
||||
|
||||
my ($mounted_filesystem, $warning, $critical) = @_;
|
||||
foreach $element (keys %mounted) {
|
||||
if ($mounted{$element} eq $mounted_filesystem) {
|
||||
my $warning_result = $totalspace{$element}*(100-$warning)/100;
|
||||
my $critical_result = $totalspace{$element}*(100-$critical)/100;
|
||||
my $result_percent = $freespace{$element}*100/$totalspace{$element};
|
||||
if (($freespace{$element} <= $warning_result) && ($freespace{$element} > $critical_result)) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 1;
|
||||
} elsif ($freespace{$element} <= $critical_result) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 2;
|
||||
} else {
|
||||
printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$mounted_filesystem doesn't exist in $target_host\n\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
sub check_filesystemID1{
|
||||
# Warning = percentage of used space >= $warning and < $critical
|
||||
# Critical = percentage of used space > $warning and >= $critical
|
||||
# OK = percentage of used space < $warning and < $critical
|
||||
|
||||
my ($fsid1, $warning, $critical) = @_;
|
||||
foreach $element (keys %totalspace) {
|
||||
if ($element eq $fsid1) {
|
||||
my $warning_result = $totalspace{$element}*(100-$warning)/100;
|
||||
my $critical_result = $totalspace{$element}*(100-$critical)/100;
|
||||
my $result_percent = $freespace{$element}*100/$totalspace{$element};
|
||||
if (($freespace{$element} <= $warning_result) && ($freespace{$element} >= $critical_result)) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 1;
|
||||
} elsif ($freespace{$element} <= $critical_result) {
|
||||
printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 2;
|
||||
} else {
|
||||
printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "$fsid1 doesn't exist in $target_host\n\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
sub check_cpu_5min {
|
||||
my ($cpu, $warn, $crit) = @_;
|
||||
if ($cpu >= $crit) {
|
||||
print "Critical- 5-min load: $cpu\n";
|
||||
exit 2;
|
||||
} elsif ($cpu >= $warn) {
|
||||
print "Warning - 5-min load: $cpu\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "Load ok - 5-min load: $cpu\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1567
contrib/check_http-with-client-certificate.c
Normal file
1567
contrib/check_http-with-client-certificate.c
Normal file
File diff suppressed because it is too large
Load diff
66
contrib/check_hw.sh
Normal file
66
contrib/check_hw.sh
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# Tested on SuSE 9.1 Professional with the hwinfo-8.62-0.2 package installed.
|
||||
#
|
||||
# Before you can run this plugin, you must do:
|
||||
# /usr/sbin/hwinfo --short > /etc/hw.original
|
||||
# add to cron job:
|
||||
# /usr/sbin/hwinfo --short > /etc/hw.current
|
||||
# /usr/bin/diff /etc/hw.original /etc/hw.current > /tmp/hw.check
|
||||
#
|
||||
#
|
||||
# Rok Debevc -- rok.debevc@agenda.si
|
||||
#
|
||||
#
|
||||
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$' | 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 changes."
|
||||
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
|
||||
;;
|
||||
*)
|
||||
if `du /tmp/hw.check | cut -c 1|grep "^[0]" > /dev/null` ; then
|
||||
echo No hardware is changed
|
||||
exit 0
|
||||
else
|
||||
echo ***hardware is changed*** look into /tmp/hw.check
|
||||
exit 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
229
contrib/check_ica_master_browser.pl
Executable file
229
contrib/check_ica_master_browser.pl
Executable file
|
|
@ -0,0 +1,229 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id$
|
||||
|
||||
# $Log$
|
||||
# Revision 1.1 2005/01/25 09:09:33 stanleyhopcroft
|
||||
# New plugin - checks that ICA master browser is what it should be (important for firewalled dialup)
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Getopt::Long ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw(%ERRORS &print_revision &support &usage);
|
||||
use packet_utils qw(&pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_ica_master_browser' ;
|
||||
|
||||
# You might have to change this...
|
||||
|
||||
my $PACKET_TIMEOUT = 1;
|
||||
# Number of seconds to wait for further UDP packets
|
||||
my $TEST_COUNT = 2;
|
||||
# Number of datagrams sent without reply
|
||||
my $BUFFER_SIZE = 1500;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $ICA_PORT = 1604;
|
||||
# what port ICA runs on. Unlikely to change.
|
||||
|
||||
# End user config.
|
||||
|
||||
my ($debug, $preferred_master, $bcast_addr, $ica_browser, $timeout) ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$debug,
|
||||
"B|broadcast_addr:s" => \$bcast_addr,
|
||||
"I|ica_browser:s" => \$ica_browser,
|
||||
"P|preferred_master:s" => \$preferred_master,
|
||||
"T|Packet_timeout:i" => \$timeout,
|
||||
) ;
|
||||
|
||||
|
||||
my $broadcast_addr = $1 if $bcast_addr and $bcast_addr =~ m#(\d+\.\d+\.\d+\.\d+)# ;
|
||||
usage("Invalid broadcast address: $bcast_addr")
|
||||
if $bcast_addr and not defined($broadcast_addr) ;
|
||||
|
||||
usage("You must provide either the name of an ICA browser or the broadcast address of the subnet containing them\n")
|
||||
unless ($ica_browser or $broadcast_addr) ;
|
||||
|
||||
usage("You must provide the name or address of a preferred ICA master browser\n")
|
||||
unless ($preferred_master) ;
|
||||
|
||||
my $preferred_master_n = $preferred_master =~ m#(\d+\.\d+\.\d+\.\d+)#
|
||||
? $preferred_master
|
||||
: inet_ntoa(scalar gethostbyname($preferred_master)) ;
|
||||
|
||||
my $Timeout = $timeout || $PACKET_TIMEOUT ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# this info was gathered with tcpdump whilst trying to use an ICA client,
|
||||
# so I'm not 100% sure of what each value is.
|
||||
|
||||
my $bcast_helo = &tethereal(<<'End_of_Tethereal_trace', '1e') ;
|
||||
0020 ff ff 04 d6 06 44 00 26 4a 76 1e 00 01 30 02 fd .....D.&Jv...0..
|
||||
0030 a8 e3 00 02 f5 95 9f f5 30 07 00 00 00 00 00 00 ........0.......
|
||||
0040 00 00 00 00 00 00 01 00 ........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_helo = &tethereal(<<'End_of_Tethereal_trace', '20') ;
|
||||
0020 64 17 05 0f 06 44 00 28 ab b5 20 00 01 30 02 fd d....D.(.. ..0..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 00 00 00 00 ........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $Udp = IO::Socket::INET->new( Proto => 'udp' )
|
||||
|| die "Socket failure: $!";
|
||||
|
||||
# select is here to allow us to set timeouts on the connections. Otherwise they
|
||||
# just 'stop' until a server appears.
|
||||
|
||||
my $select = IO::Select->new($Udp)
|
||||
|| die "Select failure: $!";
|
||||
|
||||
$Udp->sockopt(SO_BROADCAST, 1 );
|
||||
|
||||
my ($remote_host, $buff, $destination, $raddr, $rport, $rhost, @remote_response);
|
||||
my ($query_message, $send_addr, $this_test) ;
|
||||
|
||||
$buff = '';
|
||||
$this_test = 0;
|
||||
|
||||
# If there is no response to the first helo packet it will be resent
|
||||
# up to $TEST_COUNT (see at the top).
|
||||
|
||||
$query_message = $broadcast_addr ? $bcast_helo : $direct_helo ;
|
||||
$destination = $broadcast_addr ? $broadcast_addr: $ica_browser ;
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($destination) ) ;
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
|
||||
print "Sending helo datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
|
||||
print "Querying $destination for master browser\n"
|
||||
if $debug ;
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr );
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
}
|
||||
|
||||
last
|
||||
if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
|
||||
# Ok we've looped several times, looking for a response. If we don't have one
|
||||
# yet, we simply mark the whole lot as being unavailable.
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to helo datagram (master browser query) from $destination.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
($rport, $raddr) = sockaddr_in( $remote_host );
|
||||
$rhost = gethostbyaddr( $raddr, AF_INET );
|
||||
my @tmpbuf = unpack('C*', $buff );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded with: ",length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
# Now we have a response, then we need to figure out the master browser, and
|
||||
# query it for published applications...
|
||||
|
||||
my $master_browser = join '.', @tmpbuf[32..35] ;
|
||||
my ($master_browser_a) = gethostbyaddr(inet_aton($master_browser), AF_INET) =~ /^(\w+?)\./ ;
|
||||
|
||||
# Ok should probably error check this, because it's remotely possible
|
||||
# that a server response might be completely wrong...
|
||||
|
||||
print "Master browser = $master_browser_a/$master_browser\n"
|
||||
if $debug ;
|
||||
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($master_browser));
|
||||
|
||||
my $subject_clause = $bcast_addr ? "of the \"$destination\" subnet" : "known to ICA server \"$destination\"" ;
|
||||
|
||||
if ( $master_browser eq $preferred_master_n ) {
|
||||
print "Preferred master browser \"$preferred_master\" __is__ the master browser (\"$master_browser_a/$master_browser\") $subject_clause.\n" ;
|
||||
exit $ERRORS{OK} ;
|
||||
} else {
|
||||
print "\"\u$preferred_master\" is __not__ the master browser (\"$master_browser_a/$master_browser\") $subject_clause: remote clients (dialup) may not find Published applications from Master Browser.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
close $Udp;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME (-B <broadcast_address>| -I <citrix_server>) - P <preferred_master_browser>" ;
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
print "Copyright (c) 2002 Ed Rolison/Tom De Blende/S Hopcroft
|
||||
|
||||
Perl Check Citrix Master Browser plugin for Nagios.
|
||||
|
||||
Returns OK if the Citrix master browser is that given by the -P option.
|
||||
|
||||
The plugin works by
|
||||
If the -B option is specified, sends a broadcast helo to find the address of the Citrix master browser in the specified subnet.
|
||||
return critical if there is no reply;
|
||||
Else if the -I option is specified
|
||||
send a direct helo to the specified server until there is a response (containing the address of the Citrix master browser)
|
||||
|
||||
|
||||
return Critical if the response does not contain the address of the 'preferred master browser' (-P option).
|
||||
return OK
|
||||
|
||||
How ICA Clients Use the Master ICA Browser.
|
||||
|
||||
Citrix ICA Clients must locate the master browser to get the address of a server or published application.
|
||||
|
||||
The Citrix ICA Client can locate the master browser by sending out broadcast packets, or,
|
||||
if the address of a Citrix server is specified in the Citrix ICA Client or in an ICA file,
|
||||
the ICA Client locates the master browser by sending directed packets to the specified address.
|
||||
The ICA Client requests the address of the ICA master browser from the Citrix server.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-B, --broadcast_address:STRING
|
||||
The broadcast address that should contain Citrix master browser. This option takes precedence over -I.
|
||||
-I, --ica_browser:STRING
|
||||
Optional name or address of an ICA server that could be the master browser (used when broadcast not possible).
|
||||
-P, --preferred_master:STRING
|
||||
Name or address of the ICA server that _should_ be the master browser.
|
||||
Required.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for UDP packets (default 1 sec).
|
||||
-v, --verbose
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
382
contrib/check_ica_metaframe_pub_apps.pl
Executable file
382
contrib/check_ica_metaframe_pub_apps.pl
Executable file
|
|
@ -0,0 +1,382 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id$
|
||||
|
||||
# $Log$
|
||||
# Revision 1.1 2005/01/25 09:07:39 stanleyhopcroft
|
||||
# Replacement (structured name mainly) for check_citrix: check of ICA browse service
|
||||
#
|
||||
# Revision 1.1 2005-01-25 17:00:24+11 anwsmh
|
||||
# Initial revision
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Getopt::Long ;
|
||||
|
||||
my ($bcast_addr, $timeout, $debug, @citrix_servers, $crit_pub_apps, $warn_pub_apps, $long_list) ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw(%ERRORS &print_revision &support &usage) ;
|
||||
use packet_utils qw(&pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_ica_metaframe_pub_apps' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
# You might have to change this...
|
||||
|
||||
my $PACKET_TIMEOUT = 1;
|
||||
# Number of seconds to wait for further UDP packets
|
||||
my $TEST_COUNT = 2;
|
||||
# Number of datagrams sent without reply
|
||||
my $BUFFER_SIZE = 1500;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $LONG_LIST = 0 ;
|
||||
# this is for if you have many published applications.
|
||||
# if you set it, it won't do any harm, but may slow the test
|
||||
# down a little. (Since it does a 'recv' twice instead of
|
||||
# once and therefore may have to wait for a timeout).
|
||||
my $ICA_PORT = 1604;
|
||||
# what port ICA runs on. Unlikely to change.
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$debug,
|
||||
"B|broadcast_addr:s" => \$bcast_addr,
|
||||
"C|citrix_servers:s" => \@citrix_servers,
|
||||
"L|long_list" => \$long_list,
|
||||
"P|crit_pub_apps:s" => \$crit_pub_apps,
|
||||
"T|Packet_timeout:i" => \$timeout,
|
||||
"W|warn_pub_apps:s" => \$warn_pub_apps,
|
||||
) ;
|
||||
|
||||
|
||||
my $broadcast_addr = $1 if $bcast_addr and $bcast_addr =~ m#(\d+\.\d+\.\d+\.\d+)# ;
|
||||
usage("Invalid broadcast address: $bcast_addr\n")
|
||||
if $bcast_addr and not defined($broadcast_addr) ;
|
||||
|
||||
usage("You must provide either the names of citrix servers or the broadcast address of the subnet containing them\n")
|
||||
unless (@citrix_servers or $broadcast_addr) ;
|
||||
|
||||
my @target = defined $broadcast_addr ? ($broadcast_addr) : @citrix_servers ;
|
||||
|
||||
usage("You must provide the names of the published applications that the Citrix browser should be advertising\n")
|
||||
unless $crit_pub_apps or $warn_pub_apps ;
|
||||
|
||||
my $Timeout = $timeout
|
||||
if defined $timeout ;
|
||||
$Timeout = $PACKET_TIMEOUT
|
||||
unless defined $Timeout ;
|
||||
$long_list = $LONG_LIST
|
||||
unless defined $long_list ;
|
||||
|
||||
my @crit_pub_apps = $crit_pub_apps ? split(/,/, $crit_pub_apps) : () ;
|
||||
my @warn_pub_apps = $warn_pub_apps ? split(/,/, $warn_pub_apps) : () ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# this info was gathered with tcpdump whilst trying to use an ICA client,
|
||||
# so I'm not 100% sure of what each value is.
|
||||
|
||||
my $bcast_helo = &tethereal(<<'End_of_Tethereal_trace', '1e') ;
|
||||
0020 ff ff 04 d6 06 44 00 26 4a 76 1e 00 01 30 02 fd .....D.&Jv...0..
|
||||
0030 a8 e3 00 02 f5 95 9f f5 30 07 00 00 00 00 00 00 ........0.......
|
||||
0040 00 00 00 00 00 00 01 00 .......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $bcast_query_app = &tethereal(<<'End_of_Tethereal_trace', '24') ;
|
||||
0020 64 17 04 50 06 44 00 2c 85 6a 24 00 01 32 02 fd d..P.D.,.j$..2..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 21 00 02 00 00 00 00 00 ......!......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_helo = &tethereal(<<'End_of_Tethereal_trace', '20') ;
|
||||
0020 64 17 05 0f 06 44 00 28 ab b5 20 00 01 30 02 fd d....D.(.. ..0..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 00 00 00 00 .........
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $direct_query_app = &tethereal(<<'End_of_Tethereal_trace', '2c') ;
|
||||
0020 64 17 05 10 06 44 00 34 7a 9a 2c 00 02 32 02 fd d....D.4z.,..2..
|
||||
0030 a8 e3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||
0040 00 00 00 00 00 00 21 00 02 00 01 00 00 00 00 00 ......!.........
|
||||
0050 00 00 00 00 00 00 ......
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $Udp = IO::Socket::INET->new( Proto => 'udp' )
|
||||
|| die "Socket failure: $!";
|
||||
|
||||
# Select is here to allow us to set timeouts on the connections.
|
||||
# Otherwise they just 'stop' until a server appears.
|
||||
|
||||
my $select = IO::Select->new($Udp)
|
||||
|| die "Select failure: $!";
|
||||
# Helo needs to be broadcastt, but query does not.
|
||||
$Udp->sockopt(SO_BROADCAST, 1 );
|
||||
|
||||
my ($remote_host, $buff, $buff2, $raddr, $rport, $rhost, @remote_response);
|
||||
my ($query_message, $send_addr, $this_test) ;
|
||||
|
||||
$buff = $buff2 = '';
|
||||
$this_test = 0;
|
||||
|
||||
# If there is no response to the first helo packet it will be resent
|
||||
# up to TEST_COUNT (see at the top).
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
|
||||
print "Sending helo datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
|
||||
# If we have multiple targets, we probe each of them until we get a
|
||||
# response...
|
||||
|
||||
foreach my $destination (@target) {
|
||||
$query_message = $broadcast_addr ? $bcast_helo : $direct_helo ;
|
||||
print "Querying $destination for master browser\n"
|
||||
if $debug ;
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($destination) );
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr );
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
}
|
||||
|
||||
last
|
||||
if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
# Ok we've looped several times, looking for a response. If we don't have one
|
||||
# yet, we simply mark the whole lot as being unavailable.
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to helo datagram (master browser query) from ", $broadcast_addr ? $broadcast_addr : "@citrix_servers", ".\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
($rport, $raddr) = sockaddr_in( $remote_host );
|
||||
$rhost = gethostbyaddr( $raddr, AF_INET );
|
||||
my @tmpbuf = unpack('C*', $buff );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded with: ", length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
# Now we have a response, then we need to figure out the master browser, and
|
||||
# query it for published applications...
|
||||
|
||||
my $master_browser = join '.', @tmpbuf[32..35] ;
|
||||
|
||||
# Ok should probably error check this, because it's remotely possible
|
||||
# that a server response might be completely wrong...
|
||||
|
||||
print "Master browser = $master_browser\n"
|
||||
if $debug ;
|
||||
|
||||
$send_addr = sockaddr_in($ICA_PORT, inet_aton($master_browser));
|
||||
|
||||
if ( $broadcast_addr ) {
|
||||
print "using broadcast query\n"
|
||||
if $debug ;
|
||||
$query_message = $bcast_query_app;
|
||||
} else {
|
||||
print "using directed query\n"
|
||||
if $debug ;
|
||||
$query_message = $direct_query_app;
|
||||
}
|
||||
|
||||
# Now we send the appropriate query string, to the master browser we've found.
|
||||
|
||||
$buff = '';
|
||||
$this_test = 0 ;
|
||||
|
||||
print "Querying master browser for published application list\n"
|
||||
if $debug ;
|
||||
|
||||
while ( ++$this_test <= $TEST_COUNT && !$buff ) {
|
||||
print "Sending application query datagram. datagram number: ", $this_test, "\n"
|
||||
if $debug ;
|
||||
&pdump($query_message)
|
||||
if $debug ;
|
||||
$Udp->send($query_message, 0, $send_addr);
|
||||
|
||||
if ( $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff, $BUFFER_SIZE, 0 );
|
||||
# $buff = substr($buff, 32) ;
|
||||
# Hope that ICA preamble is first 32 bytes
|
||||
}
|
||||
|
||||
# Long application lists are delivered in multiple packets
|
||||
|
||||
my $buff2 = '' ;
|
||||
while ( $long_list && $select->can_read($Timeout) ) {
|
||||
$remote_host = $Udp->recv($buff2, $BUFFER_SIZE, 0);
|
||||
$buff .= $buff2
|
||||
if $buff2 ;
|
||||
# $buff .= substr($buff2, 32) if $buff2 ;
|
||||
# Hope that ICA preamble is first 32 bytes
|
||||
}
|
||||
|
||||
last if $buff ;
|
||||
sleep 1 ;
|
||||
|
||||
}
|
||||
|
||||
unless ( $buff ) {
|
||||
print "Failed. No response to application query datagram from ", $master_browser, ".\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
# we got a response from a couple of retries of the app query
|
||||
|
||||
($rport, $raddr) = sockaddr_in ( $remote_host );
|
||||
$rhost = gethostbyaddr ( $raddr, AF_INET );
|
||||
if ( $debug ) {
|
||||
print "$rhost:$rport responded to app query with: ", length($buff), " bytes\n";
|
||||
&pdump($buff) ;
|
||||
}
|
||||
|
||||
my $app_list = $buff ;
|
||||
# delete nulls in unicode
|
||||
# but only if there is unicode (usually from
|
||||
# broadcast query)
|
||||
|
||||
$app_list =~ s/(?:(\w| |-)\x00)/$1/g
|
||||
if $app_list =~ /(?:(?:(?:\w| |-)\x00){3,})/ ;
|
||||
# FIXME an application name is
|
||||
# 3 or more unicoded characters
|
||||
|
||||
# FIXME locale
|
||||
# extract null terminated strings
|
||||
|
||||
my (@clean_app_list, $clean_app_list) ;
|
||||
$clean_app_list = join(',', @clean_app_list = $app_list =~ m#([A-Za-z](?:\w| |-|[ÄÖÜäöüß])+?(?=\x00))#g ) ;
|
||||
|
||||
# patch for German umlauts et al from Herr Mike Gerber.
|
||||
|
||||
# $clean_app_list = join(',', @clean_app_list = $app_list =~ m#([A-Z](?:\w| |-)+?(?=\x00))#g ) ;
|
||||
|
||||
# FIXME everyones apps don't start with caps
|
||||
|
||||
print qq(Received list of applications: "$clean_app_list".\n)
|
||||
if $debug ;
|
||||
|
||||
if ( scalar @crit_pub_apps and my @missing = &simple_diff(\@clean_app_list, \@crit_pub_apps) ) {
|
||||
print qq(Failed. "@missing" not found in list of published applications),
|
||||
qq(" $clean_app_list" from master browser "$master_browser".\n) ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
if ( my @missing = &simple_diff(\@clean_app_list, \@warn_pub_apps) ) {
|
||||
print qq(Warning. "@missing" not found in list of published applications),
|
||||
qq(" $clean_app_list" from master browser "$master_browser".\n) ;
|
||||
exit $ERRORS{WARNING} ;
|
||||
}
|
||||
|
||||
my @x = (@crit_pub_apps, @warn_pub_apps) ;
|
||||
my $blah = ( scalar(@x) == 1
|
||||
? 'the published application "' . join(',', @x) . '" is available'
|
||||
: 'the published applications "' . join(',', @x) . '" are available' ) ;
|
||||
|
||||
print qq(Ok. Citrix master browser "$master_browser" reported that $blah.\n) ;
|
||||
exit $ERRORS{OK} ;
|
||||
|
||||
# sleep $Timeout;
|
||||
# because otherwise we can get responses from
|
||||
# the WRONG servers. DOH
|
||||
close $Udp;
|
||||
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME (-B <broadcast_address>| -C <citrix_server>..) -W <pub_app1,pub_app2..> -P <pub_app1,pub_app2,>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
print "Copyright (c) 2002 Ed Rolison/Tom De Blende/S Hopcroft
|
||||
|
||||
Perl Check Citrix plugin for Nagios.
|
||||
|
||||
Returns OK if the Citrix master browser returns a 'published application' list that contain names specified by the -W or -P options
|
||||
|
||||
The plugin works by
|
||||
If the -B option is specified, sending a broadcast helo to find the address of the Citrix master browser in the specified subnet.
|
||||
return critical if there is no reply;
|
||||
Else if the -C option is specified
|
||||
send a direct helo to the specified server until there is a response (containing the address of the Citrix master browser)
|
||||
|
||||
Query the master browser (using a 'broadcast published applications query ' if -B) and compare the published applications returned
|
||||
to those specified by -W and -P options
|
||||
|
||||
return Critical if the published applications specified by -P is not a subset of the query responses;
|
||||
return Warning if the published applications specified by -W is not a subset of the query responses;
|
||||
return OK
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-B, --broadcast_address=STRING
|
||||
The broadcast address that should contain Citrix master browser. This option takes precedence over -C.
|
||||
-C, --citrix_server:STRING
|
||||
Optional __name(s)__ of Citrix servers that could be the master browser (used when broadcast not possible).
|
||||
-L, --long_list
|
||||
Set this if you have heaps of published applications (ie more than will fit in _one_ UDP packet)
|
||||
-P, --crit_published_app=STRING
|
||||
Optional comma separated list of published application that must be in the response from the master browser.
|
||||
Check returns critical otherwise.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for UDP packets (default 1 sec).
|
||||
-W, --warn_published_app=STRING
|
||||
Optional comma separated list of published application that should be in the response from the master browser.
|
||||
Check returns warning otherwise.
|
||||
-v, --verbose
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
|
||||
sub simple_diff {
|
||||
|
||||
my ( $a_list, $b_list) = @_ ;
|
||||
|
||||
# simple set difference 'Recipe 4.7 Perl Cookbook', Christiansen and Torkington
|
||||
|
||||
my (%seen, @missing) ;
|
||||
|
||||
@seen{@$a_list} = () ;
|
||||
|
||||
foreach my $item (@$b_list) {
|
||||
push @missing, $item
|
||||
unless exists $seen{$item} ;
|
||||
}
|
||||
|
||||
@missing ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
619
contrib/check_ica_program_neigbourhood.pl
Executable file
619
contrib/check_ica_program_neigbourhood.pl
Executable file
|
|
@ -0,0 +1,619 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id$
|
||||
|
||||
# $Log$
|
||||
# Revision 1.1 2005/01/25 09:05:53 stanleyhopcroft
|
||||
# New plugin to check Citrix Metaframe XP "Program Neighbourhood"
|
||||
#
|
||||
# Revision 1.1 2005-01-25 16:50:30+11 anwsmh
|
||||
# Initial revision
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
use LWP 5.65 ;
|
||||
use XML::Parser ;
|
||||
|
||||
my $PROGNAME = 'check_program_neigbourhood' ;
|
||||
my ($debug, $xml_debug, $pn_server, $pub_apps, $app_servers, $server_farm, $usage) ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case') ;
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"A|published_app:s" => \$pub_apps,
|
||||
"h|help" => \&help,
|
||||
'usage|?' => \&usage,
|
||||
"F|server_farm=s" => \$server_farm,
|
||||
"P|pn_server=s" => \$pn_server,
|
||||
"S|app_server=s" => \$app_servers,
|
||||
"v|verbose" => \$debug,
|
||||
"x|xml_debug" => \$xml_debug,
|
||||
) ;
|
||||
|
||||
$pn_server || do {
|
||||
print "Name or IP Address of _one_ Program Neighbourhood server is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
$pub_apps ||= 'Word 2003' ;
|
||||
$pub_apps =~ s/["']//g ;
|
||||
my @pub_apps = split /,\s*/, $pub_apps ;
|
||||
|
||||
my @app_servers = split /,\s*/, $app_servers ;
|
||||
|
||||
@app_servers || do {
|
||||
print "IP Address of _each_ Application server in the Metaframe Citrix XP server farm is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
my @non_ip_addresses = grep ! /\d+\.\d+\.\d+\.\d+/, @app_servers ;
|
||||
|
||||
scalar(@non_ip_addresses) && do {
|
||||
print qq(Application servers must be specified by IP Address (not name): "@non_ip_addresses".\n) ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
$server_farm || do {
|
||||
print "Name of Citrix Metaframe XP server farm is required.\n" ;
|
||||
&print_usage ;
|
||||
exit $ERRORS{UNKNOWN} ;
|
||||
} ;
|
||||
|
||||
my %xml_tag = () ;
|
||||
my @tag_stack = () ;
|
||||
|
||||
my $xml_p = new XML::Parser(Handlers => {Start => \&handle_start,
|
||||
End => sub { pop @tag_stack },
|
||||
Char => \&handle_char}) ;
|
||||
|
||||
# values required by Metaframe XP that don't appear to matter too much
|
||||
|
||||
my $client_host = 'Nagios server (http://www.Nagios.ORG)' ;
|
||||
my $user_name = 'nagios' ;
|
||||
my $domain = 'Nagios_Uber_Alles' ;
|
||||
|
||||
# end values required by Metaframe XP
|
||||
|
||||
my $nilpotent_req = <<'EOR' ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd"><NFuseProtocol version="1.1">
|
||||
<RequestProtocolInfo>
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
</RequestProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $server_farm_req = <<'EOR' ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestServerFarmData>
|
||||
<Nil />
|
||||
</RequestServerFarmData>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $spec_server_farm_req = <<EOR ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>
|
||||
<Name>
|
||||
<UnspecifiedName>$server_farm*</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>$client_host</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>$user_name</UserName>
|
||||
<Domain>$domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $app_req = <<EOR ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>
|
||||
<Name>
|
||||
<UnspecifiedName>PUBLISHED_APP_ENCODED</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>Nagios_Service_Check</ClientName>
|
||||
<ClientAddress addresstype="dns-port"/>
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>$PROGNAME</UserName>
|
||||
<Domain>$domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>
|
||||
</NFuseProtocol>
|
||||
EOR
|
||||
|
||||
my $ua = LWP::UserAgent->new ;
|
||||
my $req = HTTP::Request->new('POST', "http://$pn_server/scripts/WPnBr.dll") ;
|
||||
$req->content_type('text/xml') ;
|
||||
|
||||
my $svr ;
|
||||
|
||||
my @pubapp_encoded = map { my $x = $_ ; $x =~ s/(\W)/'&#' . ord($1) . ';'/eg; $x } @pub_apps ;
|
||||
|
||||
my $error_tag_cr = sub { ! exists($xml_tag{ErrorId}) } ;
|
||||
|
||||
my @app_reqs = (
|
||||
# { Content => url, Ok => ok_condition, Seq => \d+ }
|
||||
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 0 },
|
||||
{ Content => $server_farm_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerFarmName}) &&
|
||||
defined($xml_tag{ServerFarmName}) &&
|
||||
$xml_tag{ServerFarmName} eq $server_farm
|
||||
}, Seq => 2 },
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 4 },
|
||||
{ Content => $spec_server_farm_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerAddress}) &&
|
||||
defined($xml_tag{ServerAddress}) &&
|
||||
$xml_tag{ServerAddress} =~ /\d+\.\d+\.\d+\.\d+:\d+/
|
||||
}, Seq => 6 },
|
||||
{ Content => $nilpotent_req, Ok => $error_tag_cr, Seq => 8 },
|
||||
{ Content => $app_req, Ok => sub {
|
||||
! exists($xml_tag{ErrorId}) &&
|
||||
exists( $xml_tag{ServerAddress}) &&
|
||||
defined($xml_tag{ServerAddress}) &&
|
||||
(($svr) = split(/:/, $xml_tag{ServerAddress})) &&
|
||||
defined($svr) &&
|
||||
scalar(grep $_ eq $svr, @app_servers)
|
||||
}, Seq => 10 }
|
||||
) ;
|
||||
|
||||
my $app_location ;
|
||||
|
||||
foreach my $pub_app (@pub_apps) {
|
||||
|
||||
my $pubapp_enc = shift @pubapp_encoded ;
|
||||
my $app_req_tmp = $app_reqs[5]{Content} ;
|
||||
$app_reqs[5]{Content} =~ s/PUBLISHED_APP_ENCODED/$pubapp_enc/ ;
|
||||
|
||||
foreach (@app_reqs) {
|
||||
|
||||
$req->content($_->{Content}) ;
|
||||
|
||||
$debug && print STDERR "App: $pub_app Seq: $_->{Seq}\n", $req->as_string, "\n" ;
|
||||
|
||||
my $resp = $ua->request($req) ;
|
||||
|
||||
$debug && print STDERR "App: $pub_app Seq: ", $_->{Seq} + 1, "\n", $resp->as_string, "\n" ;
|
||||
|
||||
$resp->is_error && do {
|
||||
my $err = $resp->as_string ;
|
||||
$err =~ s/\n//g ;
|
||||
&outahere(qq(Failed. HTTP error finding $pub_app at seq $_->{Seq}: "$err")) ;
|
||||
} ;
|
||||
my $xml = $resp->content ;
|
||||
|
||||
my $xml_disp ;
|
||||
($xml_disp = $xml) =~ s/\n//g ;
|
||||
$xml_disp =~ s/ \s+/ /g ;
|
||||
|
||||
&outahere($resp->as_string)
|
||||
unless $xml ;
|
||||
|
||||
my ($xml_ok, $whine) = &valid_xml($xml_p, $xml) ;
|
||||
|
||||
$xml_ok || &outahere(qq(Failed. Bad XML finding $pub_app at eq $_->{Seq} in "$xml_disp".)) ;
|
||||
|
||||
&{$_->{Ok}} || &outahere(qq(Failed. \"\&\$_->{Ok}\" false finding $pub_app at seq $_->{Seq} in "$xml_disp".)) ;
|
||||
|
||||
# Ugly but alternative is $_->{Ok}->().
|
||||
# eval $_->{Ok} where $_->{Ok} is an
|
||||
# expression returning a bool is possible. but
|
||||
# sub { } prevent recompilation.
|
||||
|
||||
}
|
||||
|
||||
$app_reqs[5]{Content} = $app_req_tmp ;
|
||||
|
||||
$app_location .= qq("$pub_app" => $svr, ) ;
|
||||
|
||||
}
|
||||
|
||||
substr($app_location, -2, 2) = '' ;
|
||||
print qq(Ok. Citrix XML service located all published apps $app_location.\n) ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
|
||||
sub outahere {
|
||||
print "Citrix XML service $_[0]\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
sub valid_xml {
|
||||
my ($p, $input) = @_ ;
|
||||
|
||||
%xml_tag = () ;
|
||||
@tag_stack = () ;
|
||||
|
||||
eval {
|
||||
$p->parse($input)
|
||||
} ;
|
||||
|
||||
return (0, qq(XML::Parser->parse failed: Bad XML in "$input".!))
|
||||
if $@ ;
|
||||
|
||||
if ( $xml_debug ) {
|
||||
print STDERR pack('A4 A30 A40', ' ', $_, qq(-> "$xml_tag{$_}")), "\n"
|
||||
foreach (keys %xml_tag)
|
||||
}
|
||||
|
||||
return (1, 'valid xml')
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub handle_start {
|
||||
push @tag_stack, $_[1] ;
|
||||
|
||||
$xml_debug && print STDERR pack('A8 A30 A40', ' ', 'handle_start - tag', " -> '$_[1]'"), "\n" ;
|
||||
$xml_debug && print STDERR pack('A8 A30 A60', ' ', 'handle_start - @tag_stack', " -> (@tag_stack)"), "\n" ;
|
||||
}
|
||||
|
||||
sub handle_char {
|
||||
my $text = $_[1] ;
|
||||
|
||||
!($text =~ /\S/ || $text =~ /^[ \t]$/) && return ;
|
||||
|
||||
$text =~ s/\n//g ;
|
||||
|
||||
my $tag = $tag_stack[-1] ;
|
||||
|
||||
$xml_debug && print STDERR pack('A8 A30 A30', ' ', 'handle_char - tag', " -> '$tag'"), "\n" ;
|
||||
$xml_debug && print STDERR pack('A8 A30 A40', ' ', 'handle_char - text', " -> '$text'"), "\n" ;
|
||||
|
||||
$xml_tag{$tag} .= $text ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub print_help() {
|
||||
|
||||
# 1 2 3 4 5 6 7 8
|
||||
#12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
|
||||
my $help = <<EOHELP ;
|
||||
Copyright (c) 2004 Karl DeBisschop/S Hopcroft
|
||||
|
||||
$PROGNAME -P <pn_server> -S <svr1,svr2,..> -A <app1,app2,..>
|
||||
-F <Farm> [-v -x -h -V]
|
||||
|
||||
Check the Citrix Metaframe XP service by completing an HTTP dialogue with a Program
|
||||
Neigbourhood server (pn_server) that returns an ICA server in the named Server farm
|
||||
hosting the specified applications (an ICA server in a farm which runs some MS app).
|
||||
EOHELP
|
||||
|
||||
print $help ;
|
||||
print "\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
support();
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
|
||||
# 1 2 3 4 5 6 7 8
|
||||
#12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||
|
||||
my $usage = <<EOUSAGE ;
|
||||
$PROGNAME
|
||||
[-P | --pn_server] The name or address of the Citrix Metaframe XP
|
||||
Program Neigbourhood server (required).
|
||||
[-A | --pub_apps] The name or names of an application published by the
|
||||
server farm (default 'Word 2003').
|
||||
[-F | --server_farm] The name of a Citrix Metaframe XP server farm. (required)
|
||||
[-S | --app_servers] The _IP addresses_ of _all_ of the Farms ICA servers expected
|
||||
to host the published application.
|
||||
Enter as a comma separated string eg 'Srv1, Svr2, ..,Srvn'.
|
||||
Since the PN servers round-robin the app servers to the clients,
|
||||
_all_ the server farm addresses must be specified or the check
|
||||
will fail (required).
|
||||
[-v | --verbose]
|
||||
[-h | --help]
|
||||
[-x | --xml_debug]
|
||||
[-V | --version]
|
||||
EOUSAGE
|
||||
|
||||
print $usage ;
|
||||
|
||||
}
|
||||
|
||||
sub usage {
|
||||
&print_usage ;
|
||||
exit $ERRORS{'OK'} ;
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
=begin comment
|
||||
|
||||
This is the set of requests and responses transmitted between a Citrix Metaframe XP Program Neigbourhood (PN) client and a PN server.
|
||||
|
||||
This dialogue was captured by and reconstructed from tcpdump.
|
||||
|
||||
Citrix are not well known for documenting their protocols although the DTD may be informative. Note that the pair(s) 0 and 1, 4 and 5, ...
|
||||
do not appear to do anything.
|
||||
|
||||
req 0
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
|
||||
|
||||
resp 1
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 2
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 191
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestServerFarmData><Nil /></RequestServerFarmData></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
|
||||
|
||||
resp 3
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:40 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 293
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseServerFarmData>
|
||||
<ServerFarmData>
|
||||
<ServerFarmName>FOOFARM01</ServerFarmName>
|
||||
</ServerFarmData>
|
||||
</ResponseServerFarmData>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 4
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:55 GMT
|
||||
|
||||
|
||||
resp 5
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:55 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 6
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 442
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress><Name>i
|
||||
<UnspecifiedName>FOOFARM01*</UnspecifiedName>
|
||||
</Name><ClientName>WS09535</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials>
|
||||
<UserName>foo-user</UserName>
|
||||
<Domain>some-domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:56 GMT
|
||||
|
||||
|
||||
resp 7
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:12:56 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 507
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ServerAddress addresstype="dot-port">10.1.2.2:1494</ServerAddress>
|
||||
<ServerType>win32</ServerType>
|
||||
<ConnectionType>tcp</ConnectionType>
|
||||
<ClientType>ica30</ClientType>
|
||||
<TicketTag>10.1.2.2</TicketTag>
|
||||
<SSLRelayAddress addresstype="dns-port">ica_svr01.some.domain:443</SSLRelayAddress>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 8
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 220
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1"><RequestProtocolInfo><ServerAddress addresstype="dns-port" /></RequestProtocolInfo></NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
|
||||
|
||||
resp 9
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 253
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseProtocolInfo>
|
||||
<ServerAddress addresstype="no-change"></ServerAddress>
|
||||
</ResponseProtocolInfo>
|
||||
</NFuseProtocol>
|
||||
|
||||
req 10
|
||||
POST /scripts/WPnBr.dll HTTP/1.1
|
||||
Content-type: text/xml
|
||||
Host: 10.1.2.2:80
|
||||
Content-Length: 446
|
||||
Connection: Keep-Alive
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<RequestAddress>i
|
||||
<Name>
|
||||
<UnspecifiedName>EXCEL#32;2003</UnspecifiedName>
|
||||
</Name>
|
||||
<ClientName>WS09535</ClientName>
|
||||
<ClientAddress addresstype="dns-port" />
|
||||
<ServerAddress addresstype="dns-port" />
|
||||
<Flags />
|
||||
<Credentials><UserName>foo-user</UserName>
|
||||
<Domain>some-domain</Domain>
|
||||
</Credentials>
|
||||
</RequestAddress>i
|
||||
</NFuseProtocol>
|
||||
|
||||
HTTP/1.1 100 Continue
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
|
||||
|
||||
resp 11
|
||||
HTTP/1.1 200 OK
|
||||
Server: Citrix Web PN Server
|
||||
Date: Thu, 30 Sep 2004 00:13:29 GMT
|
||||
Content-type: text/xml
|
||||
Content-length: 509
|
||||
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ServerAddress addresstype="dot-port">10.1.2.14:1494</ServerAddress>
|
||||
<ServerType>win32</ServerType>
|
||||
<ConnectionType>tcp</ConnectionType>
|
||||
<ClientType>ica30</ClientType>
|
||||
<TicketTag>10.1.2.14</TicketTag>
|
||||
<SSLRelayAddress addresstype="dns-port">ica_svr02.some.domain:443</SSLRelayAddress>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
** One sees this XML on an error (there may well be other error XML also, but I haven't seen it) **
|
||||
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<!DOCTYPE NFuseProtocol SYSTEM "NFuse.dtd">
|
||||
<NFuseProtocol version="1.1">
|
||||
<ResponseAddress>
|
||||
<ErrorId>unspecified</ErrorId>
|
||||
<BrowserError>0x0000000E</BrowserError>
|
||||
</ResponseAddress>
|
||||
</NFuseProtocol>
|
||||
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
# You never know when you may be embedded ...
|
||||
|
||||
|
||||
127
contrib/check_inodes-freebsd.pl
Normal file
127
contrib/check_inodes-freebsd.pl
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# check_inodes.pl for FreeBSD
|
||||
# Designed on FreeBSD 4.6 (although this should not matter)
|
||||
# parses df output, splits, and then takes variables
|
||||
# df.pl -f mountpoint -w warningnumber -c critical number
|
||||
# USE NUMBERS AND NOT PERCENTS FOR wanring and critical values
|
||||
# -h is help
|
||||
# -v is version
|
||||
# Mountpoints:
|
||||
# like / or /usr or /var (whatever you mount drives NOT the device names)
|
||||
# Andrew Ryder - 20020804 - atr@mrcoffee.org
|
||||
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_f $verbose $PROGNAME);
|
||||
use lib "/usr/local/libexec/nagios" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
|
||||
|
||||
my $df = "/bin/df";
|
||||
my $grep = "/usr/bin/grep";
|
||||
|
||||
$PROGNAME="df.pl";
|
||||
|
||||
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,
|
||||
"f=s" => \$opt_f, "filesystem=s" => \$opt_f);
|
||||
|
||||
|
||||
if ($opt_V) {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
if ($opt_h) {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
($opt_w) || ($opt_w = shift) || ($opt_w = 50);
|
||||
my $warning = $1 if ($opt_w =~ /([0-9]+)/);
|
||||
|
||||
($opt_c) || ($opt_c = shift) || ($opt_c = 75);
|
||||
my $critical = $1 if ($opt_c =~ /([0-9]+)/);
|
||||
|
||||
if ($opt_c < $opt_w) {
|
||||
print "Critical offset should be larger than warning offset\n";
|
||||
print_usage();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
($opt_f) || ($opt_f = "/");
|
||||
|
||||
|
||||
unless (-e $df) {
|
||||
print "UNKNOWN: $df is not where df is\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
unless (-e $grep) {
|
||||
print "UNKNOWN: $grep is not where grep is\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
unless (-d $opt_f) {
|
||||
print "UNKNOWN: $opt_f is not a mount point\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
|
||||
my $state = $ERRORS{'UNKNOWN'};
|
||||
my $answer;
|
||||
|
||||
open(DF, "$df -i $opt_f| $grep -v Filesystem |");
|
||||
|
||||
while (<DF>) {
|
||||
|
||||
my ($fs,$onek,$used,$avail,$capacity,$iused,$ifree,$ipercent,$mounted) = split;
|
||||
$ipercent =~ s/%//s;
|
||||
|
||||
if ($ipercent > $opt_w) {
|
||||
$state = $ERRORS{'WARNING'};
|
||||
$answer = "WARNING: $ipercent percent inodes free on $opt_f\n";
|
||||
} elsif ($ipercent > $opt_w) {
|
||||
$state = $ERRORS{'CRITCAL'};
|
||||
$answer = "CRITICAL: $ipercent percent inodes free on $opt_f\n";
|
||||
} elsif ($ipercent < $opt_w) {
|
||||
$state = $ERRORS{'OK'};
|
||||
$answer = "OK: $ipercent percent inodes free on $opt_f\n";
|
||||
}
|
||||
}
|
||||
|
||||
close(DF);
|
||||
|
||||
print "$answer";
|
||||
exit $state;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME <filesystem> [-w <warn>] [-c <crit>]\n";
|
||||
print "Example: $PROGNAME /dev/ad0s1a -w 50 -c 75\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$');
|
||||
print "Copyright (c) 2002 Andrew Ryder\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "<warn> = Inode Percent at which a warning message is returned. Defaults to 50.\n";
|
||||
print "<crit> = Inode Percent at which a critical message is returned..\n Defaults to 75.\n\n";
|
||||
support();
|
||||
}
|
||||
|
||||
|
||||
69
contrib/check_inodes.pl
Executable file
69
contrib/check_inodes.pl
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/perl
|
||||
##############################################################################
|
||||
# This plugin uses df to gather filesystem statistics and check the percent #
|
||||
# used of inodes. I've put a switch in here since i've got both aix and #
|
||||
# linux systems...adjust for your syntax's results. #
|
||||
# Note: the percentages passed in MUST NOT have % after them #
|
||||
# No warranty is either implied, nor expressed herein. #
|
||||
# #
|
||||
##############################################################################
|
||||
|
||||
$filesystem = $ARGV[0];
|
||||
$warnpercent = $ARGV[1];
|
||||
$critpercent = $ARGV[2];
|
||||
|
||||
#------Find out what kind of syntax to expect
|
||||
$systype=`uname`;
|
||||
chomp($systype);
|
||||
|
||||
#------Make sure we got called with the right number of arguments
|
||||
#------you could also put a check in here to make sure critical level is
|
||||
#------greater than warning...but what the heck.
|
||||
die "Usage: check_inodes filesystem warnpercent critpercent" unless @ARGV;
|
||||
|
||||
if ($#ARGV < 2) {
|
||||
die "Usage: check_inodes filesystem warnpercent critpercent";
|
||||
}#end if
|
||||
|
||||
#------This gets the data from the df command
|
||||
$inputline = `df -i $filesystem|grep -v "Filesystem"`;
|
||||
|
||||
#------replaces all spaces with a single :, that way we can use split
|
||||
$inputline =~ y/ /:/s;
|
||||
|
||||
#------different oses give back different sets of columns from the df -i
|
||||
#------(at least mine do). This way I can use this plugin on all my hosts
|
||||
#------if neither of these work, add your own in, or if you've got one that
|
||||
#------just flat out reports something different...well...perl is your friend.
|
||||
SWITCH: {
|
||||
if ($systype eq "Linux") {
|
||||
($fs,$inodes,$iused,$ifree,$ipercent,$mntpt) = split(/:/,$inputline);
|
||||
last SWITCH;
|
||||
}#end if
|
||||
if ($systype eq "AIX") {
|
||||
($fs,$blks,$free,$percentused,$iused,$ipercent,$mntpt) = split(/:/,$inputline);
|
||||
last SWITCH;
|
||||
}#end if
|
||||
}#end switch
|
||||
|
||||
#------First we check for critical, since that is, by definition and convention
|
||||
#------going to exceed the warning threshold
|
||||
$ipercent =~ y/%//ds;
|
||||
|
||||
if ($ipercent > $critpercent) {
|
||||
print "CRITICAL: $filesystem inode use exceeds critical threshold $critpercent ($ipercent)";
|
||||
exit 1;
|
||||
}# end if
|
||||
|
||||
#------Next we check the warning threshold
|
||||
if ($ipercent > $warnpercent) {
|
||||
print "WARNING: $filesystem inode use exceeds warning threshold $warnpercent ($ipercent)";
|
||||
exit 2;
|
||||
}# end if
|
||||
|
||||
|
||||
#------thanks to the magic of procedural programming, we figure if we got here,
|
||||
#------everything MUST be fine.
|
||||
print "$filesystem inode use within limits ($ipercent)";
|
||||
exit 0;
|
||||
|
||||
201
contrib/check_ipxping.c
Normal file
201
contrib/check_ipxping.c
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/******************************************************************************************
|
||||
*
|
||||
* CHECK_IPXPING.C
|
||||
*
|
||||
* Program: IPX ping plugin for Nagios
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: 09-24-1999
|
||||
*
|
||||
* Command line: CHECK_IPXPING <dest_network> <dest_address> <wrtt> <crtt>
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This plugin will use the /usr/bin/ipxping command to ping the specified host using the
|
||||
* IPX protocol. Note: Linux users must have IPX support compiled into the kernerl and
|
||||
* must have IPX configured correctly in order for this plugin to work.
|
||||
* If the round trip time value is above the <wrtt> level, a STATE_WARNING is
|
||||
* returned. If it exceeds the <crtt> level, a STATE_CRITICAL is returned.
|
||||
*
|
||||
*
|
||||
*
|
||||
* IMPORTANT!!
|
||||
*
|
||||
* This plugin will only work with the ipxping command that has been ported to Linux.
|
||||
* The version for Sun takes different command line arguments and differs in its output.
|
||||
*
|
||||
*****************************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "popen.h"
|
||||
|
||||
/* this should be moved out to the configure script! */
|
||||
#define IPXPING_COMMAND "/tmp/ipxping/ipxping"
|
||||
|
||||
/* these should be moved to the common header file */
|
||||
#define MAX_IPXNET_ADDRESS_LENGTH 12
|
||||
#define MAX_IPXHOST_ADDRESS_LENGTH 18
|
||||
|
||||
int socket_timeout=DEFAULT_SOCKET_TIMEOUT;
|
||||
char dest_network[MAX_IPXNET_ADDRESS_LENGTH];
|
||||
char dest_address[MAX_IPXHOST_ADDRESS_LENGTH];
|
||||
int wrtt;
|
||||
int crtt;
|
||||
|
||||
int process_arguments(int,char **);
|
||||
|
||||
FILE * spopen(const char *);
|
||||
int spclose(FILE *);
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char command_line[MAX_INPUT_BUFFER];
|
||||
int rtt;
|
||||
int bytes_returned;
|
||||
int result=STATE_OK;
|
||||
FILE *fp;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *substr;
|
||||
int current_line;
|
||||
|
||||
if(process_arguments(argc,argv)!=OK){
|
||||
printf("Incorrect arguments supplied\n");
|
||||
printf("\n");
|
||||
printf("IPX ping plugin for Nagios\n");
|
||||
printf("Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf("Last Modified: 09-24-1999\n");
|
||||
printf("License: GPL\n");
|
||||
printf("\n");
|
||||
printf("Usage: %s <dest_network> <dest_address> <wrtt> <crtt> [-to to_sec]\n",argv[0]);
|
||||
printf("\n");
|
||||
printf("Options:\n");
|
||||
printf(" <dest_network> = IPX network that the remote host lies on. (Hex Format - 00:00:00:00)\n");
|
||||
printf(" <dest_address> = MAC address of the remote host. (Hex Format - 00:00:00:00:00:00)\n");
|
||||
printf(" <wrtt> = Round trip time in milliseconds necessary to result in a WARNING state\n");
|
||||
printf(" <crtt> = Round trip time in milliseconds necessary to result in a CRITICAL state\n");
|
||||
printf(" [to_sec] = Seconds before we should timeout waiting for ping result. Default = %d sec\n",DEFAULT_SOCKET_TIMEOUT);
|
||||
printf("\n");
|
||||
printf("Notes:\n");
|
||||
printf("This plugin will use the /usr/bin/ipxping command to ping the specified host using\n");
|
||||
printf("the IPX protocol. IPX support must be compiled into the kernel and your host must\n");
|
||||
printf("be correctly configured to use IPX before this plugin will work! An RPM package of\n");
|
||||
printf("the ipxping binary can be found at...\n");
|
||||
printf("http://www.rpmfind.net/linux/RPM/contrib/libc5/i386/ipxping-0.0-2.i386.shtml\n");
|
||||
printf("\n");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
/* create the command line to use... */
|
||||
sprintf(command_line,"%s %s %s",IPXPING_COMMAND,dest_network,dest_address);
|
||||
|
||||
/* initialize alarm signal handling */
|
||||
signal(SIGALRM,socket_timeout_alarm_handler);
|
||||
|
||||
/* set socket timeout */
|
||||
alarm(socket_timeout);
|
||||
|
||||
/* run the command */
|
||||
fp = spopen(command_line);
|
||||
if(fp==NULL){
|
||||
printf("Unable to open pipe: %s",command_line);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
current_line=0;
|
||||
while(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
|
||||
|
||||
current_line++;
|
||||
|
||||
/* skip the first line of the output */
|
||||
if(current_line==1)
|
||||
continue;
|
||||
|
||||
/* we didn't get the "is alive" */
|
||||
if(current_line==2 && !strstr(input_buffer,"is alive"))
|
||||
result=STATE_CRITICAL;
|
||||
|
||||
/* get the round trip time */
|
||||
if(current_line==3){
|
||||
substr=strtok(input_buffer,":");
|
||||
substr=strtok(NULL,"\n");
|
||||
rtt=atoi(substr);
|
||||
}
|
||||
|
||||
/* get the number of bytes returned */
|
||||
if(current_line==4 && strstr(input_buffer,"bytes returned")){
|
||||
bytes_returned=atoi(input_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/* close the pipe */
|
||||
spclose(fp);
|
||||
|
||||
/* reset the alarm */
|
||||
alarm(0);
|
||||
|
||||
if(current_line==1 || result==STATE_CRITICAL)
|
||||
printf("IPX Ping problem - No response from host\n");
|
||||
else{
|
||||
|
||||
if(rtt>crtt)
|
||||
result=STATE_CRITICAL;
|
||||
else if(rtt>wrtt)
|
||||
result=STATE_WARNING;
|
||||
|
||||
printf("IPX Ping %s - RTT = %d ms, %d bytes returned from %s %s\n",(result==STATE_OK)?"ok":"problem",rtt,bytes_returned,dest_network,dest_address);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* process all arguments passed on the command line */
|
||||
int process_arguments(int argc, char **argv){
|
||||
int x;
|
||||
|
||||
/* no options were supplied */
|
||||
if(argc<5)
|
||||
return ERROR;
|
||||
|
||||
/* get the destination network address */
|
||||
strncpy(dest_network,argv[1],sizeof(dest_network)-1);
|
||||
dest_network[sizeof(dest_network)-1]='\x0';
|
||||
|
||||
/* get the destination host address */
|
||||
strncpy(dest_address,argv[2],sizeof(dest_address)-1);
|
||||
dest_address[sizeof(dest_address)-1]='\x0';
|
||||
|
||||
/* get the round trip time variables */
|
||||
wrtt=atoi(argv[3]);
|
||||
crtt=atoi(argv[4]);
|
||||
|
||||
/* process remaining arguments */
|
||||
for(x=6;x<=argc;x++){
|
||||
|
||||
/* we got the timeout to use */
|
||||
if(!strcmp(argv[x-1],"-to")){
|
||||
if(x<argc){
|
||||
socket_timeout=atoi(argv[x]);
|
||||
if(socket_timeout<=0)
|
||||
return ERROR;
|
||||
x++;
|
||||
}
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* else we got something else... */
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
278
contrib/check_javaproc.pl
Normal file
278
contrib/check_javaproc.pl
Normal file
|
|
@ -0,0 +1,278 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
#
|
||||
# Author: Wim Rijnders, 17-10-2002
|
||||
#
|
||||
# Description:
|
||||
# -----------
|
||||
#
|
||||
# Nagios host script to check if any specified java processes are running.
|
||||
#
|
||||
# Implementation Notes:
|
||||
# ---------------------
|
||||
#
|
||||
# check_disk_smb was used as a starting point, since it was written in perl.
|
||||
#
|
||||
# This script has been created and tested on Linux RH 7.1.
|
||||
#
|
||||
# I tried OS-X Darwin (BSD), but the ps command works differently.
|
||||
# Notably, you can't get a combined list of child processes. The best approach
|
||||
# appears to be to use 'ps -wwaxo command' combined with 'ps -M' (or suchlike)
|
||||
#
|
||||
########################################################################
|
||||
####
|
||||
|
||||
require 5.004;
|
||||
use POSIX;
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use vars qw($opt_w $opt_c $verbose $classname);
|
||||
use vars qw($PROGNAME);
|
||||
use lib "utils.pm" ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
|
||||
$PROGNAME="check_javaprocs";
|
||||
sub getJavaList ();
|
||||
sub check_ranges ($ $ $ $);
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|verbose" => \$verbose,
|
||||
"w|warning=s" => \$opt_w,
|
||||
"c|critical=s" => \$opt_c,
|
||||
"n|name=s" => \$classname
|
||||
);
|
||||
|
||||
|
||||
my $state = 'OK';
|
||||
my $min_warn = undef
|
||||
my $max_warn = undef;
|
||||
my $min_crit = undef;
|
||||
my $max_crit = undef;
|
||||
|
||||
|
||||
($opt_w) || ($opt_w = shift);
|
||||
check_ranges($opt_w,\$min_warn, \$max_warn, "warning");
|
||||
($opt_c) || ($opt_c = shift);
|
||||
check_ranges($opt_c,\$min_crit, \$max_crit, "critical");
|
||||
|
||||
|
||||
#
|
||||
# Determine # of running processes for the java programs that interest us.
|
||||
#
|
||||
my @javalist = getJavaList();
|
||||
|
||||
my $total = 0;
|
||||
my $msgout = "";
|
||||
my @fields;
|
||||
|
||||
if ( defined $classname ) {
|
||||
|
||||
#filter out a single java process based on class name
|
||||
foreach (@javalist) {
|
||||
@fields = split(/\s+/, $_);
|
||||
$total = $fields[-1] and last if $classname eq $fields[0];
|
||||
}
|
||||
$msgout .= "$total processes for $classname\n";
|
||||
} else {
|
||||
#Handle all java processes
|
||||
$msgout .= "\n";
|
||||
foreach (@javalist) {
|
||||
@fields = split(/\s+/, $_);
|
||||
|
||||
$total += $fields[-1];
|
||||
$msgout .= " $fields[-1] processes for ";
|
||||
$msgout .= (scalar @fields > 1)? $fields[0] : "unknown" ;
|
||||
$msgout .= "\n";
|
||||
}
|
||||
my $msgtotal = "$total java processes for ". scalar @javalist . " applications";
|
||||
|
||||
if ( defined $verbose ) {
|
||||
$msgout = $msgtotal . $msgout;
|
||||
} else {
|
||||
$msgout = $msgtotal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Set the state with the data we now have accumulated
|
||||
# Note that due to the order of testing, warnings have precedence over
|
||||
# criticals. This is logical, since you should be able to create a criticals
|
||||
# range which encompasses a warning range. eg. following should be possible:
|
||||
#
|
||||
# check_javaproc -w 5:10 -c 3:12
|
||||
# proper specification of the ranges is the responsibility of the script user.
|
||||
#
|
||||
$state = 'CRITICAL' if (defined $min_crit && $total < $min_crit);
|
||||
$state = 'CRITICAL' if (defined $max_crit && $total > $max_crit);
|
||||
$state = 'CRITICAL' if (!defined $min_crit && !defined $max_crit && $total==0 );
|
||||
$state = 'WARNING' if (defined $min_warn && $total < $min_warn);
|
||||
$state = 'WARNING' if (defined $max_warn && $total > $max_warn);
|
||||
|
||||
print $msgout;
|
||||
print "$state\n" if ($verbose);
|
||||
exit $ERRORS{$state};
|
||||
|
||||
###################################
|
||||
# Support routines for Nagios
|
||||
###################################
|
||||
sub check_ranges($$$$) {
|
||||
my ($opt, $min, $max, $rangename) = @_;
|
||||
|
||||
if ( defined $opt ) {
|
||||
if ( $opt =~ /^([0-9]*)\:([0-9]*)$/) {
|
||||
$$min = $1 if $1 > 0;
|
||||
$$max= $2 if $2 > 0;
|
||||
} else {
|
||||
usage("Invalid $rangename range: $opt\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ( defined $$min && defined $$max ) {
|
||||
usage("Min value of $rangename range larger than max value: $opt\n") if ( $$min > $$max);
|
||||
}
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME [-v] [-w <min:max>] [-c <min:max>] [ -n <classname>]\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
revision();
|
||||
print "Copyright (c) 2002 by Wim Rijnders
|
||||
|
||||
Perl Check java processes plugin for Nagios
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print "
|
||||
-v, --verbose
|
||||
Return additional information.
|
||||
Intended as a command-line aid, not recommended for Nagios script usage.
|
||||
|
||||
-w, --warning=INTEGER:INTEGER
|
||||
Minimum and maximum number of processes outside of which a warning will be
|
||||
generated. If omitted, no warning is generated.
|
||||
|
||||
-c, --critical=INTEGER:INTEGER
|
||||
Minimum and maximum number of processes outside of which a critical will be
|
||||
generated. If omitted, a critical is generated if no processes are running.
|
||||
|
||||
-n, --name=STRING
|
||||
Name of class specified on the java command line (from which main() is run).
|
||||
If omitted, all java processes are taken into account.
|
||||
|
||||
";
|
||||
support();
|
||||
}
|
||||
|
||||
sub revision() {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
}
|
||||
|
||||
sub version () {
|
||||
revision();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
###################################
|
||||
# Routines for delivering the data
|
||||
###################################
|
||||
|
||||
#
|
||||
# Generate a formatted list of running java processes.
|
||||
#
|
||||
# Returns an array of strings having the following syntax:
|
||||
#
|
||||
# <java class running as main> <parameters if any> <#processes for this class>
|
||||
#
|
||||
sub getJavaList() {
|
||||
|
||||
my @output;
|
||||
|
||||
# Untaint
|
||||
local $ENV{'PATH'} = '/bin:/usr/bin';
|
||||
local $ENV{'BASH_ENV'} = '~/.bashrc';
|
||||
|
||||
# We are only interested in the full command line
|
||||
# The -H opstion is important for the order of the processes;
|
||||
# this option ensures that all child processes are listed under
|
||||
# their parents
|
||||
@output=`ps -AHo \"\%a\" -ww`;
|
||||
|
||||
#remove preceding whitespace and final EOL
|
||||
foreach (@output) {
|
||||
s/^\s*//;
|
||||
chop;
|
||||
}
|
||||
|
||||
#Combine any consecutive processes with exactly the same command line
|
||||
#into a single item
|
||||
@output = checkSameLine(@output);
|
||||
|
||||
#Filter out all java processes
|
||||
my @javalist;
|
||||
for (my $i = 0; $i < scalar @output; ++$i) {
|
||||
push @javalist, $output[$i] if $output[$i] =~ /^\S*java/;
|
||||
}
|
||||
|
||||
foreach (@javalist) {
|
||||
#The java statement at the beginning is redundant; remove it
|
||||
s/^\S*java//;
|
||||
|
||||
#remove all defines
|
||||
s/\-D\S+//g;
|
||||
|
||||
#remove classpath
|
||||
s/\-(classpath|cp)\s+\S+//g;
|
||||
|
||||
#remove any other parameters we don't want to see
|
||||
s/\-server\s+//g;
|
||||
s/\-X\S*\s+//g;
|
||||
|
||||
#remove any redundant whitespaces at the beginning
|
||||
s/^\s+//;
|
||||
|
||||
}
|
||||
|
||||
@javalist;
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Combine all consecutive lines with an identical command line
|
||||
# to a signle line with a count at the end
|
||||
#
|
||||
sub checkSameLine {
|
||||
my @input = @_;
|
||||
my @output;
|
||||
my $prevline= "";
|
||||
my $prevcount = 0;
|
||||
|
||||
foreach my $a (@input) {
|
||||
if ( $prevline eq $a) {
|
||||
++$prevcount;
|
||||
} else {
|
||||
push @output, $prevline . " " . ($prevcount + 1);
|
||||
$prevcount = 0;
|
||||
}
|
||||
$prevline = $a;
|
||||
}
|
||||
|
||||
#don't forget the last item!
|
||||
if ( $prevcount > 0 ) {
|
||||
push @output, $prevline . " " . ($prevcount + 1);
|
||||
}
|
||||
|
||||
@output;
|
||||
}
|
||||
|
||||
#======= end check_javaproc =====
|
||||
69
contrib/check_joy.sh
Executable file
69
contrib/check_joy.sh
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
#! /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$' | sed -e 's/[^0-9.]//g'`
|
||||
STATUS=""
|
||||
|
||||
. $PROGPATH/utils.sh
|
||||
|
||||
|
||||
print_usage() {
|
||||
echo "Usage: $PROGNAME /dev/js<#> <button #>"
|
||||
}
|
||||
|
||||
print_help() {
|
||||
print_revision $PROGNAME $REVISION
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "This plugin checks a joystick button status using the "
|
||||
echo "joyreadbutton utility from the joyd package."
|
||||
echo ""
|
||||
support
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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
|
||||
;;
|
||||
/dev/js*)
|
||||
joyreadbutton $1 $2 1>&1 1>/dev/null
|
||||
STATUS=$?
|
||||
if [ "$STATUS" -eq 0 ]; then
|
||||
echo OK
|
||||
exit 0
|
||||
elif [ "$STATUS" -eq 1 ];then
|
||||
echo CRITICAL
|
||||
exit 2
|
||||
else
|
||||
echo UNKNOWN
|
||||
exit -1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
88
contrib/check_linux_raid.pl
Normal file
88
contrib/check_linux_raid.pl
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Copyright (c) 2002 ISOMEDIA, Inc.
|
||||
# Written by Steve Milton
|
||||
# Released under the GNU Public License
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Usage: check_raid <raid-name>
|
||||
# Example: check_raid md0
|
||||
# WARNING md0 status=[UUU_U], recovery=46.4%, finish=123.0min
|
||||
|
||||
use strict;
|
||||
|
||||
my %ERRORS=('DEPENDENT'=>4,'UNKNOWN'=>3,'OK'=>0,'WARNING'=>1,'CRITICAL'=>2);
|
||||
|
||||
# die with an error if we're not on Linux
|
||||
if ($^O ne 'linux') {
|
||||
print "This plugin only applicable on Linux.\n";
|
||||
exit $ERRORS{'UNKNOWN'};
|
||||
}
|
||||
|
||||
open (MDSTAT, "</proc/mdstat") or die "Failed to open /proc/mdstat";
|
||||
my $found = 0;
|
||||
my $status = "";
|
||||
my $recovery = "";
|
||||
my $finish = "";
|
||||
my $active = "";
|
||||
while(<MDSTAT>) {
|
||||
if ($found) {
|
||||
if (/(\[[_U]+\])/) {
|
||||
$status = $1;
|
||||
last;
|
||||
} elsif (/recovery = (.*?)\s/) {
|
||||
$recovery = $1;
|
||||
($finish) = /finish=(.*?min)/;
|
||||
last;
|
||||
}
|
||||
} else {
|
||||
if (/^$ARGV[0]\s*:/) {
|
||||
$found = 1;
|
||||
if (/active/) {
|
||||
$active = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $msg = "FAILURE";
|
||||
my $code = "UNKNOWN";
|
||||
if ($status =~ /_/) {
|
||||
if ($recovery) {
|
||||
$msg = sprintf "%s status=%s, recovery=%s, finish=%s\n",
|
||||
$ARGV[0], $status, $recovery, $finish;
|
||||
$code = "WARNING";
|
||||
} else {
|
||||
$msg = sprintf "%s status=%s\n", $ARGV[0], $status;
|
||||
$code = "CRITICAL";
|
||||
}
|
||||
} elsif ($status =~ /U+/) {
|
||||
$msg = sprintf "%s status=%s\n", $ARGV[0], $status;
|
||||
$code = "OK";
|
||||
} else {
|
||||
if ($active) {
|
||||
$msg = sprintf "%s active with no status information.\n",
|
||||
$ARGV[0];
|
||||
$code = "OK";
|
||||
} else {
|
||||
$msg = sprintf "%s does not exist.\n", $ARGV[0];
|
||||
$code = "CRITICAL";
|
||||
}
|
||||
}
|
||||
|
||||
print $code, " ", $msg;
|
||||
exit ($ERRORS{$code});
|
||||
|
||||
19
contrib/check_lmmon.pl
Normal file
19
contrib/check_lmmon.pl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
# NetSaint Temp warning script
|
||||
# Written by: Nathan LeSueur
|
||||
|
||||
if ($#ARGV < 1) {
|
||||
print "Usage: $0 <critical temp> <warning temp> <normal temp>\n";
|
||||
exit; } $crit = shift; $warn = shift; $norm = shift; if ($warn >
|
||||
$crit) { print "Warning level cannot be greater than critical
|
||||
level!\n"; exit; } @b = qx{/usr/local/bin/lmmon -s}; foreach(@b) { @c
|
||||
= split(/ \/ /, $_); $d = $c[1]; } @e = split(/F/, $d); $f = $e[0];
|
||||
|
||||
$status = "$f degrees F\n";
|
||||
|
||||
if($f >= $crit) {print "CRITICAL - $status"; exit 2;}
|
||||
if($f >= $warn) {print "WARNING - $status"; exit 1;}
|
||||
if($f <= $norm && $f != 0) {print "OK - $status"; exit 0;}
|
||||
else{print "UNKNOWN - unable to access smb\n"; exit (-1);}
|
||||
|
||||
|
||||
202
contrib/check_log2.pl
Normal file
202
contrib/check_log2.pl
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Log file regular expression detector for Nagios.
|
||||
# Written by Aaron Bostick (abostick@mydoconline.com)
|
||||
# Last modified: 05-02-2002
|
||||
#
|
||||
# Thanks and acknowledgements to Ethan Galstad for Nagios and the check_log
|
||||
# plugin this is modeled after.
|
||||
#
|
||||
# Usage: check_log2 -l <log_file> -s <seek_file> -p <pattern> [-n <negpattern>]
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# This plugin will scan arbitrary text files looking for regular expression
|
||||
# matches. The text file to scan is specified with <log_file>.
|
||||
# <log_seek_file> is a temporary file used to store the seek byte position
|
||||
# of the last scan. This file will be created automatically on the first
|
||||
# scan. <pattern> can be any RE pattern that perl's s/// syntax accepte. Be
|
||||
# forewarned that a bad pattern will send this script into never never land!
|
||||
#
|
||||
# Output:
|
||||
#
|
||||
# This plugin returns OK when a file is successfully scanned and no pattern
|
||||
# matches are found. WARNING is returned when 1 or more patterns are found
|
||||
# along with the pattern count and the line of the last pattern matched.
|
||||
# CRITICAL is returned when an error occurs, such as file not found, etc.
|
||||
#
|
||||
# Notes (paraphrased from check_log's notes):
|
||||
#
|
||||
# 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 <log_Seek_file> 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 error notices in messages
|
||||
# check_log2 -l /var/log/messages -s ./check_log2.messages.seek -p 'err'
|
||||
#
|
||||
|
||||
|
||||
BEGIN {
|
||||
if ($0 =~ s/^(.*?)[\/\\]([^\/\\]+)$//) {
|
||||
$prog_dir = $1;
|
||||
$prog_name = $2;
|
||||
}
|
||||
}
|
||||
|
||||
require 5.004;
|
||||
|
||||
use lib $main::prog_dir;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
use Getopt::Long;
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks);
|
||||
|
||||
sub print_usage ();
|
||||
sub print_version ();
|
||||
sub print_help ();
|
||||
|
||||
# Initialize strings
|
||||
$log_file = '';
|
||||
$seek_file = '';
|
||||
$critical = '';
|
||||
$re_pattern = '';
|
||||
$neg_re_pattern = '';
|
||||
$pattern_count = 0;
|
||||
$pattern_line = '';
|
||||
$plugin_revision = '$Revision$ ';
|
||||
|
||||
# Grab options from command line
|
||||
GetOptions
|
||||
("l|logfile=s" => \$log_file,
|
||||
"s|seekfile=s" => \$seek_file,
|
||||
"c|critical" => \$critical,
|
||||
"p|pattern=s" => \$re_pattern,
|
||||
"n|negpattern:s" => \$neg_re_pattern,
|
||||
"v|version" => \$version,
|
||||
"h|help" => \$help);
|
||||
|
||||
!($version) || print_version ();
|
||||
!($help) || print_help ();
|
||||
|
||||
# Make sure log file is specified
|
||||
($log_file) || usage("Log file not specified.\n");
|
||||
# Make sure seek file is specified
|
||||
($seek_file) || usage("Seek file not specified.\n");
|
||||
# Make sure re pattern is specified
|
||||
($re_pattern) || usage("Regular expression not specified.\n");
|
||||
|
||||
# Open log file
|
||||
open (LOG_FILE, $log_file) || die "Unable to open log file $log_file: $!";
|
||||
|
||||
# Try to open log seek file. If open fails, we seek from beginning of
|
||||
# file by default.
|
||||
if (open(SEEK_FILE, $seek_file)) {
|
||||
chomp(@seek_pos = <SEEK_FILE>);
|
||||
close(SEEK_FILE);
|
||||
|
||||
# If file is empty, no need to seek...
|
||||
if ($seek_pos[0] != 0) {
|
||||
|
||||
# Compare seek position to actual file size.
|
||||
# If file size is smaller
|
||||
# then we just start from beginning i.e. file was rotated, etc.
|
||||
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat(LOG_FILE);
|
||||
|
||||
if ($seek_pos[0] <= $size) {
|
||||
seek(LOG_FILE, $seek_pos[0], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Loop through every line of log file and check for pattern matches.
|
||||
# Count the number of pattern matches and remember the full line of
|
||||
# the most recent match.
|
||||
while (<LOG_FILE>) {
|
||||
if ($neg_re_pattern) {
|
||||
if ((/$re_pattern/) && !(/$neg_re_pattern/)) {
|
||||
$pattern_count += 1;
|
||||
$pattern_line = $_;
|
||||
}
|
||||
} elsif (/$re_pattern/) {
|
||||
$pattern_count += 1;
|
||||
$pattern_line = $_;
|
||||
}
|
||||
}
|
||||
|
||||
# Overwrite log seek file and print the byte position we have seeked to.
|
||||
open(SEEK_FILE, "> $seek_file") || die "Unable to open seek count file $seek_file: $!";
|
||||
print SEEK_FILE tell(LOG_FILE);
|
||||
|
||||
# Close seek file.
|
||||
close(SEEK_FILE);
|
||||
# Close the log file.
|
||||
close(LOG_FILE);
|
||||
|
||||
# Print result and return exit code.
|
||||
if ($pattern_count) {
|
||||
if ($critical) {
|
||||
print "CRITICAL: ";
|
||||
} else {
|
||||
print "WARNING: ";
|
||||
}
|
||||
print "($pattern_count): $pattern_line";
|
||||
if ($critical) {
|
||||
exit $ERRORS{'CRITICAL'};
|
||||
} else {
|
||||
exit $ERRORS{'WARNING'};
|
||||
}
|
||||
} else {
|
||||
print "OK - No matches found.\n";
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
#
|
||||
# Subroutines
|
||||
#
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $prog_name -l <log_file> -s <log_seek_file> -p <pattern> [-n <negpattern>] -c | --critical\n";
|
||||
print "Usage: $prog_name [ -v | --version ]\n";
|
||||
print "Usage: $prog_name [ -h | --help ]\n";
|
||||
}
|
||||
|
||||
sub print_version () {
|
||||
print_revision($prog_name, $plugin_revision);
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($prog_name, $plugin_revision);
|
||||
print "\n";
|
||||
print "Scan arbitrary log files for regular expression matches.\n";
|
||||
print "\n";
|
||||
print_usage();
|
||||
print "\n";
|
||||
print "-l, --logfile=<logfile>\n";
|
||||
print " The log file to be scanned\n";
|
||||
print "-s, --seekfile=<seekfile>\n";
|
||||
print " The temporary file to store the seek position of the last scan\n";
|
||||
print "-p, --pattern=<pattern>\n";
|
||||
print " The regular expression to scan for in the log file\n";
|
||||
print "-n, --negpattern=<negpattern>\n";
|
||||
print " The regular expression to skip in the log file\n";
|
||||
print "-c, --critical\n";
|
||||
print " Return critical instead of warning on error\n";
|
||||
print "\n";
|
||||
support();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
261
contrib/check_lotus.pl
Executable file
261
contrib/check_lotus.pl
Executable file
|
|
@ -0,0 +1,261 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id$
|
||||
|
||||
# $Log$
|
||||
# Revision 1.1 2005/01/25 09:04:26 stanleyhopcroft
|
||||
# New plugin to check responsiveness of Louts Notes (v5 at least) servers
|
||||
#
|
||||
# Revision 1.10 2005-01-25 15:44:07+11 anwsmh
|
||||
# 1 use packet_utils instead of hard coding subroutines (pdump and tethereal)
|
||||
# 2 redo indentation using tabs (set at 4 spaces)
|
||||
#
|
||||
|
||||
use strict ;
|
||||
|
||||
use IO::Socket;
|
||||
use Getopt::Long ;
|
||||
|
||||
my ($timeout, $debug, $lotus_host, $server, $indiv_dn, $packet_debug) ;
|
||||
|
||||
use lib qw(/usr/local/nagios/libexec) ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage) ;
|
||||
use packet_utils qw(pdump &tethereal) ;
|
||||
|
||||
my $PROGNAME = 'check_lotus_notes' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
my $TEST_COUNT = 2 ;
|
||||
# Number of Lotus client hellos sent without reply
|
||||
my $BUFFER_SIZE = 1500 ;
|
||||
# buffer size used for 'recv' calls.
|
||||
my $LOTUS_PORT = 1352 ;
|
||||
|
||||
Getopt::Long::Configure('no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"v|debug" => \$debug,
|
||||
"vv|i_packet_debug" => \$packet_debug,
|
||||
"H|lotus_host=s"=> \$lotus_host,
|
||||
# "I|indivual_dn:s" => \$indiv_dn,
|
||||
"S|server:s" => \$server,
|
||||
"T|t_timeout:i" => \$timeout,
|
||||
) ;
|
||||
|
||||
usage("You must provide the DNS name or IP (v4) address of the Lotus server to be checked.\n")
|
||||
unless $lotus_host and (
|
||||
$lotus_host =~ m#^\d+\.\d+\.\d+\.\d+$# or
|
||||
$lotus_host =~ m#^[\w\._-]+$#
|
||||
) ;
|
||||
|
||||
$server ||= $lotus_host
|
||||
if $lotus_host =~ m#^[\w-]+$# ;
|
||||
|
||||
usage("You must provide a server option unless the lotus_host option looks like an unqualified host name.\n")
|
||||
unless $server ;
|
||||
|
||||
$timeout ||= $TIMEOUT ;
|
||||
$debug = 1
|
||||
if $packet_debug ;
|
||||
|
||||
my $server_dn = "CN=\U$server" . '(?:/\w+=[\w -]+)*' ;
|
||||
|
||||
# Definitions of query strings. Change at your own risk :)
|
||||
# This info was gathered with tcpdump while using a Lotus Notes 5 client,
|
||||
# so I'm not sure of what each value is.
|
||||
|
||||
my $lotus_client_hello = &tethereal(<<'End_of_Tethereal_trace', '82') ;
|
||||
0030 ff ff dc c5 00 00 82 00 00 00 77 00 00 00 02 00 ..........w.....
|
||||
0040 00 40 02 0f 00 07 00 39 05 9e 45 54 ad ad 03 00 .@.....9..ET....
|
||||
0050 00 00 00 02 00 2f 00 00 00 00 00 00 00 00 00 40 ...../.........@
|
||||
0060 1f a0 af 19 d8 92 da 37 78 c9 ce 60 5e 35 b8 f7 .......7x..`^5..
|
||||
0070 4e 05 00 10 00 0d 00 00 00 00 00 00 00 00 00 00 N...............
|
||||
0080 00 00 00 00 00 02 00 08 00 9c dc 22 00 7c 6f 25 ...........".|o%
|
||||
0090 4a 08 00 10 00 00 00 00 00 00 00 00 00 00 00 00 J...............
|
||||
00a0 00 00 00 00 00 04 00 10 00 ba ac 8c 49 67 ee a1 ............Ig..
|
||||
00b0 22 6f 63 bb 04 b4 75 0b 8f 00 "oc...u...
|
||||
End_of_Tethereal_trace
|
||||
|
||||
# XXXX
|
||||
# Notes 5 accepts this
|
||||
# _wrongly_ encoded DN
|
||||
# but in general the
|
||||
# server will reset
|
||||
# the connection if
|
||||
# it receives malformed
|
||||
# packets.
|
||||
|
||||
my $lotus_client_m1 = &tethereal(<<'End_of_Tethereal_trace', 'de') ;
|
||||
0000 de 00 00 00 d4 00 00 00 13 00 00 40 01 00 9e 45 ...........@...E
|
||||
0010 54 ad ad 03 00 00 00 00 02 00 29 13 23 00 b9 68 T.........).#..h
|
||||
0020 25 00 9f 87 27 00 8f f4 25 00 00 00 88 00 24 00 %...'...%.....$.
|
||||
0030 28 00 00 00 42 56 04 00 31 2e 30 00 42 43 01 00 (...BV..1.0.BC..
|
||||
0040 03 42 41 01 00 30 42 4c 02 00 76 02 4e 4e 50 00 .BA..0BL..v.NNP.
|
||||
0050 cf ee 9d 19 99 ca e0 bf 97 d3 59 a1 c5 78 16 82 ..........Y..x..
|
||||
0060 76 09 8c 2c 96 ae 5a c1 15 bd 4e e9 b7 0f a9 d4 v..,..Z...N.....
|
||||
0070 5a 03 d9 0d bc e4 7d 4f e0 f2 79 89 cf cd 23 19 Z.....}O..y...#.
|
||||
0080 40 55 98 81 98 be d9 17 8d 69 8e 09 de c8 e8 92 @U.......i......
|
||||
0090 24 86 6f 5a 09 81 1f 71 be 29 b7 47 78 8c 2e 00 $.oZ...q.).Gx...
|
||||
00a0 45 4e 04 00 95 63 00 00 4d 41 08 00 64 a1 b4 b3 EN...c..MA..d...
|
||||
00b0 a1 01 45 c2 80 00 50 55 52 53 41 46 22 00 43 4e ..E...PURSAF".CN
|
||||
00c0 3d 4d 72 20 46 6f 6f 2f 4f 55 3d 42 61 72 20 68 =Mr Foo/OU=Bar h
|
||||
00d0 6f 74 65 6c 2f 4f 3d 42 61 7a 20 4a 75 6e 63 74 otel/O=Baz Junct
|
||||
00e0 69 6f 6e ion
|
||||
End_of_Tethereal_trace
|
||||
|
||||
my $buff = '';
|
||||
|
||||
my $valid_resp_cr = sub {
|
||||
my ($resp, $dn, $err_ind_sr) = @_ ;
|
||||
if ( $resp =~ /($dn)/ ) {
|
||||
return $1
|
||||
} else {
|
||||
($$err_ind_sr) = $resp =~ m#(CN=[\w -]+(?:/\w+=[\w -]+)*)# ;
|
||||
return 0 ;
|
||||
}
|
||||
} ;
|
||||
|
||||
my @send = (
|
||||
{ Msg => 'Helo', Send => $lotus_client_hello, Ok => $valid_resp_cr },
|
||||
{ Msg => 'm1', Send => $lotus_client_m1, Ok => $valid_resp_cr },
|
||||
) ;
|
||||
|
||||
my $tcp ;
|
||||
|
||||
eval {
|
||||
|
||||
$tcp = IO::Socket::INET->new(Proto => 'tcp', PeerAddr => $lotus_host, PeerPort => $LOTUS_PORT, Timeout => $timeout)
|
||||
# Some versions (eg 1.1603) croak on a connect failure ..
|
||||
} ;
|
||||
|
||||
&outahere("Connect to $lotus_host:$LOTUS_PORT failed:", $@)
|
||||
if $@ || ! defined($tcp) ;
|
||||
|
||||
my $found = '' ;
|
||||
|
||||
foreach (@send) {
|
||||
|
||||
print STDERR "Sending Lotus client $_->{Msg} to $lotus_host.\n"
|
||||
if $debug ;
|
||||
|
||||
&pdump($_->{Send})
|
||||
if $packet_debug ;
|
||||
|
||||
eval {
|
||||
|
||||
local $SIG{"ALRM"} = sub { die 'Alarm clock restart' } ;
|
||||
|
||||
alarm($timeout) ;
|
||||
|
||||
$tcp->send($_->{Send}, 0) ||
|
||||
&outahere("Send to $lotus_host failed: $!") ;
|
||||
|
||||
defined( $tcp->recv($buff, $BUFFER_SIZE, 0 ) ) ||
|
||||
&outahere("Recv from $lotus_host failed: $!")
|
||||
|
||||
} ;
|
||||
|
||||
alarm(0) ;
|
||||
|
||||
&outahere('Unexpected exception raised by eval:', $@)
|
||||
if $@ and $@ !~ /Alarm clock restart/ ;
|
||||
|
||||
&outahere("Timeout after $timeout secs - no response from $lotus_host")
|
||||
if $@ and $@ =~ /Alarm clock restart/ ;
|
||||
|
||||
&outahere("Lotus server $lotus_host reset connection - client protocol (malformed packet sent) error", $@)
|
||||
if $@ and $@ =~ /reset/ ;
|
||||
|
||||
&outahere("Empty recv buff after sending client $_->{Msg} and waiting $timeout secs. NB _no_ timeout exception.")
|
||||
unless $buff ;
|
||||
|
||||
&pdump($buff)
|
||||
if $packet_debug ;
|
||||
|
||||
my $err = '' ;
|
||||
|
||||
&outahere(qq(Response from $lotus_host failed to match CN=$server/.. got "$err") )
|
||||
unless $found = $_->{Ok}->($buff, $server_dn, \$err) ;
|
||||
|
||||
print STDERR "Received Ok reply from $lotus_host - found DN $found in response.\n"
|
||||
if $debug ;
|
||||
|
||||
}
|
||||
|
||||
close $tcp;
|
||||
|
||||
print "Ok. Lotus server $lotus_host responded with $found after ", scalar @send, " packet dialogue.\n" ;
|
||||
exit $ERRORS{OK} ;
|
||||
|
||||
=begin comment
|
||||
|
||||
Normal response from Lotus Notes 5 server
|
||||
|
||||
0000 74 00 00 00 69 00 00 00 03 00 00 40 02 0f 00 05 t...i......@....
|
||||
0010 00 3d 05 60 f0 3a 38 03 03 00 00 00 00 02 00 2f .=.`.:8......../
|
||||
0020 00 26 00 00 00 00 00 00 00 40 1f 3d 73 76 0e 57 .&.......@.=sv.W
|
||||
0030 e0 d7 67 cd a3 50 10 e0 99 24 b4 43 4e 3d 43 42 ..g..P...$.CN=CB
|
||||
0040 52 4e 4f 54 45 53 30 31 2f 4f 55 3d 53 45 52 56 RNOTES01/OU=SERV
|
||||
0050 45 52 53 2f 4f 3d 49 50 41 75 73 74 72 61 6c 69 ERS/O=IPAustrali
|
||||
0060 61 05 00 10 00 09 00 00 00 00 00 00 00 00 00 00 a...............
|
||||
0070 00 00 00 00 00 00
|
||||
|
||||
=end comment
|
||||
|
||||
=cut
|
||||
|
||||
sub outahere {
|
||||
print "Failed. @_.\n" ;
|
||||
exit $ERRORS{CRITICAL} ;
|
||||
}
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <lotus_host (name _or_ address)>..) [-S <lotus_server name> -T <timeout> -v ]\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
print "Copyright (c) 2004 Ed Rolison/S Hopcroft
|
||||
|
||||
Perl Check Lotus Notes plugin for Nagios.
|
||||
|
||||
Returns OK if the named server responds with its name.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-H, --lotus_host:STRING
|
||||
Name or IP Address of Lotus server to be checked.
|
||||
-I, --individual_dn:NOT IMPLEMENTED
|
||||
String of form CN=\w+(?:/OU=\w+)?/O=\w+
|
||||
-S, --server:STRING
|
||||
Alpha numeric string specifying the Lotus server name (the CN by which the server is known by
|
||||
in the Domino directory). Defaults to host name if the host name does not look like an IP address.
|
||||
-T, --packet-timeout:INTEGER
|
||||
Time to wait for TCP dialogue to complete = send + rcv times (default Nagios timeout [$TIMEOUT sec]).
|
||||
-v, --debug
|
||||
Debugging output.
|
||||
-vv, --packet_debug
|
||||
Packet dump. Please post to Nag users in the event of trouble with this plugin.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
231
contrib/check_maxchannels.pl
Normal file
231
contrib/check_maxchannels.pl
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_maxchannels.pl - nagios plugin
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 15;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
# free channels
|
||||
my $snmpWanAvailableChannels = '1.3.6.1.4.1.529.4.23.0';
|
||||
# maximum channels
|
||||
my $snmpWanSwitchedChannels = '1.3.6.1.4.1.529.4.24.0';
|
||||
my $snmpWanDisabledChannels = '1.3.6.1.4.1.529.4.25.0';
|
||||
my $snmpWanActiveChannels = '1.3.6.1.4.1.529.4.26.0';
|
||||
my $snmpWanNailedChannels = '1.3.6.1.4.1.529.4.27.0';
|
||||
my $snmpWanOutOfServiceChannels = '1.3.6.1.4.1.529.4.28.0';
|
||||
my $snmpEventCurrentActiveSessions = '1.3.6.1.4.1.529.10.6.0';
|
||||
# since startup
|
||||
my $snmpEventTotalNoModems = '1.3.6.1.4.1.529.10.15.0';
|
||||
# lan modem
|
||||
my $snmpDeadLanModem = '1.3.6.1.4.1.529.15.7.0';
|
||||
my $snmpDisabledLanModem = '1.3.6.1.4.1.529.15.5.0';
|
||||
my $snmpSuspectLanModem = '1.3.6.1.4.1.529.15.3.0';
|
||||
my $snmpAvailLanModem = '1.3.6.1.4.1.529.15.1.0';
|
||||
my $snmpBusyLanModem = '1.3.6.1.4.1.529.15.9.0';
|
||||
# max modems
|
||||
my $snmpMdmNumber = '1.3.6.1.2.1.38.1.1.0';
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %wanStatus;
|
||||
|
||||
|
||||
my $WanAvailableChannels;
|
||||
my $WanSwitchedChannels;
|
||||
my $WanDisabledChannels;
|
||||
my $WanActiveChannels;
|
||||
my $WanNailedChannels;
|
||||
my $WanOutOfServiceChannels;
|
||||
my $EventCurrentActiveSessions;
|
||||
my $EventTotalNoModems;
|
||||
my $DeadLanModem;
|
||||
my $DisabledLanModem;
|
||||
my $SuspectLanModem;
|
||||
my $AvailLanModem;
|
||||
my $BusyLanModem;
|
||||
my $MdmNumber;
|
||||
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check maxchannels plugin for Nagios\n";
|
||||
printf "monitors ISDN lines and modems on Ascend MAX 2000/4000/6000/TNT\n";
|
||||
printf "usage: \n";
|
||||
printf "check_maxchannel.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>\n";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_maxchannels.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"};
|
||||
}
|
||||
|
||||
# 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);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
|
||||
push(@snmpoids,$snmpWanAvailableChannels);
|
||||
push(@snmpoids,$snmpWanSwitchedChannels);
|
||||
push(@snmpoids,$snmpWanDisabledChannels);
|
||||
push(@snmpoids,$snmpWanActiveChannels);
|
||||
push(@snmpoids,$snmpWanNailedChannels);
|
||||
push(@snmpoids,$snmpWanOutOfServiceChannels);
|
||||
|
||||
push(@snmpoids,$snmpEventCurrentActiveSessions);
|
||||
|
||||
push(@snmpoids,$snmpEventTotalNoModems);
|
||||
push(@snmpoids,$snmpDeadLanModem);
|
||||
push(@snmpoids,$snmpDisabledLanModem);
|
||||
push(@snmpoids,$snmpSuspectLanModem);
|
||||
push(@snmpoids,$snmpAvailLanModem);
|
||||
push(@snmpoids,$snmpBusyLanModem);
|
||||
push(@snmpoids,$snmpMdmNumber);
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_request(@snmpoids))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
|
||||
$WanAvailableChannels = $response->{$snmpWanAvailableChannels};
|
||||
$WanSwitchedChannels = $response->{$snmpWanSwitchedChannels};
|
||||
$WanDisabledChannels = $response->{$snmpWanDisabledChannels};
|
||||
$WanActiveChannels = $response->{$snmpWanActiveChannels};
|
||||
$WanNailedChannels = $response->{$snmpWanNailedChannels};
|
||||
$WanOutOfServiceChannels = $response->{$snmpWanOutOfServiceChannels};
|
||||
$EventCurrentActiveSessions = $response->{$snmpEventCurrentActiveSessions};
|
||||
$EventTotalNoModems = $response->{$snmpEventTotalNoModems};
|
||||
$DeadLanModem = $response->{$snmpDeadLanModem};
|
||||
$DisabledLanModem = $response->{$snmpDisabledLanModem};
|
||||
$SuspectLanModem = $response->{$snmpSuspectLanModem};
|
||||
$AvailLanModem = $response->{$snmpAvailLanModem};
|
||||
$BusyLanModem = $response->{$snmpBusyLanModem};
|
||||
$MdmNumber = $response->{$snmpMdmNumber};
|
||||
|
||||
# less than 50% -> WARNING
|
||||
if ( 0 < $WanOutOfServiceChannels
|
||||
&& $WanOutOfServiceChannels < ($snmpWanSwitchedChannels * 0.5) ) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
elsif ($WanOutOfServiceChannels > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
elsif ($DeadLanModem > 0) {
|
||||
$state = 'CRITICAL';
|
||||
}
|
||||
elsif ($SuspectLanModem > 0) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
elsif ($AvailLanModem == 0) {
|
||||
$state = 'WARNING';
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
}
|
||||
|
||||
|
||||
$answer = sprintf("active sessions: %d (%d), active modems: %d (%d)<BR>",
|
||||
$EventCurrentActiveSessions,
|
||||
$WanSwitchedChannels,
|
||||
$BusyLanModem,
|
||||
$MdmNumber);
|
||||
|
||||
$answer .= sprintf("channels available: %d, disabled: %d",
|
||||
$WanAvailableChannels,
|
||||
$WanDisabledChannels);
|
||||
|
||||
$answer .= sprintf(", out of service: %d, nailed: %d<BR>",
|
||||
$WanOutOfServiceChannels,
|
||||
$WanNailedChannels);
|
||||
|
||||
$answer .= sprintf("modems avail.: %d, disabled: %d, suspect: %d, dead: %d<BR>",
|
||||
$AvailLanModem,
|
||||
$DisabledLanModem,
|
||||
$SuspectLanModem,
|
||||
$DeadLanModem);
|
||||
|
||||
$answer .= sprintf("unserviced modem calls: %d (since startup)\n",
|
||||
$EventTotalNoModems);
|
||||
|
||||
$session->close;
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
||||
201
contrib/check_maxwanstate.pl
Normal file
201
contrib/check_maxwanstate.pl
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# check_maxwanstate.pl - nagios plugin
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000 Christoph Kron
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# 11.01.2000 Version 1.0
|
||||
|
||||
use strict;
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
|
||||
my $status;
|
||||
my $TIMEOUT = 1500;
|
||||
|
||||
my %ERRORS = ('UNKNOWN' , '-1',
|
||||
'OK' , '0',
|
||||
'WARNING', '1',
|
||||
'CRITICAL', '2');
|
||||
|
||||
my %wanLineState = (
|
||||
1,'ls-unknown',
|
||||
2,'ls-does-not-exist',
|
||||
3,'ls-disabled',
|
||||
4,'ls-no-physical',
|
||||
5,'ls-no-logical',
|
||||
6,'ls-point-to-point',
|
||||
7,'ls-multipoint-1',
|
||||
8,'ls-multipoint-2',
|
||||
9,'ls-loss-of-sync',
|
||||
10,'ls-yellow-alarm',
|
||||
11,'ls-ais-receive',
|
||||
12,'ls-no-d-channel',
|
||||
13,'ls-active',
|
||||
14,'ls-maintenance');
|
||||
|
||||
my %wanLineType = (
|
||||
'1.3.6.1.4.1.529.4.1','Any',
|
||||
'1.3.6.1.4.1.529.4.2','T1',
|
||||
'1.3.6.1.4.1.529.4.3','E1',
|
||||
'1.3.6.1.4.1.529.4.4','Dpnss',
|
||||
'1.3.6.1.4.1.529.4.5','Bri',
|
||||
'1.3.6.1.4.1.529.4.6','S562',
|
||||
'1.3.6.1.4.1.529.4.7','S564',
|
||||
'1.3.6.1.4.1.529.4.8','Sdsl',
|
||||
'1.3.6.1.4.1.529.4.9','AdslCap');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
my $answer = "";
|
||||
my $snmpkey;
|
||||
my $snmpoid;
|
||||
my $key;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my @snmpoids;
|
||||
my $snmpWanLineName = '1.3.6.1.4.1.529.4.21.1.2';
|
||||
my $snmpWanLineType = '1.3.6.1.4.1.529.4.21.1.3';
|
||||
my $snmpWanLineState = '1.3.6.1.4.1.529.4.21.1.5';
|
||||
my $snmpWanLineUsage = '1.3.6.1.4.1.529.4.21.1.8';
|
||||
|
||||
my $hostname;
|
||||
my $session;
|
||||
my $error;
|
||||
my $response;
|
||||
my %wanStatus;
|
||||
my $ifup =0 ;
|
||||
my $ifdown =0;
|
||||
my $ifdormant = 0;
|
||||
my $ifmessage;
|
||||
|
||||
sub usage {
|
||||
printf "\nMissing arguments!\n";
|
||||
printf "\n";
|
||||
printf "Perl Check maxwanstate plugin for Nagios\n";
|
||||
printf "monitors E1/T1 interface status\n";
|
||||
printf "usage: \n";
|
||||
printf "check_maxwanstate.pl -c <READCOMMUNITY> -p <PORT> <HOSTNAME>";
|
||||
printf "Copyright (C) 2000 Christoph Kron\n";
|
||||
printf "check_maxwanstate.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"};
|
||||
}
|
||||
|
||||
# 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);
|
||||
|
||||
|
||||
$status = GetOptions("community=s",\$community,
|
||||
"port=i",\$port);
|
||||
if ($status == 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
|
||||
#shift;
|
||||
$hostname = shift || &usage;
|
||||
|
||||
|
||||
|
||||
push(@snmpoids,$snmpWanLineUsage);
|
||||
push(@snmpoids,$snmpWanLineState);
|
||||
push(@snmpoids,$snmpWanLineName);
|
||||
push(@snmpoids,$snmpWanLineType);
|
||||
|
||||
foreach $snmpoid (@snmpoids) {
|
||||
|
||||
($session, $error) = Net::SNMP->session(
|
||||
-hostname => $hostname,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined($session)) {
|
||||
$state='UNKNOWN';
|
||||
$answer=$error;
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
if (!defined($response = $session->get_table($snmpoid))) {
|
||||
$answer=$session->error;
|
||||
$session->close;
|
||||
$state = 'CRITICAL';
|
||||
print ("$state: $answer,$community,$snmpkey");
|
||||
exit $ERRORS{$state};
|
||||
}
|
||||
|
||||
foreach $snmpkey (keys %{$response}) {
|
||||
$snmpkey =~ /.*\.(\d+)$/;
|
||||
$key = $1;
|
||||
$wanStatus{$key}{$snmpoid} = $response->{$snmpkey};
|
||||
}
|
||||
$session->close;
|
||||
}
|
||||
|
||||
foreach $key (keys %wanStatus) {
|
||||
# look only at active Interfaces lu-trunk(5)
|
||||
if ($wanStatus{$key}{$snmpWanLineUsage} == 5 ) {
|
||||
|
||||
# 13 -> active
|
||||
if ($wanStatus{$key}{$snmpWanLineState} == 13 ) {
|
||||
$ifup++;
|
||||
}
|
||||
else {
|
||||
$ifdown++ ;
|
||||
$ifmessage .= sprintf("%s interface status : %s (%s)<BR>",
|
||||
$wanLineType{$wanStatus{$key}{$snmpWanLineType}},
|
||||
$wanLineState{$wanStatus{$key}{$snmpWanLineState}},
|
||||
$wanStatus{$key}{$snmpWanLineName});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($ifdown > 0) {
|
||||
$state = 'CRITICAL';
|
||||
$answer = sprintf("host '%s', interfaces up: %d, down: %d<BR>",
|
||||
$hostname,
|
||||
$ifup,
|
||||
$ifdown);
|
||||
$answer = $answer . $ifmessage . "\n";
|
||||
}
|
||||
else {
|
||||
$state = 'OK';
|
||||
$answer = sprintf("host '%s', interfaces up: %d, down: %d\n",
|
||||
$hostname,
|
||||
$ifup,
|
||||
$ifdown);
|
||||
}
|
||||
|
||||
print ("$state: $answer");
|
||||
exit $ERRORS{$state};
|
||||
|
||||
146
contrib/check_mem.pl
Normal file
146
contrib/check_mem.pl
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#!/usr/bin/perl -w
|
||||
# $Id$
|
||||
|
||||
# check_mem.pl Copyright (C) 2000 Dan Larsson <dl@tyfon.net>
|
||||
#
|
||||
# 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
|
||||
|
||||
# Tell Perl what we need to use
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
|
||||
use vars qw($opt_c $opt_f $opt_u $opt_w
|
||||
$free_memory $used_memory $total_memory
|
||||
$crit_level $warn_level
|
||||
%exit_codes @memlist
|
||||
$percent $fmt_pct
|
||||
$verb_err $command_line);
|
||||
|
||||
# Predefined exit codes for Nagios
|
||||
%exit_codes = ('UNKNOWN' ,-1,
|
||||
'OK' , 0,
|
||||
'WARNING' , 1,
|
||||
'CRITICAL', 2,);
|
||||
|
||||
# Turn this to 1 to see reason for parameter errors (if any)
|
||||
$verb_err = 0;
|
||||
|
||||
# This the unix command string that brings Perl the data
|
||||
$command_line = `vmstat | tail -1 | awk '{print \$4,\$5}'`;
|
||||
|
||||
chomp $command_line;
|
||||
@memlist = split(/ /, $command_line);
|
||||
|
||||
# Define the calculating scalars
|
||||
$used_memory = $memlist[0];
|
||||
$free_memory = $memlist[1];
|
||||
$total_memory = $used_memory + $free_memory;
|
||||
|
||||
# Get the options
|
||||
if ($#ARGV le 0)
|
||||
{
|
||||
&usage;
|
||||
}
|
||||
else
|
||||
{
|
||||
getopts('c:fuw:');
|
||||
}
|
||||
|
||||
# Shortcircuit the switches
|
||||
if (!$opt_w or $opt_w == 0 or !$opt_c or $opt_c == 0)
|
||||
{
|
||||
print "*** You must define WARN and CRITICAL levels!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
elsif (!$opt_f and !$opt_u)
|
||||
{
|
||||
print "*** You must select to monitor either USED or FREE memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
|
||||
# Check if levels are sane
|
||||
if ($opt_w <= $opt_c and $opt_f)
|
||||
{
|
||||
print "*** WARN level must not be less than CRITICAL when checking FREE memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
elsif ($opt_w >= $opt_c and $opt_u)
|
||||
{
|
||||
print "*** WARN level must not be greater than CRITICAL when checking USED memory!" if ($verb_err);
|
||||
&usage;
|
||||
}
|
||||
|
||||
$warn_level = $opt_w;
|
||||
$crit_level = $opt_c;
|
||||
|
||||
if ($opt_f)
|
||||
{
|
||||
$percent = $free_memory / $total_memory * 100;
|
||||
$fmt_pct = sprintf "%.1f", $percent;
|
||||
if ($percent <= $crit_level)
|
||||
{
|
||||
print "Memory CRITICAL - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
}
|
||||
elsif ($percent <= $warn_level)
|
||||
{
|
||||
print "Memory WARNING - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'WARNING'};
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Memory OK - $fmt_pct% ($free_memory kB) free\n";
|
||||
exit $exit_codes{'OK'};
|
||||
}
|
||||
}
|
||||
elsif ($opt_u)
|
||||
{
|
||||
$percent = $used_memory / $total_memory * 100;
|
||||
$fmt_pct = sprintf "%.1f", $percent;
|
||||
if ($percent >= $crit_level)
|
||||
{
|
||||
print "Memory CRITICAL - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'CRITICAL'};
|
||||
}
|
||||
elsif ($percent >= $warn_level)
|
||||
{
|
||||
print "Memory WARNING - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'WARNING'};
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Memory OK - $fmt_pct% ($used_memory kB) used\n";
|
||||
exit $exit_codes{'OK'};
|
||||
}
|
||||
}
|
||||
|
||||
# Show usage
|
||||
sub usage()
|
||||
{
|
||||
print "\ncheck_mem.pl v1.0 - Nagios Plugin\n\n";
|
||||
print "usage:\n";
|
||||
print " check_mem.pl -<f|u> -w <warnlevel> -c <critlevel>\n\n";
|
||||
print "options:\n";
|
||||
print " -f Check FREE memory\n";
|
||||
print " -u Check USED memory\n";
|
||||
print " -w PERCENT Percent free/used when to warn\n";
|
||||
print " -c PERCENT Percent free/used when critical\n";
|
||||
print "\nCopyright (C) 2000 Dan Larsson <dl\@tyfon.net>\n";
|
||||
print "check_mem.pl comes with absolutely NO WARRANTY either implied or explicit\n";
|
||||
print "This program is licensed under the terms of the\n";
|
||||
print "GNU General Public License (check source code for details)\n";
|
||||
exit $exit_codes{'UNKNOWN'};
|
||||
}
|
||||
325
contrib/check_ms_spooler.pl
Executable file
325
contrib/check_ms_spooler.pl
Executable file
|
|
@ -0,0 +1,325 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# $Id$
|
||||
|
||||
# $Log$
|
||||
# Revision 1.1 2002/07/16 00:04:42 stanleyhopcroft
|
||||
# Primitive and in need of refinement test of MS spooler (with smbclient)
|
||||
#
|
||||
# Revision 2.5 2002-02-13 07:36:08+11 anwsmh
|
||||
# Correct 'apostrophe' disaster.
|
||||
# Apostrophes in plugin output cause Netsaint notification commands
|
||||
# ( sh echo 'yada $PLUGINOUTPUT$ ..') to fail, usually mysteriously
|
||||
# eg notify OK works but notify CRITICAL does not.
|
||||
# Replace '$var' in print "output" with \"$var\".
|
||||
#
|
||||
# Revision 2.4 2001-11-21 21:36:05+11 anwsmh
|
||||
# Minor corrections
|
||||
# . replace 'die' by print .. exit $ERRORS{CRITICAL}
|
||||
# . change concluding message to list the queues (sorted) if there are no enqueued docs.
|
||||
#
|
||||
# Revision 2.3 2001-11-20 11:00:58+11 anwsmh
|
||||
# Major corrections.
|
||||
# 1. to sub AUTOLOAD: coderef parms must be @_ (ie the parm when the new sub is called)
|
||||
# 2. to processing of queue report (no inspection of $last_line; entire $queue_report is
|
||||
# checked for errors)
|
||||
# 3. cosmetic and debug changes in many places.
|
||||
#
|
||||
# Revision 2.2 2001-11-17 23:30:34+11 anwsmh
|
||||
# After adapting two different queue reports resulting from
|
||||
# different name resolution methods.
|
||||
#
|
||||
# Revision 2.1 2001-11-17 13:21:54+11 anwsmh
|
||||
# Adapt to Netsaint ('use utils, Getopt::Long, and standard switch processing).
|
||||
# Fix many peculiarities.
|
||||
#
|
||||
|
||||
|
||||
use strict ;
|
||||
|
||||
use Getopt::Long ;
|
||||
use utils ;
|
||||
|
||||
use vars qw($opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $debug);
|
||||
use vars '$AUTOLOAD' ;
|
||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
|
||||
|
||||
my $PROGNAME = 'check_ms_spooler' ;
|
||||
|
||||
sub print_help ();
|
||||
sub print_usage ();
|
||||
sub help ();
|
||||
sub version ();
|
||||
|
||||
delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
|
||||
|
||||
use constant SMBCLIENT_PATH => '/usr/local/samba/bin/smbclient' ;
|
||||
use constant MAX_QUEUES_TO_CHECK => 20 ; # So that the check doesn't take longer than $TIMEOUT
|
||||
|
||||
use constant SMBCLIENT_SVC => sub { return `${\SMBCLIENT_PATH} -L //$_[0] -U $_[1]%$_[2]` } ;
|
||||
use constant SMBCLIENT_QUEUE => sub { return `${\SMBCLIENT_PATH} //$_[0]/$_[1] -U $_[2]%$_[3] -c 'queue; quit' 2>/dev/null` } ;
|
||||
|
||||
# The queue results depend on the name resolution method.
|
||||
|
||||
# Forcing 'wins' or 'bcat' name resolution makes the queue results the
|
||||
# same for all spoolers (those that are resolved with WINS have an extra line
|
||||
# 'Got a positive name query response from <ip address of WINS> ..)
|
||||
# but would fail if there is no WINS and when miscreant spoolers
|
||||
# don't respond to broadcasts.
|
||||
|
||||
use constant MIN => sub { my $min = $_[0] ; foreach (@_) { $min = $_ if $_ <= $min; } return $min ; } ;
|
||||
|
||||
$SIG{"ALRM"} = sub { die "Alarm clock restart" } ;
|
||||
|
||||
Getopt::Long::Configure('bundling', 'no_ignore_case');
|
||||
GetOptions
|
||||
("V|version" => \&version,
|
||||
"h|help" => \&help,
|
||||
"d|debug" => \$debug,
|
||||
"p|password=s" => \$opt_p,
|
||||
"u|username=s" => \$opt_u,
|
||||
"H|hostname=s" => \$opt_H);
|
||||
|
||||
|
||||
|
||||
($opt_H) || usage("MS Spooler name not specified\n");
|
||||
my $spooler = $1 if $opt_H =~ m#(\w+)# ; # MS host names allow __any__ characters (more than \w)
|
||||
($spooler) || usage("Invalid MS spooler name: $opt_H\n");
|
||||
|
||||
($opt_u) || ($opt_u = 'guest');
|
||||
my $user = $1 if $opt_u =~ m#(\w+)# ;
|
||||
($user) || usage("Invalid user: $opt_u\n");
|
||||
|
||||
($opt_p) || ($opt_p = 'guest');
|
||||
my $pass = $1 if ($opt_p =~ /(.*)/);
|
||||
($pass) || usage("Invalid password: $opt_p\n");
|
||||
|
||||
my ($printer, $queue, @queues, $ms_spooler_status, @results, %junk) ;
|
||||
my (@fault_messages, @queue_contents, @services, @prandom_queue_indices) ;
|
||||
my ($queue_contents, $number_of_queues, $state, $queue_report) ;
|
||||
|
||||
$state = "getting service list (${\SMBCLIENT_PATH} -L $spooler -U $user%$pass) from spooler\n" ;
|
||||
|
||||
eval {
|
||||
alarm($TIMEOUT) ;
|
||||
@services = SMBCLIENT_SVC->( $spooler, $user, $pass ) ;
|
||||
} ;
|
||||
alarm(0) ;
|
||||
|
||||
if ($@ and $@ !~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME failed $state. Got \"$@\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
if ($@ and $@ =~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME timed out $state. Got \"@services\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
# tsitc> /usr/local/samba/bin/smbclient //ipaprint1/tt03 -U blah%blah -P -c 'queue; quit'
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Connection to ipaprint1 failed
|
||||
|
||||
# tsitc> /usr/local/samba/bin/smbclient -L sna_spl1 -U blah%blah | & more
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Got a positive name query response from 10.0.100.29 ( 10.0.6.20 )
|
||||
# session setup failed: ERRDOS - ERRnoaccess (Access denied.)
|
||||
|
||||
if ( grep /Connection to $spooler failed|ERR/, @services ) {
|
||||
print "Failed. $PROGNAME failed $state. Got \"@services\"\n" ;
|
||||
# print "Failed. Request for services list to $spooler failed. Got \"@services\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
# tsitc# /usr/local/samba/bin/smbclient -L ipaprint -U blah%blah
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
#
|
||||
# Sharename Type Comment
|
||||
# --------- ---- -------
|
||||
# TH02 Printer TH02
|
||||
# ADMIN$ Disk Remote Admin
|
||||
# IPC$ IPC Remote IPC
|
||||
# S431 Printer S431
|
||||
# S402 Printer S402
|
||||
# S401 Printer S401
|
||||
# C$ Disk Default share
|
||||
# BW01 Printer BW01
|
||||
# BW02 Printer BW02
|
||||
# TL11 Printer TL11
|
||||
# TL07 Printer TL07
|
||||
# S225 Printer Discovery South - 2nd Floor - HP CLJ4500
|
||||
# S224 Printer S224
|
||||
# S223 Printer Discovery South 2nd Floor Trademarks Training
|
||||
# S222 Printer S222
|
||||
# S203 Printer S203
|
||||
# S202 Printer S202
|
||||
|
||||
my @printers = map { my @junk = split; $junk[0] }
|
||||
grep { my @junk = split; defined $junk[1] and $junk[1] eq 'Printer' } @services ;
|
||||
# don't check IPC$, ADMIN$ etc.
|
||||
|
||||
$ms_spooler_status = 0 ;
|
||||
$number_of_queues = MIN->(MAX_QUEUES_TO_CHECK, (scalar(@services) >> 3) + 1) ;
|
||||
|
||||
$state = "checking queues on $spooler" ;
|
||||
|
||||
eval {
|
||||
# foreach queues to check
|
||||
# generate a pseudo-random int in 0 .. $#printers
|
||||
# drop it if the index has already been generated ;
|
||||
|
||||
%junk = () ;
|
||||
@prandom_queue_indices = grep { ! $junk{$_}++ }
|
||||
map { int( rand($#printers) ) } ( 1 .. $number_of_queues ) ;
|
||||
|
||||
@queues = @printers[@prandom_queue_indices] ;
|
||||
|
||||
# @queues = @printers[ map { int( rand($#printers) ) } ( 1 .. $number_of_queues ) ] ;
|
||||
|
||||
alarm($TIMEOUT) ;
|
||||
|
||||
@queue_contents = @fault_messages = () ;
|
||||
|
||||
foreach $printer (sort @queues) {
|
||||
|
||||
# Expect 3 lines from a queue report.
|
||||
# If queue is empty, last line is null otherwise
|
||||
# it will contain a queue report or an SMB error
|
||||
|
||||
# Empty Queue.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
|
||||
# Queue command from a spooler with a DNS name.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
# 65 16307 Microsoft Word - Servicesweoffer2.doc
|
||||
# 68 10410 Microsoft Word - Servicesweoffer.doc
|
||||
# 143 24997 Microsoft Word - Miss Samantha Anne Craig.doc
|
||||
# 182 15635 Microsoft Word - services we provide.doc
|
||||
|
||||
# Error.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Domain=[IPAUSTRALIA] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
# tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)
|
||||
|
||||
# Can't connect error.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Connection to sna_spl2 failed
|
||||
|
||||
|
||||
# Empty Queue from a spooler with no DNS name, NetBIOS name resolved by WINS.
|
||||
# Added interface ip=10.0.100.252 bcast=10.255.255.255 nmask=255.0.0.0
|
||||
# Got a positive name query response from 10.0.100.29 ( 10.0.6.20 )
|
||||
# Domain=[SNA_PRINT] OS=[Windows NT 4.0] Server=[NT LAN Manager 4.0]
|
||||
|
||||
# There are 3 lines of output from smbclient for those spoolers whose names are
|
||||
# resolved by WINS (because those names are NetBIOS and therefore not in DNS);
|
||||
# 4 lines for errors or enqueued jobs
|
||||
|
||||
print STDERR "${\SMBCLIENT_PATH} //$spooler/$printer -U $user%$pass -c 'queue; quit' ==>\n" if $debug ;
|
||||
|
||||
@results = SMBCLIENT_QUEUE->( $spooler, $printer, $user, $pass ) ;
|
||||
|
||||
print STDERR "\"@results\"\n" if $debug ;
|
||||
|
||||
# set $ms_spooler_status somehow
|
||||
|
||||
chomp( @results ) ;
|
||||
$queue_report = queue_report->(@results) ;
|
||||
print STDERR '$queue_report for $printer ', "$printer: \"$queue_report\"\n\n" if $debug ;
|
||||
|
||||
if ( defined $queue_report and ($queue_report !~ /ERR/ && $queue_report !~ /failed/) ) {
|
||||
$ms_spooler_status = 1 ;
|
||||
push @queue_contents, "$printer: $queue_report" if $queue_report ;
|
||||
} else {
|
||||
push @fault_messages, "$printer: $queue_report" ;
|
||||
}
|
||||
}
|
||||
alarm(0) ;
|
||||
} ;
|
||||
|
||||
if ($@ and $@ !~ /Alarm clock restart/) {
|
||||
print "Failed. $PROGNAME failed at $state. Got \"$@\"\n" ;
|
||||
exit $ERRORS{"CRITCAL"} ;
|
||||
}
|
||||
|
||||
if ($@ and $@ =~ /Alarm clock restart/) {
|
||||
my $i ;
|
||||
foreach (@queues) { $i++ ; last if $_ eq $printer }
|
||||
print "Failed. Timed out connecting to $printer ($i of $number_of_queues) on //$spooler after $TIMEOUT secs. Got \"@fault_messages\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
if (! $ms_spooler_status) {
|
||||
print "Failed. Couldn't connect to @queues on //$spooler as user $user. Got \"@fault_messages\"\n" ;
|
||||
exit $ERRORS{"CRITICAL"} ;
|
||||
}
|
||||
|
||||
$queue_contents = ( @queue_contents != 0 ? join(" ", (@queue_contents == 1 ? "Queue" : "Queues"), @queue_contents) :
|
||||
"All Queues empty" ) ;
|
||||
|
||||
print "Ok. Connected to ", $queue_contents =~ /empty$/ ? "@{[sort @queues]}" : scalar @queues, " queues on //$spooler. $queue_contents\n" ;
|
||||
exit $ERRORS{"OK"} ;
|
||||
|
||||
sub print_usage () {
|
||||
print "Usage: $PROGNAME -H <spooler> -u <user> -p <password>\n";
|
||||
}
|
||||
|
||||
sub print_help () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
print "Copyright (c) 2001 Karl DeBisschop/S Hopcroft
|
||||
|
||||
Perl Check MS Spooler plugin for NetSaint. Display a subset of the queues on an SMB (Samba or MS) print spooler.
|
||||
|
||||
";
|
||||
print_usage();
|
||||
print '
|
||||
-H, --hostname=STRING
|
||||
NetBIOS name of the SMB Print spooler (Either Samba or MS spooler)
|
||||
-u, --user=STRING
|
||||
Username to log in to server. (Default: "guest")
|
||||
-p, --password=STRING
|
||||
Password to log in to server. (Default: "guest")
|
||||
-d, --debug
|
||||
Debugging output.
|
||||
-h, --help
|
||||
This stuff.
|
||||
|
||||
';
|
||||
support();
|
||||
}
|
||||
|
||||
sub version () {
|
||||
print_revision($PROGNAME,'$Revision$ ');
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub help () {
|
||||
print_help();
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
sub AUTOLOAD {
|
||||
|
||||
my @queue_rep = @_ ;
|
||||
|
||||
# 'Object Oriented Perl', D Conway, p 95
|
||||
|
||||
no strict 'refs' ;
|
||||
|
||||
if ( $AUTOLOAD =~ /.*::queue_report/ ) {
|
||||
|
||||
if ( grep /Got a positive name query response from/, @queue_rep ){
|
||||
*{$AUTOLOAD} = sub { return join ' ', splice(@_, 3) } ;
|
||||
return join '', splice(@queue_rep, 3) ;
|
||||
} else {
|
||||
*{$AUTOLOAD} = sub { return join ' ',splice(@_, 2) } ;
|
||||
return join '', splice(@queue_rep, 2) ;
|
||||
}
|
||||
} else {
|
||||
die "No such subroutine: $AUTOLOAD" ;
|
||||
}
|
||||
}
|
||||
|
||||
104
contrib/check_mssql.sh
Executable file
104
contrib/check_mssql.sh
Executable file
|
|
@ -0,0 +1,104 @@
|
|||
#!/bin/sh
|
||||
# This script is designed to be used by Nagios. It checks for the availability of both Microsoft SQL Server 7 and 2000.
|
||||
#
|
||||
# Requirements:
|
||||
#
|
||||
# FreeTDS 6.0+ (http://www.freetds.org/)
|
||||
#
|
||||
# It was written by Tom De Blende (tom.deblende@village.uunet.be) in 2003.
|
||||
#
|
||||
# Version 1.0.
|
||||
# Version 1.1: Rewritten the initial script so that it not only works from the CLI but also from within Nagios. Always helpful...
|
||||
# Version 1.2: Grouped output so things look a bit better.
|
||||
# Version 2.0: Rewritten the plugin to support version 6.0+ of FreeTDS.
|
||||
# Removed sqsh requirement as version 6.0+ of FreeTDS now offers its own CLI client: tsql.
|
||||
# Older versions of FreeTDS are no longer supported.
|
||||
#
|
||||
#
|
||||
# You might want to change these values:
|
||||
|
||||
tsqlcmd=`which tsql`
|
||||
catcmd=`which cat`
|
||||
grepcmd=`which grep`
|
||||
rmcmd=`which rm`
|
||||
mktempcmd=`which mktemp`
|
||||
wccmd=`which wc`
|
||||
sedcmd=`which sed`
|
||||
trcmd=`which tr`
|
||||
uniqcmd=`which uniq`
|
||||
|
||||
###################################################################################################################
|
||||
|
||||
hostname=$1
|
||||
usr=$2
|
||||
pswd=$3
|
||||
srv=$4
|
||||
|
||||
|
||||
if [ ! "$#" == "4" ]; then
|
||||
echo -e "\nYou did not supply enough arguments. \nUsage: $0 <host> <username> <password> <version> \n \n$0 checks Microsoft SQL Server connectivity. It works with versions 7 and 2000.\n\nYou need a working version of FreeTDS (http://www.freetds.org/) and tsql (included in FreeTDS 6.0+) to connect to the SQL server. \nIt was written by Tom De Blende (tom.deblende@village.uunet.be) in 2003. \n\nExample:\n $0 dbserver sa f00bar 2000\n" && exit "3"
|
||||
|
||||
elif [ $tsqlcmd == "" ]; then
|
||||
echo -e "tsql not found! Please verify you have a working version of tsql (included in the FreeTDS version 6.0+) and enter the full path in the script." && exit "3"
|
||||
|
||||
fi
|
||||
|
||||
exit="3"
|
||||
|
||||
|
||||
# Creating the command file that contains the sql statement that has to be run on the SQL server.
|
||||
|
||||
tmpfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
|
||||
if [ $srv == "7" ]; then
|
||||
spid=7
|
||||
elif [ $srv == "2000" ]; then
|
||||
spid=50
|
||||
else
|
||||
echo -e "$srv is not a supported MS SQL Server version!" && exit "3"
|
||||
fi
|
||||
|
||||
echo -e "select loginame from sysprocesses where spid > $spid order by loginame asc\ngo" > $tmpfile
|
||||
|
||||
|
||||
# Running tsql to get the results back.
|
||||
|
||||
resultfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
errorfile=`$mktempcmd /tmp/$hostname.XXXXXX`
|
||||
$tsqlcmd -S $hostname -U $usr -P $pswd < $tmpfile 2>$errorfile > $resultfile
|
||||
|
||||
$grepcmd -q "Login failed for user" $errorfile
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. Login failed.;
|
||||
exit 2;
|
||||
fi
|
||||
|
||||
$grepcmd -q "There was a problem connecting to the server" $errorfile
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. Incorrect server name or SQL service not running.;
|
||||
exit 2;
|
||||
fi
|
||||
|
||||
resultfileln=`$catcmd $resultfile | $wccmd -l | $sedcmd 's/ //g'`
|
||||
|
||||
if [ "$resultfileln" == "2" ]; then
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile;
|
||||
echo CRITICAL - Could not make connection to SQL server. No data received from host.;
|
||||
exit 2;
|
||||
else
|
||||
nmbr=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $wccmd -l | sed 's/ //g'`
|
||||
users=`$catcmd $resultfile | $grepcmd -v locale | $grepcmd -v charset| $grepcmd -v 1\> | $sedcmd '/^$/d' | $sedcmd 's/ //g' | $uniqcmd -c | $trcmd \\\n , | $sedcmd 's/,$/./g' | $sedcmd 's/,/, /g' | $sedcmd 's/ //g' | $trcmd \\\t " " | $sedcmd 's/ \./\./g' | $sedcmd 's/ ,/,/g'`
|
||||
$rmcmd -f $tmpfile $resultfile;
|
||||
echo "OK - MS SQL Server $srv has $nmbr user(s) connected: $users" | sed 's/: $/./g';
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# Cleaning up.
|
||||
|
||||
$rmcmd -f $tmpfile $resultfile $errorfile
|
||||
echo $stdio
|
||||
exit $exit
|
||||
48
contrib/check_nagios.pl
Normal file
48
contrib/check_nagios.pl
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
# denao - denao@uol.com.br - Systems Engineering
|
||||
# Universo Online - http://www.uol.com.br
|
||||
use DBI;
|
||||
use Time::Local;
|
||||
|
||||
my $t_lambuja = 5; # (expire_minutes)
|
||||
my $databasename = ""; # The name of nagios database (i.e.: nagios)
|
||||
my $table = "programstatus";
|
||||
my $where = "localhost"; # The machine where the database
|
||||
my $port = "3306";
|
||||
my $base = "DBI:mysql:$databasename:$where:$port";
|
||||
my $user = ""; # the user to connect to the database
|
||||
# (needs permission to "select at programstatus table only"
|
||||
my $password = ""; # the password (if any)
|
||||
my %results;
|
||||
my @fields = qw( last_update );
|
||||
my $dbh = DBI->connect($base,$user,$password);
|
||||
my $fields = join(', ', @fields);
|
||||
my $query = "SELECT $fields FROM $table";
|
||||
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute();
|
||||
|
||||
@results{@fields} = ();
|
||||
$sth->bind_columns(map { \$results{$_} } @fields);
|
||||
|
||||
$sth->fetch();
|
||||
$sth->finish();
|
||||
$dbh->disconnect();
|
||||
|
||||
check_update();
|
||||
|
||||
sub check_update {
|
||||
($yea,$mon,$day,$hou,$min,$sec)=($results{last_update}=~/(\d+)\-(\d+)\-(\d+)\s(\d+)\:(\d+)\:(\d+)/);
|
||||
($sec_now, $min_now, $hou_now, $day_now, $mon_now, $yea_now) = (localtime(time))[0,1,2,3,4,5];
|
||||
$mon_now+=1; $yea_now+=1900;
|
||||
$unixdate=timelocal($sec,$min,$hou,$day,$mon,$yea);
|
||||
$unixdate_now=timelocal($sec_now,$min_now,$hou_now,$day_now,$mon_now,$yea_now);
|
||||
if (scalar($unixdate_now - $unixdate) > scalar($t_lambuja * 60)) {
|
||||
print "Nagios problem: nagios is down, for at least " . scalar($t_lambuja) . " minutes.\n";
|
||||
exit(1);
|
||||
} else {
|
||||
print "Nagios ok: status data updated " . scalar($unixdate_now - $unixdate) . " seconds ago\n";
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
89
contrib/check_nagios_db.pl
Normal file
89
contrib/check_nagios_db.pl
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
use strict;
|
||||
$|++;
|
||||
|
||||
use vars qw/$opt_e $opt_c/;
|
||||
|
||||
$ENV{"PATH"} = "/usr/bin:/usr/sbin:/bin";
|
||||
|
||||
use Getopt::Std;
|
||||
use DBI;
|
||||
|
||||
my $driver = "mysql";
|
||||
|
||||
my $CFG_DEF = "/opt/nagios/etc/cgi.cfg";
|
||||
my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
|
||||
my $EXPIRE_DEF = 5; ## expressed in minutes
|
||||
my $PROCCNT = 0;
|
||||
|
||||
use constant OK => 1;
|
||||
use constant WARN => 2;
|
||||
|
||||
my $STAT = WARN;
|
||||
|
||||
sub usage {
|
||||
print STDERR "\n";
|
||||
print STDERR "$0 -F -e <expire time in minutes> -C <process string>\n";
|
||||
print STDERR "\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
getopt("e:c:");
|
||||
|
||||
my $EXPIRE = $opt_e || $EXPIRE_DEF;
|
||||
my $CFG = $opt_c || $CFG_DEF;
|
||||
|
||||
( -f $CFG ) or die "Can't open config file '$CFG': $!\n";
|
||||
|
||||
my ($dbhost, $dbport, $dbuser, $dbpass, $dbname);
|
||||
|
||||
open(F, "< $CFG");
|
||||
while ( <F> ) {
|
||||
if (/^xsddb_host=(.+)/) { $dbhost = $1; next; };
|
||||
if (/^xsddb_port=(.+)/) { $dbport = $1; next; };
|
||||
if (/^xsddb_database=(.+)/) { $dbname = $1; next; };
|
||||
if (/^xsddb_username=(.+)/) { $dbuser = $1; next; };
|
||||
if (/^xsddb_password=(.+)/) { $dbpass = $1; next; };
|
||||
}
|
||||
close(F);
|
||||
|
||||
# print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
|
||||
|
||||
my $dsn = "DBI:$driver:database=$dbname;host=$dbhost;port=$dbport";
|
||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
|
||||
|
||||
my $sth = $dbh->prepare($QUERY);
|
||||
if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
|
||||
$sth->execute;
|
||||
if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; }
|
||||
|
||||
my %status = ();
|
||||
|
||||
my $names = $sth->{'NAME'};
|
||||
my $numFields = $sth->{'NUM_OF_FIELDS'};
|
||||
my $ref = $sth->fetchrow_arrayref;
|
||||
for (my $i = 0; $i < $numFields; $i++) {
|
||||
$status{"$$names[$i]"} = $$ref[$i];
|
||||
}
|
||||
|
||||
#foreach (keys(%status)) {
|
||||
# print "$_: $status{$_}\n";
|
||||
#}
|
||||
|
||||
my $lastupdated = time() - $status{"ut"};
|
||||
if ( $lastupdated < ($EXPIRE*60) ) { ## convert $EXPIRE to seconds
|
||||
$STAT = OK;
|
||||
}
|
||||
|
||||
open(PS, "ps -eaf | grep $status{nagios_pid} | grep -v grep | ");
|
||||
$PROCCNT = 0;
|
||||
while(<PS>) {
|
||||
$PROCCNT++;
|
||||
}
|
||||
close(PS);
|
||||
|
||||
if ( $STAT == OK ) {
|
||||
print "Nagios OK: located $PROCCNT processes, program status updated $lastupdated seconds ago\n";
|
||||
}
|
||||
|
||||
91
contrib/check_nagios_db_pg.pl
Normal file
91
contrib/check_nagios_db_pg.pl
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
$|++;
|
||||
|
||||
use vars qw/$opt_e $opt_c/;
|
||||
|
||||
$ENV{"PATH"} = "/usr/bin:/usr/sbin:/bin";
|
||||
|
||||
use Getopt::Std;
|
||||
use DBI;
|
||||
|
||||
my $driver = "Pg";
|
||||
|
||||
my $CFG_DEF = "/etc/nagios/cgi.cfg";
|
||||
# this works only in mysql
|
||||
# my $QUERY = "select *, UNIX_TIMESTAMP(last_update) as ut from programstatus;";
|
||||
# the following is the same for postgres
|
||||
my $QUERY = "select *, round(date_part('epoch',last_update)) as ut from programstatus;";
|
||||
my $EXPIRE_DEF = 5; ## expressed in minutes
|
||||
my $PROCCNT = 0;
|
||||
|
||||
use constant OK => 1;
|
||||
use constant WARN => 2;
|
||||
|
||||
my $STAT = WARN;
|
||||
|
||||
sub usage {
|
||||
print STDERR "\n";
|
||||
print STDERR "$0 -F -e <expire time in minutes> -C <process string>\n";
|
||||
print STDERR "\n";
|
||||
exit -1;
|
||||
}
|
||||
|
||||
getopt("e:c:");
|
||||
|
||||
my $EXPIRE = $opt_e || $EXPIRE_DEF;
|
||||
my $CFG = $opt_c || $CFG_DEF;
|
||||
|
||||
( -f $CFG ) or die "Can't open config file '$CFG': $!\n";
|
||||
|
||||
my ($dbhost, $dbport, $dbuser, $dbpass, $dbname);
|
||||
|
||||
open(F, "< $CFG");
|
||||
while ( <F> ) {
|
||||
if (/^xsddb_host=(.+)/) { $dbhost = $1; next; };
|
||||
if (/^xsddb_port=(.+)/) { $dbport = $1; next; };
|
||||
if (/^xsddb_database=(.+)/) { $dbname = $1; next; };
|
||||
if (/^xsddb_username=(.+)/) { $dbuser = $1; next; };
|
||||
if (/^xsddb_password=(.+)/) { $dbpass = $1; next; };
|
||||
}
|
||||
close(F);
|
||||
|
||||
#print "($dbhost, $dbport, $dbuser, $dbpass, $dbname)\n";
|
||||
|
||||
my $dsn = "DBI:$driver:dbname=$dbname;host=$dbhost;port=$dbport";
|
||||
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'RaiseError' => 1});
|
||||
|
||||
my $sth = $dbh->prepare($QUERY);
|
||||
if (!$sth) { die "Error:" . $dbh->errstr . "\n"; }
|
||||
$sth->execute;
|
||||
if (!$sth->execute) { die "Error:" . $sth->errstr . "\n"; }
|
||||
|
||||
my %status = ();
|
||||
|
||||
my $names = $sth->{'NAME'};
|
||||
my $numFields = $sth->{'NUM_OF_FIELDS'};
|
||||
my $ref = $sth->fetchrow_arrayref;
|
||||
for (my $i = 0; $i < $numFields; $i++) {
|
||||
$status{"$$names[$i]"} = $$ref[$i];
|
||||
}
|
||||
|
||||
#foreach (keys(%status)) {
|
||||
# print "$_: $status{$_}\n";
|
||||
#}
|
||||
|
||||
my $lastupdated = time() - $status{"ut"};
|
||||
if ( $lastupdated < ($EXPIRE*60) ) { ## convert $EXPIRE to seconds
|
||||
$STAT = OK;
|
||||
}
|
||||
|
||||
open(PS, "ps -eaf | grep $status{nagios_pid} | grep -v grep | ");
|
||||
$PROCCNT = 0;
|
||||
while(<PS>) {
|
||||
$PROCCNT++;
|
||||
}
|
||||
close(PS);
|
||||
|
||||
if ( $STAT == OK ) {
|
||||
print "Nagios OK: located $PROCCNT processes, program status updated $lastupdated seconds ago\n";
|
||||
}
|
||||
178
contrib/check_netapp.pl
Executable file
178
contrib/check_netapp.pl
Executable file
|
|
@ -0,0 +1,178 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# check_netapp
|
||||
#
|
||||
# Copyright (C) 2000 Leland E. Vandervort <leland@mmania.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# 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
|
||||
####################################
|
||||
# checks for overtemperature, fans, psu, and nfs operations/second on
|
||||
# Network Appliance Filers.
|
||||
# Returns:
|
||||
# OK if temp, fans, psu OK and Ops/Sec below warning and critical
|
||||
# Thresholds (default is warning=3500, critical=5000)
|
||||
# ** Note: See the specifications for your Filer model for
|
||||
# the thresholds !
|
||||
# Returns Warning if NFS Ops/Sec is above warning threshold
|
||||
# (default 3500, or specified by -o command line option)
|
||||
# Returns Critical if NFS Ops/Sec is above critical threshold
|
||||
# ( -m option, or default 5000), or if overtem, psufault, or
|
||||
# fanfault detected.
|
||||
#
|
||||
####################################
|
||||
# Notes on operational limits for NetApp Filers:
|
||||
# Platform Maximum Ops/Second (recommended)
|
||||
# -------------------------------------------------------------
|
||||
# F230 1000
|
||||
# F740 5500
|
||||
# F760 9000
|
||||
####################################
|
||||
|
||||
use Net::SNMP;
|
||||
use Getopt::Long;
|
||||
&Getopt::Long::config('auto_abbrev');
|
||||
|
||||
my $status;
|
||||
my $response = "";
|
||||
my $TIMEOUT = 10;
|
||||
my $community = "public";
|
||||
my $port = 161;
|
||||
my $opsthresh = "3500";
|
||||
my $critical = "5000";
|
||||
|
||||
my $status_string = "";
|
||||
|
||||
my %OIDLIST = (
|
||||
overtemp => '1.3.6.1.4.1.789.1.2.4.1.0',
|
||||
failedfan => '1.3.6.1.4.1.789.1.2.4.2.0',
|
||||
failedpsu => '1.3.6.1.4.1.789.1.2.4.4.0',
|
||||
nfsops => '1.3.6.1.4.1.789.1.2.2.1.0'
|
||||
);
|
||||
|
||||
|
||||
|
||||
my %STATUSCODE = ( 'UNKNOWN' => '-1',
|
||||
'OK' => '0',
|
||||
'WARNING' => '1',
|
||||
'CRITICAL' => '2');
|
||||
|
||||
my $state = "UNKNOWN";
|
||||
|
||||
|
||||
$SIG{'ALRM'} = sub {
|
||||
print "ERROR: No snmp response from $hostname (sigALRM)\n";
|
||||
exit($STATUSCODE{"UNKNOWN"});
|
||||
};
|
||||
|
||||
alarm($TIMEOUT);
|
||||
|
||||
sub get_nfsops {
|
||||
my $nfsops_start = &SNMPGET($OIDLIST{nfsops});
|
||||
sleep(1);
|
||||
my $nfsops_end = &SNMPGET($OIDLIST{nfsops});
|
||||
my $nfsopspersec = $nfsops_end - $nfsops_start;
|
||||
return($nfsopspersec);
|
||||
}
|
||||
|
||||
|
||||
sub show_help {
|
||||
printf("\nPerl NetApp filer plugin for Nagios\n");
|
||||
printf("Usage:\n");
|
||||
printf("
|
||||
check_netapp [options] <hostname>
|
||||
Options:
|
||||
-c snmp-community
|
||||
-p snmp-port
|
||||
-o Operations per second warning threshold
|
||||
-m Operations per second critical threshold
|
||||
|
||||
");
|
||||
printf("Copyright (C)2000 Leland E. Vandervort\n");
|
||||
printf("check_netapp comes with absolutely NO WARRANTY either implied or explicit\n");
|
||||
printf("This program is licensed under the terms of the\n");
|
||||
printf("GNU General Public License\n(check source code for details)\n\n\n");
|
||||
exit($STATUSCODE{"UNKNOWN"});
|
||||
}
|
||||
|
||||
|
||||
$status = GetOptions( "community=s", \$community,
|
||||
"port=i", \$port,
|
||||
"opsthresh=i", \$opsthresh,
|
||||
"maxops=i", \$critical );
|
||||
|
||||
if($status == 0) {
|
||||
&show_help;
|
||||
}
|
||||
|
||||
sub SNMPGET {
|
||||
$OID = shift;
|
||||
($session,$error) = Net::SNMP->session(
|
||||
Hostname => $hostname,
|
||||
Community => $community,
|
||||
Port => $port
|
||||
);
|
||||
if(!defined($session)) {
|
||||
printf("$state %s\n", $error);
|
||||
exit($STATUSCODE{$state});
|
||||
}
|
||||
if(!defined($response = $session->get_request($OID))) {
|
||||
printf("$state %s\n", $session->error());
|
||||
$session->close();
|
||||
exit($STATUSCODE{$state});
|
||||
}
|
||||
$session->close();
|
||||
return($response->{$OID});
|
||||
}
|
||||
|
||||
$hostname = shift || &show_help;
|
||||
|
||||
my $tempcheck = &SNMPGET($OIDLIST{overtemp});
|
||||
if($tempcheck == 1) {
|
||||
$state = "OK";
|
||||
$status_string .= "Temp OK ";
|
||||
}
|
||||
else {
|
||||
$state = "CRITICAL";
|
||||
$status_string .= "Temp CRIT";
|
||||
}
|
||||
|
||||
foreach $element ('failedfan','failedpsu') {
|
||||
my $my_return = &SNMPGET($OIDLIST{$element});
|
||||
if(($my_return =~ /no/) || ($my_return == 0)) {
|
||||
$status_string .= "$element = $my_return ";
|
||||
$state = "OK";
|
||||
}
|
||||
else {
|
||||
$status_string .= "$element = $my_return ";
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
}
|
||||
|
||||
my $tmp_opssec = &get_nfsops();
|
||||
|
||||
if ($tmp_opssec >= $critical) {
|
||||
$state = "CRITICAL";
|
||||
}
|
||||
elsif ($tmp_opssec >= $opsthresh) {
|
||||
$state = "WARNING";
|
||||
}
|
||||
else {
|
||||
$state = "OK";
|
||||
}
|
||||
|
||||
$status_string .= "Ops\/Sec = $tmp_opssec ";
|
||||
|
||||
print "$state $status_string\n";
|
||||
exit($STATUSCODE{$state});
|
||||
442
contrib/check_nmap.py
Normal file
442
contrib/check_nmap.py
Normal file
|
|
@ -0,0 +1,442 @@
|
|||
#!/usr/bin/python
|
||||
# Change the above line if python is somewhere else
|
||||
|
||||
#
|
||||
# check_nmap
|
||||
#
|
||||
# Program: nmap plugin for Nagios
|
||||
# License: GPL
|
||||
# Copyright (c) 2000 Jacob Lundqvist (jaclu@galdrion.com)
|
||||
#
|
||||
_version_ = '1.21'
|
||||
#
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# Does a nmap scan, compares open ports to those given on command-line
|
||||
# Reports warning for closed that should be open and error for
|
||||
# open that should be closed.
|
||||
# If optional ports are given, no warning is given if they are closed
|
||||
# and they are included in the list of valid ports.
|
||||
#
|
||||
# Requirements:
|
||||
# python
|
||||
# nmap
|
||||
#
|
||||
# History
|
||||
# -------
|
||||
# 1.21 2004-07-23 rippeld@hillsboroughcounty.org Updated parsing of nmap output to correctly identify closed ports
|
||||
# 1.20 2000-07-15 jaclu Updated params to correctly comply to plugin-standard
|
||||
# moved support classes to utils.py
|
||||
# 1.16 2000-07-14 jaclu made options and return codes more compatible with
|
||||
# the plugin developer-guidelines
|
||||
# 1.15 2000-07-14 jaclu added random string to temp-file name
|
||||
# 1.14 2000-07-14 jaclu added check for error from subproc
|
||||
# 1.10 2000-07-14 jaclu converted main part to class
|
||||
# 1.08 2000-07-13 jaclu better param parsing
|
||||
# 1.07 2000-07-13 jaclu changed nmap param to -P0
|
||||
# 1.06 2000-07-13 jaclu make sure tmp file is deleted on errors
|
||||
# 1.05 2000-07-12 jaclu in debug mode, show exit code
|
||||
# 1.03 2000-07-12 jaclu error handling on nmap output
|
||||
# 1.01 2000-07-12 jaclu added license
|
||||
# 1.00 2000-07-12 jaclu implemented timeout handling
|
||||
# 0.20 2000-07-10 jaclu Initial release
|
||||
|
||||
|
||||
import sys, os, string, whrandom
|
||||
|
||||
import tempfile
|
||||
from getopt import getopt
|
||||
|
||||
#
|
||||
# import generic Nagios-plugin stuff
|
||||
#
|
||||
import utils
|
||||
|
||||
# Where temp files should be placed
|
||||
tempfile.tempdir='/usr/local/nagios/var'
|
||||
|
||||
# Base name for tempfile
|
||||
tempfile.template='check_nmap_tmp.'
|
||||
|
||||
# location and possibly params for nmap
|
||||
nmap_cmd='/usr/bin/nmap -P0'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# the class that does all the real work in this plugin...
|
||||
#
|
||||
#
|
||||
class CheckNmap:
|
||||
|
||||
# Retcodes, so we are compatible with nagios
|
||||
#ERROR= -1
|
||||
UNKNOWN= -1
|
||||
OK= 0
|
||||
WARNING= 1
|
||||
CRITICAL= 2
|
||||
|
||||
|
||||
def __init__(self,cmd_line=[]):
|
||||
"""Constructor.
|
||||
arguments:
|
||||
cmd_line: normaly sys.argv[1:] if called as standalone program
|
||||
"""
|
||||
self.tmp_file=''
|
||||
self.host='' # host to check
|
||||
self.timeout=10
|
||||
self.debug=0 # 1= show debug info
|
||||
self.ports=[] # list of mandatory ports
|
||||
self.opt_ports=[] # list of optional ports
|
||||
self.ranges='' # port ranges for nmap
|
||||
self.exit_code=0 # numerical exit-code
|
||||
self.exit_msg='' # message to caller
|
||||
|
||||
self.ParseCmdLine(cmd_line)
|
||||
|
||||
def Run(self):
|
||||
"""Actually run the process.
|
||||
This method should be called exactly once.
|
||||
"""
|
||||
|
||||
#
|
||||
# Only call check_host if cmd line was accepted earlier
|
||||
#
|
||||
if self.exit_code==0:
|
||||
self.CheckHost()
|
||||
|
||||
self.CleanUp()
|
||||
return self.exit_code,self.exit_msg
|
||||
|
||||
def Version(self):
|
||||
return 'check_nmap %s' % _version_
|
||||
|
||||
#-----------------------------------------
|
||||
#
|
||||
# class internal stuff below...
|
||||
#
|
||||
#-----------------------------------------
|
||||
|
||||
#
|
||||
# Param checks
|
||||
#
|
||||
def param2int_list(self,s):
|
||||
lst=string.split(string.replace(s,',',' '))
|
||||
try:
|
||||
for i in range(len(lst)):
|
||||
lst[i]=int(lst[i])
|
||||
except:
|
||||
lst=[]
|
||||
return lst
|
||||
|
||||
def ParseCmdLine(self,cmd_line):
|
||||
try:
|
||||
opt_list=getopt(cmd_line,'vH:ho:p:r:t:V',['debug','host=','help',
|
||||
'optional=','port=','range=','timeout','version'])
|
||||
for opt in opt_list[0]:
|
||||
if opt[0]=='-v' or opt[0]=='--debug':
|
||||
self.debug=1
|
||||
elif opt[0]=='-H' or opt[0]=='--host':
|
||||
self.host=opt[1]
|
||||
elif opt[0]=='-h' or opt[0]=='--help':
|
||||
doc_help()
|
||||
self.exit_code=1 # request termination
|
||||
break
|
||||
elif opt[0]=='-o' or opt[0]=='--optional':
|
||||
self.opt_ports=self.param2int_list(opt[1])
|
||||
elif opt[0]=='-p' or opt[0]=='--port':
|
||||
self.ports=self.param2int_list(opt[1])
|
||||
elif opt[0]=='-r' or opt[0]=='--range':
|
||||
r=string.replace(opt[1],':','-')
|
||||
self.ranges=r
|
||||
elif opt[0]=='-t' or opt[0]=='--timeout':
|
||||
self.timeout=opt[1]
|
||||
elif opt[0]=='-V' or opt[0]=='--version':
|
||||
print self.Version()
|
||||
self.exit_code=1 # request termination
|
||||
break
|
||||
else:
|
||||
self.host=''
|
||||
break
|
||||
|
||||
except:
|
||||
# unknown param
|
||||
self.host=''
|
||||
|
||||
if self.debug:
|
||||
print 'Params:'
|
||||
print '-------'
|
||||
print 'host = %s' % self.host
|
||||
print 'timeout = %s' % self.timeout
|
||||
print 'ports = %s' % self.ports
|
||||
print 'optional ports = %s' % self.opt_ports
|
||||
print 'ranges = %s' % self.ranges
|
||||
print
|
||||
|
||||
#
|
||||
# a option that wishes us to terminate now has been given...
|
||||
#
|
||||
# This way, you can test params in debug mode and see what this
|
||||
# program recognised by suplying a version param at the end of
|
||||
# the cmd-line
|
||||
#
|
||||
if self.exit_code<>0:
|
||||
sys.exit(self.UNKNOWN)
|
||||
|
||||
if self.host=='':
|
||||
doc_syntax()
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='UNKNOWN: bad params, try running without any params for syntax'
|
||||
|
||||
|
||||
def CheckHost(self):
|
||||
'Check one host using nmap.'
|
||||
#
|
||||
# Create a tmp file for storing nmap output
|
||||
#
|
||||
# The tempfile module from python 1.5.2 is stupid
|
||||
# two processes runing at aprox the same time gets
|
||||
# the same tempfile...
|
||||
# For this reason I use a random suffix for the tmp-file
|
||||
# Still not 100% safe, but reduces the risk significally
|
||||
# I also inserted checks at various places, so that
|
||||
# _if_ two processes in deed get the same tmp-file
|
||||
# the only result is a normal error message to nagios
|
||||
#
|
||||
r=whrandom.whrandom()
|
||||
self.tmp_file=tempfile.mktemp('.%s')%r.randint(0,100000)
|
||||
if self.debug:
|
||||
print 'Tmpfile is: %s'%self.tmp_file
|
||||
#
|
||||
# If a range is given, only run nmap on this range
|
||||
#
|
||||
if self.ranges<>'':
|
||||
global nmap_cmd # needed, to avoid error on next line
|
||||
# since we assigns to nmap_cmd :)
|
||||
nmap_cmd='%s -p %s' %(nmap_cmd,self.ranges)
|
||||
#
|
||||
# Prepare a task
|
||||
#
|
||||
t=utils.Task('%s %s' %(nmap_cmd,self.host))
|
||||
#
|
||||
# Configure a time-out handler
|
||||
#
|
||||
th=utils.TimeoutHandler(t.Kill, time_to_live=self.timeout,
|
||||
debug=self.debug)
|
||||
#
|
||||
# Fork of nmap cmd
|
||||
#
|
||||
t.Run(detach=0, stdout=self.tmp_file,stderr='/dev/null')
|
||||
#
|
||||
# Wait for completition, error or timeout
|
||||
#
|
||||
nmap_exit_code=t.Wait(idlefunc=th.Check, interval=1)
|
||||
#
|
||||
# Check for timeout
|
||||
#
|
||||
if th.WasTimeOut():
|
||||
self.exit_code=self.CRITICAL
|
||||
self.exit_msg='CRITICAL - Plugin timed out after %s seconds' % self.timeout
|
||||
return
|
||||
#
|
||||
# Check for exit status of subprocess
|
||||
# Must do this after check for timeout, since the subprocess
|
||||
# also returns error if aborted.
|
||||
#
|
||||
if nmap_exit_code <> 0:
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='nmap program failed with code %s' % nmap_exit_code
|
||||
return
|
||||
#
|
||||
# Read output
|
||||
#
|
||||
try:
|
||||
f = open(self.tmp_file, 'r')
|
||||
output=f.readlines()
|
||||
f.close()
|
||||
except:
|
||||
self.exit_code=self.UNKNOWN
|
||||
self.exit_msg='Unable to get output from nmap'
|
||||
return
|
||||
|
||||
#
|
||||
# Store open ports in list
|
||||
# scans for lines where first word contains '/'
|
||||
# and stores part before '/'
|
||||
#
|
||||
self.active_ports=[]
|
||||
try:
|
||||
for l in output:
|
||||
if len(l)<2:
|
||||
continue
|
||||
s=string.split(l)[0]
|
||||
if string.find(s,'/')<1:
|
||||
continue
|
||||
p=string.split(s,'/')[0]
|
||||
if string.find(l,'open')>1:
|
||||
self.active_ports.append(int(p))
|
||||
except:
|
||||
# failure due to strange output...
|
||||
pass
|
||||
|
||||
if self.debug:
|
||||
print 'Ports found by nmap: ',self.active_ports
|
||||
#
|
||||
# Filter out optional ports, we don't check status for them...
|
||||
#
|
||||
try:
|
||||
for p in self.opt_ports:
|
||||
self.active_ports.remove(p)
|
||||
|
||||
if self.debug and len(self.opt_ports)>0:
|
||||
print 'optional ports removed:',self.active_ports
|
||||
except:
|
||||
# under extreame loads the remove(p) above failed for me
|
||||
# a few times, this exception hanlder handles
|
||||
# this bug-alike situation...
|
||||
pass
|
||||
|
||||
opened=self.CheckOpen()
|
||||
closed=self.CheckClosed()
|
||||
|
||||
if opened <>'':
|
||||
self.exit_code=self.CRITICAL
|
||||
self.exit_msg='PORTS CRITICAL - Open:%s Closed:%s'%(opened,closed)
|
||||
elif closed <>'':
|
||||
self.exit_code=self.WARNING
|
||||
self.exit_msg='PORTS WARNING - Closed:%s'%closed
|
||||
else:
|
||||
self.exit_code=self.OK
|
||||
self.exit_msg='PORTS ok - Only defined ports open'
|
||||
|
||||
|
||||
#
|
||||
# Compares requested ports on with actually open ports
|
||||
# returns all open that should be closed
|
||||
#
|
||||
def CheckOpen(self):
|
||||
opened=''
|
||||
for p in self.active_ports:
|
||||
if p not in self.ports:
|
||||
opened='%s %s' %(opened,p)
|
||||
return opened
|
||||
|
||||
#
|
||||
# Compares requested ports with actually open ports
|
||||
# returns all ports that are should be open
|
||||
#
|
||||
def CheckClosed(self):
|
||||
closed=''
|
||||
for p in self.ports:
|
||||
if p not in self.active_ports:
|
||||
closed='%s %s' % (closed,p)
|
||||
return closed
|
||||
|
||||
|
||||
def CleanUp(self):
|
||||
#
|
||||
# If temp file exists, get rid of it
|
||||
#
|
||||
if self.tmp_file<>'' and os.path.isfile(self.tmp_file):
|
||||
try:
|
||||
os.remove(self.tmp_file)
|
||||
except:
|
||||
# temp-file colition, some other process already
|
||||
# removed the same file...
|
||||
pass
|
||||
|
||||
#
|
||||
# Show numerical exits as string in debug mode
|
||||
#
|
||||
if self.debug:
|
||||
print 'Exitcode:',self.exit_code,
|
||||
if self.exit_code==self.UNKNOWN:
|
||||
print 'UNKNOWN'
|
||||
elif self.exit_code==self.OK:
|
||||
print 'OK'
|
||||
elif self.exit_code==self.WARNING:
|
||||
print 'WARNING'
|
||||
elif self.exit_code==self.CRITICAL:
|
||||
print 'CRITICAL'
|
||||
else:
|
||||
print 'undefined'
|
||||
#
|
||||
# Check if invalid exit code
|
||||
#
|
||||
if self.exit_code<-1 or self.exit_code>2:
|
||||
self.exit_msg=self.exit_msg+' - undefined exit code (%s)' % self.exit_code
|
||||
self.exit_code=self.UNKNOWN
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Help texts
|
||||
#
|
||||
def doc_head():
|
||||
print """
|
||||
check_nmap plugin for Nagios
|
||||
Copyright (c) 2000 Jacob Lundqvist (jaclu@galdrion.com)
|
||||
License: GPL
|
||||
Version: %s""" % _version_
|
||||
|
||||
|
||||
def doc_syntax():
|
||||
print """
|
||||
Usage: check_ports [-v|--debug] [-H|--host host] [-V|--version] [-h|--help]
|
||||
[-o|--optional port1,port2,port3 ...] [-r|--range range]
|
||||
[-p|--port port1,port2,port3 ...] [-t|--timeout timeout]"""
|
||||
|
||||
|
||||
def doc_help():
|
||||
'Help is displayed if run without params.'
|
||||
doc_head()
|
||||
doc_syntax()
|
||||
print """
|
||||
Options:
|
||||
-h = help (this screen ;-)
|
||||
-v = debug mode, show some extra output
|
||||
-H host = host to check (name or IP#)
|
||||
-o ports = optional ports that can be open (one or more),
|
||||
no warning is given if optional port is closed
|
||||
-p ports = ports that should be open (one or more)
|
||||
-r range = port range to feed to nmap. Example: :1024,2049,3000:7000
|
||||
-t timeout = timeout in seconds, default 10
|
||||
-V = Version info
|
||||
|
||||
This plugin attempts to verify open ports on the specified host.
|
||||
|
||||
If all specified ports are open, OK is returned.
|
||||
If any of them are closed, WARNING is returned (except for optional ports)
|
||||
If other ports are open, CRITICAL is returned
|
||||
|
||||
If possible, supply an IP address for the host address,
|
||||
as this will bypass the DNS lookup.
|
||||
"""
|
||||
|
||||
|
||||
#
|
||||
# Main
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
|
||||
if len (sys.argv) < 2:
|
||||
#
|
||||
# No params given, show syntax and exit
|
||||
#
|
||||
doc_syntax()
|
||||
sys.exit(-1)
|
||||
|
||||
nmap=CheckNmap(sys.argv[1:])
|
||||
exit_code,exit_msg=nmap.Run()
|
||||
|
||||
#
|
||||
# Give Nagios a msg and a code
|
||||
#
|
||||
print exit_msg
|
||||
sys.exit(exit_code)
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue