TECHZEN Zenoss User Community ARCHIVE  

Two or more SNMP templates and custom SNMP port configuration per template on pa ...

Subject: Two or more SNMP templates and custom SNMP port configuration per template on particular device
Author: Wielebny
Posted: 2017-12-21 16:30

Hello

I'm trying to apply SquidMon template to a server, which already has few working SNMP templates on default port 161. Definition of this port number is stored in "Configuration Properties" -> "zSnmpPort" field.
Squid server has it's own SNMP monitoring port number which is 3401. I don't know where should I save this port number for this template (SquidMon) on particular device. I'm using Core 4.2.5

Any links, hints?

thanks

------------------------------
Wielebny
------------------------------


Subject: RE: Two or more SNMP templates and custom SNMP port configuration per template on particular device
Author: Jane Curry
Posted: 2017-12-21 17:02

Hmm - that isn't an easy one.  Zenoss has a fairly firm assumption that if you are using snmp to a device then you will use the same parameters _ SNMP version, communities, port, etc - for all SNMP communication to that device.

If you are not talking about getting lots of data from lots of squid systems using snmp, you might consider writing a template of type COMMAND, rather than SNMP, and then in the command you run an snmpwalk or snmpget command, supplying the appropriate parameters.

Cheers,
Jane

------------------------------
Jane Curry
Skills 1st United Kingdom
jane.curry@skills-1st.co.uk
------------------------------


Subject: RE: Two or more SNMP templates and custom SNMP port configuration per template on particular device
Author: Wielebny
Posted: 2017-12-21 18:12

Allright, I have to consider COMMAND then.

Thanks for your clarification!

------------------------------
Wielebny
------------------------------


Subject: RE: Two or more SNMP templates and custom SNMP port configuration per template on particular device
Author: Jane Curry
Posted: 2017-12-23 04:52

Here is a sample that i wrote some years back - may help.  I wanted several SNMP values so wrote a script, getPowerValues.sh,  to do the work, taking parameters from the COMMAND performance template (the  ${here/manageIp} ${here/zSnmpCommunity} ${here/zSnmpVer}  - see the comments at the top of the script.

This was part of a ZenPack and you probably dont need to get that complicated so, if you want a script rather than putting everything directly into the COMMAND template, just put the script into $ZENHOME/libexec and use the command name at the start of your COMMAND template rather than my complicated ${here/ZenPackManager/packs/ZenPacks.ZenSystems.olsonPower/path}/lib/getPowerValues.sh.

#!/bin/bash
###############################################################################################
# Author: Jane Curry
# Date Jan 26th 2011
# Revised:
#
# Shellscript to use individual snmpget commands to get
# voltage, current, power, energy and temperature from Olson power meters
# Note that all values are delivered as DisplayStrings so an SNMP template
# cannot be used.
# host is first parameter; communty name is second parameter: version is third parameter
#
# Driven by olson_power command performance template
# ${here/ZenPackManager/packs/ZenPacks.ZenSystems.olsonPower/path}/lib/getPowerValues.sh ${here/manageIp} ${here/zSnmpCommunity} ${here/zSnmpVer}
#
###############################################################################################
#set -x
# Get voltage OID - comes in format "232.5"
# so convert from string to integer with bc utility

volts=$(/usr/bin/snmpget -$3 -c $2 -O qvU $1 1.3.6.1.4.1.17933.1.1.19 2>/dev/null)
volts=$(echo $volts | bc -l 2>/dev/null)

amps=$(/usr/bin/snmpget -$3 -c $2 -O qvU $1 1.3.6.1.4.1.17933.1.1.20 2>/dev/null)
amps=$(echo $amps | bc -l 2>/dev/null)

power=$(/usr/bin/snmpget -$3 -c $2 -O qvU $1 1.3.6.1.4.1.17933.1.1.21 2>/dev/null)
power=$(echo $power | bc -l 2>/dev/null)

energy=$(/usr/bin/snmpget -$3 -c $2 -O qvU $1 1.3.6.1.4.1.17933.1.1.22 2>/dev/null)
energy=$(echo $energy | bc -l 2>/dev/null)

temp=$(/usr/bin/snmpget -$3 -c $2 -O qvU $1 1.3.6.1.4.1.17933.1.1.24 2>/dev/null)
temp=$(echo $temp | bc -l 2>/dev/null)

if [ -n "$volts" ]
then
echo "OK|voltage=$volts current=$amps power=$power energy=$energy temp=$temp"
else echo "Unknown"
fi


Hope that helps,
Jane

------------------------------
Jane Curry
Skills 1st United Kingdom
jane.curry@skills-1st.co.uk
------------------------------


< Previous
Uploading new MIBs to Zenoss
  Next
New Zenoss Installation, an help to choose right version?
>