1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
:

This is a small server plugin developed for Pandora FMS v3.0 that enables creation of Pandora plugin modules to work with snmp protocol version 1 and 2c.

Module data

#!/bin/bash
######################################################
# snmpget remote plugin for Pandora FMS Server
# Developed by Miguel Sanz (2009)
#
# 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; version 2
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
######################################################



# Default values
HOST=""
PORT=161
COMMUNITY="public"
VERSION=""
OID=""

function help {
echo -e "snmpget remote Plugin for Pandora FMS Plugin server"
echo -e "Syntax:"
echo -e "\t\t-h host"
echo -e "\t\t-p port (by default 161)"
echo -e "\t\t-c community"
echo -e "\t\t-v version (1 or 2c)"
echo -e "\t\t-o OID\n"
echo -e "Samples:"
echo " ./snmpget_plugin.sh -h 192.168.0.51 -p 161 -c public -v 1 -o 1.3.6.1.4.1.1.4988.1303.1.0"
echo " ./snmpget_plugin.sh -h localhost -c public -v 2c -o sysDescr.0"
echo " ./snmpget_plugin.sh -h 192.168.0.101 -p 166 -c public -v 2c -o 1.3.6.1.4.1.1.4988.1303.1.0"
echo " ./snmpget_plugin.sh -h 192.168.0.101 -p 166 -c public -v 2c -o 1.3.6.1.4.1.1.4988.1303.1.0"
echo ""
exit
}


if [ $# -eq 0 ]
then
help
fi

# Main parsing code

while getopts ":h:p:c:v:o:" optname
do
case "$optname" in
"h")
HOST=$OPTARG
;;
"p")
PORT=$OPTARG
;;
"c")
COMMUNITY=$OPTARG
;;
"v")
VERSION=$OPTARG
;;
"o")
OID=$OPTARG
;;
?)
help
;;
default)
help
;;
esac
done

# if PORT=0 change to PORT=161

if [ $PORT -eq 0 ]
then
PORT=161
fi

# Execution

snmpget $HOST:$PORT -c $COMMUNITY -v $VERSION -O Uevqt $OID

Files:

snmpget_plugin.sh

(Visited 119 times, 1 visits today)