mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-12-22 09:03:54 +01:00
This commit is contained in:
parent
203bbded50
commit
361b4ff3b3
@ -1,184 +0,0 @@
|
||||
#!/bin/sh
|
||||
# THIS ONE IS DEPRECATED AND NO LONGER MAINTAINED!
|
||||
# Check check_eva.py
|
||||
|
||||
# Some defaults
|
||||
hostaddress=evahost
|
||||
username=eva
|
||||
password=eva1234
|
||||
|
||||
BODYFILE=/tmp/check_eva.body
|
||||
LASTCHECK=`ls -la /etc/sssu.out | awk ' { print $6,$7,$8 }'`
|
||||
COMMANDFILE="/etc/nagios/check_eva.sssu"
|
||||
VERSION=1.0
|
||||
|
||||
OK=0
|
||||
WARNING=1
|
||||
CRITICAL=2
|
||||
UNKNOWN=3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print_help() {
|
||||
echo "check_eva version $VERSION"
|
||||
echo "This plugin checks status of HP EVA Array via sssu command"
|
||||
echo ""
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo "Options:"
|
||||
echo "[-H <host>]"
|
||||
echo "[--username <user>]"
|
||||
echo "[--password <password]"
|
||||
echo "[--test]"
|
||||
echo "[--help]"
|
||||
echo ""
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Parse arguments
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case $1
|
||||
in
|
||||
-H)
|
||||
hostaddress=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--username)
|
||||
username=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--password)
|
||||
password=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
-P)
|
||||
password=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
-U)
|
||||
username=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
|
||||
|
||||
|
||||
--test)
|
||||
testmode=$1
|
||||
shift 1
|
||||
;;
|
||||
--help)
|
||||
print_help ;
|
||||
exit $OK
|
||||
;;
|
||||
|
||||
*)
|
||||
print_help ;
|
||||
exit $UNKNOWN
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Compatibility with old style use case of this file
|
||||
if [ $# -eq 0 ]; then
|
||||
|
||||
if [ ! -f $COMMANDFILE ]; then
|
||||
echo "Error, could not find commandfile $COMMANDFILE"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
/usr/local/sbin/sssu "file $COMMANDFILE" |grep -v PASSWORD > /etc/sssu.out
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Only run actual SSSU command if this is not a test run
|
||||
#if [ -z $testmode ]; then
|
||||
# /usr/local/sbin/sssu "file $COMMANDFILE" |grep -v PASSWORD > /etc/sssu.out
|
||||
#fi
|
||||
|
||||
|
||||
|
||||
# Run the actual sssu command
|
||||
CMD1="set option on_error=continue"
|
||||
CMD2="select manager $hostaddress USERNAME=$username PASSWORD=$password"
|
||||
CMD3="ls system full"
|
||||
|
||||
if [ "$DEBUG" == "1" ]; then
|
||||
echo "Debug: $CMD2"
|
||||
fi
|
||||
|
||||
/usr/local/sbin/sssu "$CMD1" "$CMD2" "$CMD3" | grep -v PASSWORD > /etc/sssu.out
|
||||
|
||||
|
||||
PROBLEM=`grep -w operationalstate /etc/sssu.out |grep -v good |wc -l`
|
||||
ERRORCHECK1=`grep -i error /etc/sssu.out| grep -v on_error | wc -l`
|
||||
ERRORCHECK2=`grep -w operationalstate /etc/sssu.out | wc -l`
|
||||
|
||||
|
||||
SUMMARY=`awk ' $1 == "objectname" { STORAGE=$3 } \
|
||||
$1 == "operationalstate" { STATE=$3 } \
|
||||
$1 == "managementhostname" { print STORAGE "=" STATE ";" } ' /etc/sssu.out | tr '\n' ' '`
|
||||
|
||||
|
||||
PERFDATA=`awk ' $1 == "objectname" { STORAGE=$3 } \
|
||||
$1 == "totalstoragespace" { totalstoragespace=STORAGE "_" $1 "=" $3 } \
|
||||
$1 == "usedstoragespace" { usedstoragespace=STORAGE "_" $1 "=" $3 } \
|
||||
$1 == "availablestoragespace" { availablestoragespace=STORAGE "_" $1 "=" $3 } \
|
||||
$1 == "managementhostname" { print totalstoragespace, usedstoragespace, availablestoragespace } ' /etc/sssu.out | tr '\n' ' '`
|
||||
|
||||
|
||||
|
||||
#totalstoragespace=`grep totalstoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' ' `
|
||||
#usedstoragespace=`grep usedstoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' '`
|
||||
#availablestoragespace=`grep availablestoragespace /etc/sssu.out | awk '{ print $3 }' | tr '\n' ' '`
|
||||
|
||||
#PERFDATA="totalstoragespace=$totalstoragespace usedstoragespace=$usedstoragespace availablestoragespace=$availablestoragespace"
|
||||
|
||||
if [ "$PROBLEM" -gt 0 ]; then
|
||||
echo "Warning - HP EVA Requires attention. $SUMMARY | $PERFDATA"
|
||||
echo "EVA state last checked at $LASTCHECK"
|
||||
grep -E 'operationalstate|operationalstatedetail|objectname|licensestate|systemtype|storagespace' /etc/sssu.out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$ERRORCHECK1" -gt 0 ]; then
|
||||
echo "Unknown - failed to run sssu command"
|
||||
cat /etc/sssu.out
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ "$ERRORCHECK2" -lt 1 ]; then
|
||||
echo "Unknown - Could not retrieve information via sssu"
|
||||
cat /etc/sssu.out
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
echo "OK - HP EVA reports: $SUMMARY | $PERFDATA"
|
||||
echo "EVA state last checked at $LASTCHECK"
|
||||
grep -E 'operationalstate|operationalstatedetail|objectname|licensestate|systemtype|storagespace' /etc/sssu.out
|
||||
|
@ -1,3 +0,0 @@
|
||||
set option on_error=continue
|
||||
select manager commandview USERNAME=nagiosuser PASSWORD=nagiospassword
|
||||
ls system full
|
1
check_eva/trunk/nrpe.d/check_eva.cfg
Normal file
1
check_eva/trunk/nrpe.d/check_eva.cfg
Normal file
@ -0,0 +1 @@
|
||||
command[check_eva]=python /usr/lib/nagios/plugins/check_eva.py --host "$ARG1$" --username "$ARG2$" --password "$ARG3$" --mode $ARG4$"
|
38
check_eva/trunk/sssu/sssu.spec
Normal file
38
check_eva/trunk/sssu/sssu.spec
Normal file
@ -0,0 +1,38 @@
|
||||
%define debug_package %{nil}
|
||||
|
||||
Summary: Storage System Scripting Utility
|
||||
Name: sssu
|
||||
Version: 9.2.0
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2+
|
||||
Group: Applications/System
|
||||
URL: http://www.hp.com
|
||||
Source0: http://www.hp.com/.../sssu-%{version}.tar.gz
|
||||
Requires: compat-libstdc++-33
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Packager: Pall Sigurdsson <palli@opensource.is>
|
||||
|
||||
|
||||
%description
|
||||
SSSU for HP StorageWorks Command View EVA. Storage System Scripting Utility
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
install -D -p -m 0755 sssu_%{_target} %{buildroot}/usr/bin/sssu
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
/usr/bin/sssu
|
||||
|
||||
%changelog
|
||||
* Mon Mar 1 2010 Pall Sigurdsson <palli@opensource.is> 0.1-1
|
||||
- Initial packaging
|
BIN
check_eva/trunk/sssu/sssu_linux_x86
Executable file
BIN
check_eva/trunk/sssu/sssu_linux_x86
Executable file
Binary file not shown.
BIN
check_eva/trunk/sssu/sssu_x86_64-linux
Executable file
BIN
check_eva/trunk/sssu/sssu_x86_64-linux
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user