Files
openstack-helm-images/nagios/plugins/send_host_trap.sh
Steve Wilkerson e1a1faec28 Nagios: Make scripts and plugins executable
This updates the entrypoint script and the plugins included with
the nagios image executable

Change-Id: Iaeb2fad62ac213b74637dadc329e7ea304602ab8
Signed-off-by: Steve Wilkerson <sw5822@att.com>
2019-06-26 17:35:55 -05:00

30 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Arguments:
# $1 = Community String
# $2 = host_name
# $3 = HostStatID A number that corresponds to the current state of the host: 0=UP, 1=DOWN, 2=UNREACHABLE.
# $4 = HOSTOUTPUT The first line of text output from the last host check (i.e. "Ping OK").
# $5 = snmp collector primary IP with port
# $6 = snmp collector standby IP with port
#
# Invokes /usr/bin/snmptrap binary to send a snmp trap with the following
# invocation signature example for the primary snmp collector with port:
# /usr/bin/snmptrap -v 2c -c "$1" "$5" '' NAGIOS-NOTIFY-MIB::nHostEvent nHostname s "$2" nHostStateID i $3 nHostOutput s "$4"
export SNMP_PERSISTENT_DIR="/tmp"
if [ ! -z "$5" ]; then
/usr/bin/snmptrap -v 2c -c "$1" "$5" '' NAGIOS-NOTIFY-MIB::nHostEvent \
nHostname s "$2" \
nHostStateID i $3 \
nHostOutput s "$4"
if [ ! -z "$6" ]; then
/usr/bin/snmptrap -v 2c -c "$1" "$6" '' NAGIOS-NOTIFY-MIB::nHostEvent \
nHostname s "$2" \
nHostStateID i $3 \
nHostOutput s "$4"
fi
fi