1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-05 01:53:44 +01:00

check_ironport plugin added

This commit is contained in:
Páll Guðjón Sigurðsson 2010-12-14 16:23:02 +00:00
parent a185861c30
commit 2ba163a879
5 changed files with 468 additions and 4 deletions

View File

@ -0,0 +1,3 @@
command[check_bond]=/usr/lib64/nagios/plugins/check_bond -i '$ARG1$'
command[check_bond_bond0]=/usr/lib64/nagios/plugins/check_bond -i bond0

View File

@ -0,0 +1,311 @@
#!/bin/sh
# Plugin to check Ironport Appliances
# Desarrollado por Claudio Saavedra (20080120)
# Translated to english by Steven Geerts (20080316)
# Added various extra checks by Steven Geerts (20080830)
# Added performance data in the output of the result so graphs can be generated - Yan Bisson (20090625)
# input parameters
HOSTNAME=$1
USER=$2
PASSWORD=$3
ARGS=$4
PAR_WARN=$5
PAR_CRIT=$6
#STATUSFILE=/tmp/status.`echo $RANDOM$RANDOM|cut -c1-4`
STATUSFILE=/tmp/xml.status
# Nagios return codes
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
PROGNAME=`basename $0`
print_usage() {
echo ""
echo "Usage: $PROGNAME <hostname> <user> <password> <parameter> <warning_nro> <critical_nro>"
echo ""
echo "Notes:"
echo " hostname - Can be a hostname or IP address"
echo " parameter - Can be status, cpu, ram, msgxhour, conn_in, conn_out, queue, workqueue,"
echo " msgs_in_quarantine, disk_util, queuedisk_usage or resourseconservation"
echo ""
echo "parameters for STATUS are ignored but must be provided. The results for STATUS can be OK or critical."
echo "parameters for RESOURSECONSERVATION should be 1 and 2."
}
# XML Parameter info:
# <system status="online" /> DONE
# <gauge name="ram_utilization" current="7" /> DONE
# <gauge name="total_utilization" current="1" /> DONE
# <gauge name="cpu_utilization" current="0" />
# <gauge name="av_utilization" current="0" />
# <gauge name="case_utilization" current="0" />
# <gauge name="bm_utilization" current="0" />
# <gauge name="disk_utilization" current="1" /> DONE
# <gauge name="resource_conservation" current="0" /> DONE
# <gauge name="log_used" current="24" />
# <gauge name="log_available" current="123G" />
# <gauge name="conn_in" current="5" /> DONE
# <gauge name="conn_out" current="1" /> DONE
# <gauge name="active_recips" current="70" />
# <gauge name="unattempted_recips" current="64" /> DONE
# <gauge name="attempted_recips" current="6" /> DONE
# <gauge name="msgs_in_work_queue" current="0" /> DONE
# <gauge name="dests_in_memory" current="86" />
# <gauge name="kbytes_used" current="3458" /> DONE
# <gauge name="kbytes_free" current="71299710" /> DONE
# <gauge name="msgs_in_quarantine" current="24" /> DONE
# <gauge name="kbytes_in_quarantine" current="1616" />
# <gauge name="reporting_utilization" current="0" />
# <gauge name="quarantine_utilization" current="0" />
while test -n "$1"; do
case "$1" in
--help)
print_usage
exit $STATE_OK
;;
-h)
print_usage
exit $STATE_OK
;;
esac
shift
done
# Check arguments for validity
if [ -z ${HOSTNAME} ]; then
echo "Please specify the hostname!"
print_usage
exitstatus=$STATE_UNKNOWN
exit $exitstatus
fi
if [ $PAR_WARN -ge $PAR_CRIT ]; then
exitstatus=$STATE_UNKNOWN
echo "The WARNING number can not be larger or equal to the CRITICAL number!"
exit $exitstatus
fi
#wget --http-user=$USER --http-password=$PASSWORD --no-check-certificate --no-proxy https://$HOSTNAME/xml/status --output-document=$STATUSFILE >> /dev/null 2>&1
#wget --http-user=$USER --http-password=$PASSWORD --no-check-certificate https://$HOSTNAME/xml/status --output-document=$STATUSFILE >> /dev/null 2>&1
if [ $? -ne 0 ]; then
exitstatus=${STATE_UNKNOWN}
echo ""
echo "Can't collect data from an Ironpor appliance Ironport. Verify hostname, userID and password!"
rm -rf $STATUSFILE
exit $exitstatus
else
exitstatus=${STATE_OK}
fi
case "$ARGS" in
# <system status="online" /> DONE
# <gauge name="ram_utilization" current="7" /> DONE
status)
IPORTPAR=`grep "system status" $STATUSFILE | cut -d\" -f 2`
if [ $IPORTPAR = online ]; then
exitstatus=${STATE_OK}
echo "STATUS OK: $IPORTPAR" "| RESULT=1;"
else
exitstatus=${STATE_CRITICAL}
echo "STATUS CRITICAL: $IPORTPAR" "| RESULT=0;"
fi
;;
cpu)
IPORTPAR=`grep total_utilization $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "CPU CRITICAL: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "CPU WARNING: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "CPU OK: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
;;
ram)
IPORTPAR=`grep ram_utilization $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "RAM CRITICAL: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "RAM WARNING: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "RAM OK: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
;;
msgxhour)
IPORTPAR=`grep -A 3 "rate name=\"inj_msgs" $STATUSFILE | grep last_15_min | cut -d\" -f 2 `
echo $IPORTPAR $PAR_WARN
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "MAIL RATE CRITICAL: $IPORTPAR msgs/hr" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "MAIL RATE WARNING: $IPORTPAR msgs/hr" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "MAIL RATE OK: $IPORTPAR msgs/hr" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
conn_in)
IPORTPAR=`grep conn_in $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "Incomming Connections CRITICAL: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "Incomming Connections WARNING: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "Incomming Connections OK: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
conn_out)
IPORTPAR=`grep conn_out $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "Outgoing Connections CRITICAL: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "Outgoing Connections WARNING: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "Outgoing Connections OK: $IPORTPAR connections" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
queue)
IPORTPAR1=`grep \"attempted_recips $STATUSFILE | cut -d\" -f 4`
IPORTPAR2=`grep unattempted_recips $STATUSFILE | cut -d\" -f 4`
IPORTPAR=`expr $IPORTPAR1 + $IPORTPAR2`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "QUEUE CRITICAL: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "QUEUE WARNING: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "QUEUE OK: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
workqueue)
IPORTPAR=`grep msgs_in_work_queue $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "WORKQUEUE CRITICAL: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "WORKQUEUE WARNING: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "WORKQUEUE OK: $IPORTPAR msgs" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
resourseconservation)
IPORTPAR=`grep resource_conservation $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "RESOURSECONSERVATION CRITICAL: $IPORTPAR" "| RESULT=$IPORTPAR;"
else
exitstatus=${STATE_WARNING}
echo "RESOURSECONSERVATION WARNING: $IPORTPAR" "| RESULT=$IPORTPAR;"
fi
else
exitstatus=${STATE_OK}
echo "RESOURSECONSERVATION OK: $IPORTPAR " "| RESULT=$IPORTPAR;"
fi
;;
disk_util)
IPORTPAR=`grep disk_utilization $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "Disk Utilization CRITICAL: $IPORTPAR " "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "Disk Utilization WARNING: $IPORTPAR " "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "Disk Utilization OK: $IPORTPAR" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
msgs_in_quarantine)
IPORTPAR=`grep msgs_in_quarantine $STATUSFILE | cut -d\" -f 4`
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "MSG In Quarantine CRITICAL: $IPORTPAR" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "MSG In Quarantine WARNING: $IPORTPAR" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "MSG In Quarantine OK: $IPORTPAR" "| RESULT=$IPORTPAR;$PAR_WARN;$PAR_CRIT;"
fi
;;
queuedisk_usage)
IPORTPAR1=`grep kbytes_free $STATUSFILE | cut -d\" -f 4`
IPORTPAR2=`grep kbytes_used $STATUSFILE | cut -d\" -f 4`
IPORTPAR3="$(( $IPORTPAR1 / 100 ))"
IPORTPAR="$(( $IPORTPAR2 / $IPORTPAR3 ))"
if [ $IPORTPAR -ge $PAR_WARN ]; then
if [ $IPORTPAR -ge $PAR_CRIT ]; then
exitstatus=${STATE_CRITICAL}
echo "QueueDisk Usage CRITICAL: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
else
exitstatus=${STATE_WARNING}
echo "QueueDisk Usage WARNING: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
else
exitstatus=${STATE_OK}
echo "QueueDisk Usage OK: $IPORTPAR%" "| RESULT=$IPORTPAR%;$PAR_WARN;$PAR_CRIT;"
fi
;;
*)
print_usage
exit $STATE_OK
esac
#rm -rf $STATUSFILE
exit $exitstatus

