Page 1 of 1

define snmp in command

Posted: Mon Feb 02, 2015 7:35 am
by tmeto
Good, I'm trying to define a snmpwalk for a particular check and can not.

The purpose is to monitor the memory of a fortimail1000D and get that value alone with a snmpwalk because not found a script that worked me with that model

Would this ->


snmpwalk -c -v2c XX.XX.XX.XX comunity fmlSysMemUsage

and define it in the service and the command ....

define command {
command_name check_mem_forti2
command_line / usr / bin / snmpwalk -H $ HOSTADDRESS $ -v2c -c $ ARG1 $ fmlSysMemUsage
}

define service {
         use generic-service
         host_name XX.XX.XX.XX
         service_description check_mem_forti2
         check_command check_mem_forti2! 1XX.XX.XX.XX! comunity
         normal_check_interval 30
         retry_check_interval 10
         servicegroups group
         notification_interval 0
         }

But he gives me this error:

No output on stdout) stderr: Configuration directives understood:
No log handling enabled - turning on stderr logging
In snmpwalk.conf and snmpwalk.local.conf:
includeRequested (1
Performance Data: yes|true|0|no|false) excludeRequested (1|yes|true|0|no|false) printStatistics (1|yes|true|0|no|false) dontCheckOrdering (1|yes|true|0|no|false) timeResults (1|yes|true|0|no|false) In snmp.conf and snmp.local.conf: doDebugging (1|0) debugTokens token[,token...] logTimestamp (1|yes|true|0|no|false) mibdirs [mib-dirs|+mib-dirs|-mib-dirs] mibs [mib-tokens|+mib-tokens] mibfile mibfile-to-read showMibErrors (1|yes|true|0|no|false) strictCommentTerm (1|yes|true|0|no|false) mibAllowUnderline (1|yes|true|0|no|false) mibWarningLevel integerValue mibReplaceWithLatest (1|yes|true|0|no|false) printNumericEnums (1|yes|true|0|no|false) printNumericOids (1|yes|true|0|no|false) escapeQuotes (1|yes|true|0|no|false) dontBreakdownOids (1|yes|true|0|no|false) quickPrinting (1|yes|true|0|no|false) numericTimeticks (1|yes|true|0|no|false) oidOutputFormat integerValue suffixPrinting integerValue extendedIndex (1|yes|true|0|no|false) printHexText (1|yes|true|0|no|false) printValueOnly (1|yes|true|0|no|false) dontPrintUnits (1|yes|true|0|no|false) hexOutputLength integerValue dumpPacket (1|yes|true|0|no|false) reverseEncodeBER (1|yes|true|0|no|false) defaultPort integerValue defCommunity string noTokenWarnings (1|yes|true|0|no|false) noRangeCheck (1|yes|true|0|no|false) persistentDir string tempFilePattern string noDisplayHint (1|yes|true|0|no|false) 16bitIDs (1|yes|true|0|no|false) clientaddr string serverSendBuf integerValue serverRecvBuf integerValue clientSendBuf integerValue clientRecvBuf integerValue noPersistentLoad (1|yes|true|0|no|false) noPersistentSave (1|yes|true|0|no|false) defDomain application domain defTarget application domain target defSecurityModel string defSecurityName string defContext string defPassphrase string defAuthPassphrase string defPrivPassphrase string defAuthMasterKey string defPrivMasterKey string defAuthLocalizedKey string defPrivLocalizedKey string defVersion 1|2c|3 defAuthType MD5|SHA defPrivType DES|AES defSecurityLevel noAuthNoPriv|authNoPriv|authPriv In snmpapp.conf and snmpapp.local.conf: defDomain application domain defTarget application domain target engineID string engineIDType num engineIDNic string)

how can i make it work?

Re: define snmp in command

Posted: Mon Feb 02, 2015 10:48 am
by tmcdonald
This will not work because snmpwalk does not produce output that is in a Nagios-compatible format. An intermediary script that interprets the snmpwalk output and correctly formats it will be needed. The documentation regarding the proper format is here:

https://nagios-plugins.org/doc/guidelines.html

Re: define snmp in command

Posted: Mon Feb 02, 2015 11:15 am
by tmeto
tmcdonald wrote:This will not work because snmpwalk does not produce output that is in a Nagios-compatible format. An intermediary script that interprets the snmpwalk output and correctly formats it will be needed. The documentation regarding the proper format is here:

https://nagios-plugins.org/doc/guidelines.html

Thanks, I'll try that too, but I think it may be something else. I changed the commands file and see this.

define command {
command_name check_mem_forti2
command_line /usr/bin/snmpwalk $HOSTADDRESS$ -v2c -c $ARG1$ fmlSysMemUsage
}

and this is the error -> says that the host does not respond but I will certainly respond.

Current Status: WARNING (for 0d 0h 22m 11s)
Status Information: (No output on stdout) stderr: Timeout: No Response from XX.XX.XX.XX

Re: define snmp in command

Posted: Mon Feb 02, 2015 11:47 am
by tmeto
I read the link that passes but I've stayed the same ... I'm clear that, "As Nagios does not capture stderr output, You should only output to STDOUT and STDERR to not print."
But as I turn on one another?

The result of a simple snmpwalk to that machine is:
---
FORTINET-FortiMail-MIB :: fmlSysMemUsage.0 = Gauge32 11
---

11 The value that I want to monitor.

Re: define snmp in command

Posted: Mon Feb 02, 2015 12:42 pm
by scottwilkerson
How about changing the command to something like

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -P 2c -o fmlSysMemUsage.0

Re: define snmp in command

Posted: Tue Feb 03, 2015 5:56 am
by tmeto
scottwilkerson wrote:How about changing the command to something like

Code: Select all

$USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -P 2c -o fmlSysMemUsage.0
yes!!!!!!! much easier than I thought! thankssssssss!

even so, I've learned a lot messing with other scripts and trying to make things ...

Re: define snmp in command

Posted: Tue Feb 03, 2015 10:07 am
by tmcdonald
tmeto wrote:even so, I've learned a lot messing with other scripts and trying to make things ...
Any day you learn something new is a good day indeed :)

I'll be closing this thread now, but feel free to open another if you need anything in the future!