Hello!
I have an Online UPS with snmp module.
I have added the Host and a Service successfully and can get all data with snmpwalk:
root@nagivis:~# snmpwalk -v3 -u (user)-m /usr/share/snmp/mibs/UPS-MIB.txt 192.168.151.195 1.3.6.1.2.1.33.1.2.1
UPS-MIB::upsBatteryStatus.0 = INTEGER: batteryNormal(2)
In the webgui the status of the service is ok, but the "Status Information" states jsut (No output on stdout) stderr: Configuration directives understood:
The command is:
define command{
command_name check_ups_battery
command_line /usr/bin/snmpwalk -v3 -m /usr/share/snmp/mibs/UPS-MIB.txt -H 192.168.151.195 -u (user) -t 360 iso.1.3.6.1.2.1.33.1.2.1
}
I found in the web that nagios cand translate the output of the content of the status infos and i have to use a plugin like SNMPTT.
I followed the original guide: http://www.snmptt.org/docs/snmptt.shtml#Nagios-Netsaint
but im a little clueless at the part where you Create an EXEC statement such as the following for each EVENT entry in the snmptt.conf file like this:
EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $r TRAP 1 "xxxxxx"
In the example they used somethink like what you could get from the snmpwalk: "Drive $1 in bay $2 has failed".
My gut tells me to use for me"batteryNormal"
Im rather helpless with the part after this where do i get the variables - the mib file?
do i have to use any variables?
I want to add those 4:
root@nagivis:~# snmpwalk -v3 -u (user) -m /usr/share/snmp/mibs/UPS-MIB.txt 192.168.151.195 1.3.6.1.2.1.33.1.2.1
UPS-MIB::upsBatteryStatus.0 = INTEGER: batteryNormal(2)
root@nagivis:~# snmpwalk -v3 -u (user) -m /usr/share/snmp/mibs/UPS-MIB.txt 192.168.151.195 1.3.6.1.2.1.33.1.2.3
UPS-MIB::upsEstimatedMinutesRemaining.0 = INTEGER: 999 minutes
root@nagivis:~# snmpwalk -v3 -u (user) -m /usr/share/snmp/mibs/UPS-MIB.txt 192.168.151.195 1.3.6.1.2.1.33.1.2.4
UPS-MIB::upsEstimatedChargeRemaining.0 = INTEGER: 100 percent
root@nagivis:~# snmpwalk -v3 -u (user) -m /usr/share/snmp/mibs/UPS-MIB.txt 192.168.151.195 1.3.6.1.2.1.33.1.2.7
UPS-MIB::upsBatteryTemperature.0 = INTEGER: 16 degrees Centigrade
Im not an linux/nagios pro so could you give me a hint how i can configure the Nagios correct?
I would really appreciate it.
Thank you in advance!
snmpttconvertmib and ups monitoring
Re: snmpttconvertmib and ups monitoring
Thanks for reaching out @madadmin,
This documentation is for Nagios XI but I believe some of it will apply to your case.
https://assets.nagios.com/downloads/nag ... ios_XI.pdf
I would pay particular attention to the "Defining Traps In snmptt.conf" section. Tell me if this helps or if you need further assistance.
This documentation is for Nagios XI but I believe some of it will apply to your case.
https://assets.nagios.com/downloads/nag ... ios_XI.pdf
I would pay particular attention to the "Defining Traps In snmptt.conf" section. Tell me if this helps or if you need further assistance.
Re: snmpttconvertmib and ups monitoring
Thank you @danderson,
now i can understand how everything fuctions - i just want to use a plugin - so i dont have to set everything in the snmptt conf manually.
http://www.snmptt.org/docs/snmpttconvertmib.shtml
I used the snmpttconvertmib Script is - the problem is that it generated just 4 entrys, which all are wrong assoitiated like this:
EVENT upsTrapAlarmEntryAdded .1.3.6.1.2.1.33.2.3 "Status Events" Normal
FORMAT This trap is sent each time an alarm is inserted into $*
SDESC
This trap is sent each time an alarm is inserted into
to the alarm table. It is sent on the insertion of
all alarms except for upsAlarmOnBattery and
upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
the id with the .3 at the end is estimated Minutes remaining.
How does the Skript know which ids to use?
I found a guide which states you have to "register" the mib to the nagios via addmib like this:
find /usr/share/snmp/mibs/Cisco-SG200-300 -maxdepth 1 -type f -exec addmib {} \;
Do i have to add it too? the guide is from 2016.
Thank you!
Happy New Year! Wishing you a year filled with health, happiness, and success.
now i can understand how everything fuctions - i just want to use a plugin - so i dont have to set everything in the snmptt conf manually.
http://www.snmptt.org/docs/snmpttconvertmib.shtml
I used the snmpttconvertmib Script is - the problem is that it generated just 4 entrys, which all are wrong assoitiated like this:
EVENT upsTrapAlarmEntryAdded .1.3.6.1.2.1.33.2.3 "Status Events" Normal
FORMAT This trap is sent each time an alarm is inserted into $*
SDESC
This trap is sent each time an alarm is inserted into
to the alarm table. It is sent on the insertion of
all alarms except for upsAlarmOnBattery and
upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
the id with the .3 at the end is estimated Minutes remaining.
How does the Skript know which ids to use?
I found a guide which states you have to "register" the mib to the nagios via addmib like this:
find /usr/share/snmp/mibs/Cisco-SG200-300 -maxdepth 1 -type f -exec addmib {} \;
Do i have to add it too? the guide is from 2016.
Thank you!
Happy New Year! Wishing you a year filled with health, happiness, and success.
Last edited by madadmin on Tue Jan 02, 2024 5:00 am, edited 2 times in total.
Re: snmpttconvertmib and ups monitoring
Im stilrather stuck with my understandingin one step ahead of the snmptconvertmib - how to set the traps correct
I dont get how to set the snmptt ini:
I want to get this Value:
snmptrap -v 3 -u (user) -l noAuthNoPriv -n "" 192.168.151.195 '' UPS-MIB::upsBatteryTemperature.0
The value from the mib:
and:
And here the generated snmptt conf:
I dont get how to set the snmptt ini:
I want to get this Value:
snmptrap -v 3 -u (user) -l noAuthNoPriv -n "" 192.168.151.195 '' UPS-MIB::upsBatteryTemperature.0
The value from the mib:
Code: Select all
upsBatteryTemperature OBJECT-TYPE
SYNTAX Integer32
UNITS "degrees Centigrade"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The ambient temperature at or near the UPS Battery
casing."
::= { upsBattery 7 }
and:
Code: Select all
upsFullCompliance MODULE-COMPLIANCE
STATUS current
DESCRIPTION
"The compliance statement for UPSs that support
advanced full-featured functions."
MODULE -- this module
MANDATORY-GROUPS { upsFullIdentGroup, upsFullBatteryGroup,
upsFullInputGroup, upsFullOutputGroup,
upsFullAlarmGroup, upsFullTestGroup,
upsFullControlGroup, upsFullConfigGroup }
OBJECT upsAlarmDescr
DESCRIPTION
"Support of all `well known' alarm types is not
required. The well known alarm types which must be
supported are: upsAlarmBatteryBad, upsAlarmOnBattery,
upsAlarmLowBattery, upsAlarmDepletedBattery,
upsAlarmTempBad, upsAlarmInputBad, upsAlarmOnBypass,
upsAlarmBypassBad, upsAlarmOutputOffAsRequested,
upsAlarmUpsOffAsRequested, upsAlarmUpsOutputOff,
upsAlarmUpsSystemOff, upsAlarmGeneralFault,
upsAlarmDiagnosticTestFailed,
upsAlarmCommunicationsLost, upsAlarmShutdownPending,
and upsAlarmTestInProgress."
OBJECT upsTestId
DESCRIPTION
"Support of all `well known' test types is not
required. The well known test types which must be
supported are: upsTestNoTestsInitiated,
upsTestGeneralSystemsTest, and
upsTestQuickBatteryTest."
OBJECT upsOutputSource
SYNTAX INTEGER {
normal(2),
battery(4)
}
DESCRIPTION
"Support of the values other(1), none(2), bypass(4),
booster(6) and reducer(7) is not required."
GROUP upsFullBypassGroup
DESCRIPTION
"The upsFullBypassGroup is only required for UPSs that
have a Bypass present."
OBJECT upsShutdownType
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required, i.e., compliant
systems need not support more than one shutdown type."
OBJECT upsAutoRestart
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required, i.e., compliant
systems need not support more than one restart type."
OBJECT upsConfigInputVoltage
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required."
OBJECT upsConfigInputFreq
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required."
OBJECT upsConfigOutputVoltage
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required."
OBJECT upsConfigOutputFreq
MIN-ACCESS read-only
DESCRIPTION
"Read-write access is not required."
OBJECT upsConfigLowBattTime
DESCRIPTION
"Implementation of all possible values may be onerous
for some systems. Consequently, not all possible
values must be supported. However, at least two
different manufacturer-selected values must be
supported."
::= { upsCompliances 3 }
--
-- units of conformance
--
-- summary at a glance:
-- subset basic adv
--upsIdentManufacturer x x x
--upsIdentModel x x x
--upsIdentUPSSoftwareVersion x x
--upsIdentAgentSoftwareVersion x x x
--upsIdentName x x x
--upsIdentAttachedDevices x x
--
--upsBatteryStatus x x x notes
--upsSecondsOnBattery x x x
--upsEstimatedMinutesRemaining x
--upsEstimatedChargeRemaining x
--upsBatteryVoltage
--upsBatteryCurrent
--upsBatteryTemperature
And here the generated snmptt conf:
Code: Select all
#
#
#
#
MIB: UPS-MIB (file:/usr/share/snmp/mibs/UPS-MIB.txt) converted on Tue Jan 2 10:08:56 2024 using snmpttconvertmib v1.5beta2
#
#
#
EVENT upsTrapOnBattery .1.3.6.1.2.1.33.2.1 "Status Events" Normal
FORMAT The UPS is operating on battery power. This trap is $*
SDESC
The UPS is operating on battery power. This trap is
persistent and is resent at one minute intervals until
the UPS either turns off or is no longer running on
battery.
Variables:
1: upsEstimatedMinutesRemaining
2: upsSecondsOnBattery
3: upsConfigLowBattTime
EDESC
#
#
#
EVENT upsTrapTestCompleted .1.3.6.1.2.1.33.2.2 "Status Events" Normal
FORMAT This trap is sent upon completion of a UPS diagnostic $*
SDESC
This trap is sent upon completion of a UPS diagnostic
test.
Variables:
1: upsTestId
2: upsTestSpinLock
3: upsTestResultsSummary
4: upsTestResultsDetail
5: upsTestStartTime
6: upsTestElapsedTime
EDESC
#
#
#
EVENT upsTrapAlarmEntryAdded .1.3.6.1.2.1.33.2.3 "Status Events" Normal
FORMAT This trap is sent each time an alarm is inserted into $*
SDESC
This trap is sent each time an alarm is inserted into
to the alarm table. It is sent on the insertion of
all alarms except for upsAlarmOnBattery and
upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
#
#
#
EVENT upsTrapAlarmEntryRemoved .1.3.6.1.2.1.33.2.4 "Status Events" Normal
FORMAT This trap is sent each time an alarm is removed from $*
SDESC
This trap is sent each time an alarm is removed from
the alarm table. It is sent on the removal of all
alarms except for upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
#
#
#
#
MIB: UPS-MIB (file:/usr/share/snmp/mibs/UPS-MIB.txt) converted on Tue Jan 2 11:32:00 2024 using snmpttconvertmib v1.5beta2
#
#
#
EVENT upsTrapOnBattery .1.3.6.1.2.1.33.2.1 "Status Events" Normal
FORMAT The UPS is operating on battery power. This trap is $*
SDESC
The UPS is operating on battery power. This trap is
persistent and is resent at one minute intervals until
the UPS either turns off or is no longer running on
battery.
Variables:
1: upsEstimatedMinutesRemaining
2: upsSecondsOnBattery
3: upsConfigLowBattTime
EDESC
#
#
#
EVENT upsTrapTestCompleted .1.3.6.1.2.1.33.2.2 "Status Events" Normal
FORMAT This trap is sent upon completion of a UPS diagnostic $*
SDESC
This trap is sent upon completion of a UPS diagnostic
test.
Variables:
1: upsTestId
2: upsTestSpinLock
3: upsTestResultsSummary
4: upsTestResultsDetail
5: upsTestStartTime
6: upsTestElapsedTime
EDESC
#
#
#
EVENT upsTrapAlarmEntryAdded .1.3.6.1.2.1.33.2.3 "Status Events" Normal
FORMAT This trap is sent each time an alarm is inserted into $*
SDESC
This trap is sent each time an alarm is inserted into
to the alarm table. It is sent on the insertion of
all alarms except for upsAlarmOnBattery and
upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
#
#
#
EVENT upsTrapAlarmEntryRemoved .1.3.6.1.2.1.33.2.4 "Status Events" Normal
FORMAT This trap is sent each time an alarm is removed from $*
SDESC
This trap is sent each time an alarm is removed from
the alarm table. It is sent on the removal of all
alarms except for upsAlarmTestInProgress.
Variables:
1: upsAlarmId
2: upsAlarmDescr
EDESC
Re: snmpttconvertmib and ups monitoring
I have the solution:
ny command was :
command_line /usr/bin/snmpwalk -v3 -H 192.168.151.195 -u nagios -t 360 iso.3.6.1.2.1.2.1.0
and i had to remove the -H
now everything is fine:
ny command was :
command_line /usr/bin/snmpwalk -v3 -H 192.168.151.195 -u nagios -t 360 iso.3.6.1.2.1.2.1.0
and i had to remove the -H
now everything is fine:
Re: snmpttconvertmib and ups monitoring
@madadmin,
Yes, /usr/bin/snmpwalk does not take a -H parameter and instead are formatted like this:
I believe you may have been confusing the syntax for /usr/bin/snmpwalk with the Nagios plugin /usr/local/nagios/libexec/check_snmp, which has the following syntax:
If you do want to use Nagios's check_snmp plugin, you can find more documentation here: https://nagios-plugins.org/doc/man/check_snmp.html
Yes, /usr/bin/snmpwalk does not take a -H parameter and instead are formatted like this:
Code: Select all
snmpwalk [options] [community string/authentification information] [host name/address] [OID]
Code: Select all
check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]
[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd] [--strict]
April: Actively advancing awesome answers with ardent alliteration, aptly addressing all ambiguities. Amplify your acumen and avail our amicable assistance. Eagerly awaiting your astute assessments of our advice.