View File

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<status build="phoebe 7.1.2-020" hostname="ironport.example.com" timestamp="20101214144744">
<birth_time timestamp="20100915115720 (90d 2h 50m 24s)"/>
<last_counter_reset timestamp="20101129092210"/>
<system status="online" />
<oldest_message secs="0" mid="0" />
<features>
<feature name="Virus Outbreak Filters" time_remaining="80353470" />
<feature name="IronPort Email Encryption" time_remaining="80353469" />
<feature name="IronPort Anti-Spam" time_remaining="80353469" />
<feature name="RSA Email Data Loss Prevention" time_remaining="80353468" />
<feature name="Sophos" time_remaining="80353468" />
<feature name="Central Mgmt" time_remaining="80353469" />
</features>
<counters>
<counter name="inj_msgs"
reset="86"
uptime="339"
lifetime="339" />
<counter name="inj_recips"
reset="95"
uptime="366"
lifetime="366" />
<counter name="gen_bounce_recips"
reset="0"
uptime="4"
lifetime="4" />
<counter name="rejected_recips"
reset="4"
uptime="402"
lifetime="402" />
<counter name="dropped_msgs"
reset="0"
uptime="2"
lifetime="2" />
<counter name="soft_bounced_evts"
reset="0"
uptime="0"
lifetime="0" />
<counter name="completed_recips"
reset="98"
uptime="367"
lifetime="367" />
<counter name="hard_bounced_recips"
reset="0"
uptime="4"
lifetime="4" />
<counter name="dns_hard_bounced_recips"
reset="0"
uptime="1"
lifetime="1" />
<counter name="5xx_hard_bounced_recips"
reset="0"
uptime="3"
lifetime="3" />
<counter name="filter_hard_bounced_recips"
reset="0"
uptime="0"
lifetime="0" />
<counter name="expired_hard_bounced_recips"
reset="0"
uptime="0"
lifetime="0" />
<counter name="other_hard_bounced_recips"
reset="0"
uptime="0"
lifetime="0" />
<counter name="delivered_recips"
reset="95"
uptime="332"
lifetime="332" />
<counter name="deleted_recips"
reset="3"
uptime="31"
lifetime="31" />
<counter name="global_unsub_hits"
reset="0"
uptime="0"
lifetime="0" />
</counters>
<current_ids
message_id="772"
injection_conn_id="1699"
delivery_conn_id="284" />
<rates>
<rate name="inj_msgs"
last_1_min="0"
last_5_min="12"
last_15_min="8" />
<rate name="inj_recips"
last_1_min="0"
last_5_min="24"
last_15_min="12" />
<rate name="soft_bounced_evts"
last_1_min="0"
last_5_min="0"
last_15_min="0" />
<rate name="completed_recips"
last_1_min="0"
last_5_min="24"
last_15_min="12" />
<rate name="hard_bounced_recips"
last_1_min="0"
last_5_min="0"
last_15_min="0" />
<rate name="delivered_recips"
last_1_min="0"
last_5_min="24"
last_15_min="12" />
</rates>
<gauges>
<gauge name="ram_utilization" current="1" />
<gauge name="total_utilization" current="1" />
<gauge name="cpu_utilization" current="1" />
<gauge name="av_utilization" current="0" />
<gauge name="case_utilization" current="0" />
<gauge name="bm_utilization" current="0" />
<gauge name="disk_utilization" current="0" />
<gauge name="resource_conservation" current="0" />
<gauge name="log_used" current="1" />
<gauge name="log_available" current="183G" />
<gauge name="conn_in" current="0" />
<gauge name="conn_out" current="0" />
<gauge name="active_recips" current="0" />
<gauge name="unattempted_recips" current="0" />
<gauge name="attempted_recips" current="0" />
<gauge name="msgs_in_work_queue" current="0" />
<gauge name="dests_in_memory" current="4" />
<gauge name="kbytes_used" current="0" />
<gauge name="kbytes_free" current="8388608" />
<gauge name="msgs_in_quarantine" current="0" />
<gauge name="kbytes_in_quarantine" current="0" />
<gauge name="log_used" current="1" />
<gauge name="reporting_utilization" current="0" />
<gauge name="quarantine_utilization" current="0" />
</gauges>
</status>

View File

@ -1,5 +1,5 @@
command[check_rhcs]=/usr/lib64/nagios/plugins/check_rhcs -H rek-oraheart-p04 -c
command[check_rhcs_service]=/usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$'
command[check_rhcs]=sudo /usr/lib64/nagios/plugins/check_rhcs -H rek-oraheart-p04 -c
command[check_rhcs_service]=sudo /usr/lib64/nagios/plugins/check_rhcs -s '$ARG1$'
command[get_rhcs_fencing]=test ! -p /tmp/fence_manual.fifo
command[check_rhcs_fencing]=/usr/lib64/nagios/plugins/check_rhcs_manualfencing.sh
@ -12,4 +12,5 @@ command[get_rhcs_cman_group_rgmanager]=/sbin/group_tool ls 1 rgmanager
command[check_rhcs_cman_group]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level '$ARG1$' --group '$ARG2$'
command[check_rhcs_cman_group_default]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level 0 --group default
command[check_rhcs_cman_group]_rgmanager=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level 1 --group rgmanager
command[check_rhcs_cman_group_rgmanager]=/usr/lib64/nagios/plugins/check_rhcs_cman_group.sh --level 1 --group rgmanager

View File

@ -54,7 +54,7 @@ done
# We we are not checking localhost, lets get remote uptime via NRPE
if [ "$HOSTN" != "localhost" ]; then
export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins
export PATH=$PATH:/usr/lib/nagios/plugins:/usr/lib64/nagios/plugins:/nagios/usr/lib/nagios/plugins
CHECK_COMMAND="check_nrpe -H $HOSTN -c get_uptime"
fi