SNMP OID information of Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: SNMP OID information of Nagios XI

Post by phyo »

sreinhardt wrote:restart snmptt - service snmptt restart
Make the service on your remote nagios system send an OK and a critical trap for the service we have been working with(user count).
Disable debugging, just revert the lines above, and send me the two debugging log files please.
Hi sreinhardt,

I have tested what you said. Below link is the debug file.

Code: Select all

https://db.tt/2jeh2p9n
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: SNMP OID information of Nagios XI

Post by slansing »

What is the output of:

Code: Select all

ll /var/log/snmptt/
The permissions may be incorrect as it does not look like the correct debugging information is being logged. Was that all that was in that file? Lets leave debugging on for a bit longer and send us another copy on a few hours along with the above command's output.
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: SNMP OID information of Nagios XI

Post by phyo »

slansing wrote:What is the output of:

Code: Select all

ll /var/log/snmptt/
The permissions may be incorrect as it does not look like the correct debugging information is being logged. Was that all that was in that file? Lets leave debugging on for a bit longer and send us another copy on a few hours along with the above command's output.
Here is the permission of /var/log/snmptt

Code: Select all

[root@centos6 snmptt]# ll /var/log/snmptt
total 220
-rw-r--r-- 1 snmptt root 136489 Jul 10 13:53 snmptt.debug
-rw-r--r-- 1 root   root  10136 Jul 10 13:52 snmptthandler.debug
-rw-rw-r-- 1 snmptt root  30660 Jul 10 13:52 snmptt.log
-rw-r--r-- 1 root   root  26112 Jul 10 13:40 snmpttsystem.log
[root@centos6 snmptt]#
And you can download the debug files from below link.

Code: Select all

https://db.tt/eT5qHt74
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: SNMP OID information of Nagios XI

Post by slansing »

Okay, lets try this, open:

Code: Select all

/usr/local/bin/snmptraphandling.py
Under 'def ger_return_code(severity):' right after this line:

Code: Select all

    elif severity == "MINOR":
        return_code = "1"
Add this:

Code: Select all

    elif severity >= "0" and severity <= "3":
        return_code = severity
Make sure you use spaces and not tabs to indent it, the first elif line should be 4 spaces, the return code line should be 8, so it should look like the preceding line. You should come out with this:

Code: Select all

def get_return_code(severity):
    severity = severity.upper()
    if severity == "INFORMATIONAL":
        return_code = "0"
    elif severity == "NORMAL":
        return_code = "0"
    elif severity == "SEVERE":
        return_code = "2"
    elif severity == "MAJOR":
        return_code = "2"
    elif severity == "CRITICAL":
        return_code = "2"
    elif severity == "WARNING":
        return_code = "1"
    elif severity == "MINOR":
        return_code = "1"
    elif severity >= "0" and severity <= "3":
        return_code = severity
    else:
        printusage()


...etc ad nauseam


Then, you will need to change line 53 in your snmptt.xi.conf file from:

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$9" "$@" "$-*" "The service $*"
To:

Code: Select all

EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$11" "$@" "$-*" "The service $*"
And issue:

Code: Select all

service snmptt restart
Lets see if that does the trick.
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: SNMP OID information of Nagios XI

Post by phyo »

Hi slansing,
After changing what you said, the SNMP Trap Status is not update/change anymore.
Current user status of Nagios-Main is critical. But in the status information of SNMP Trap didn't update to current state. Actually I received service critical in the log file.
(same situation with #9 in this topic)
When I change back to previous configuration, the status information of SNMP Traps show as what we received.

Thanks.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: SNMP OID information of Nagios XI

Post by sreinhardt »

Which portions did you change back? One thing you can do, is implement these steps separately. Let's do the snmptt.conf changes first, then we can see about altering snmptraphandler.py. Also when you did make these changes, were any traps coming in, or just this one that was not working?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: SNMP OID information of Nagios XI

Post by phyo »

sreinhardt wrote:Which portions did you change back? One thing you can do, is implement these steps separately. Let's do the snmptt.conf changes first, then we can see about altering snmptraphandler.py. Also when you did make these changes, were any traps coming in, or just this one that was not working?
First of all, I changed everything as you mention on previous post. After that I restart the snmptt service. Then we can't see the updated SNMP Trap in the Naigosxi Web interface. But I can confirm that we still received the SNMP trap by checking manually the snmptt.log log file.

After changing back to original setting, we can see the updated SNMP Trap in the Nagiosxi Web interface.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: SNMP OID information of Nagios XI

Post by slansing »

We're going to lock this thread as it looks like you have a ticket open, rather than spending potentially double the amount of time going at this from two directions (not to mention the possible confusion that would ensue) we're going to move to that ticket alone, myself, sreinhart, and tmcdonald will be helping through it. We can get a remote session going tomorrow to dive in.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SNMP OID information of Nagios XI

Post by Box293 »

Hi Phyo,
I've already sent you this information via our ticketing system but I wanted to also post it here as the solution will be helpful to others.

I have worked out how to make the service state change on the SNMP Receiving Nagios XI server.
Basically we need to create an EVENT for each state type and a MATCH statement so it know which EVENT to use.

Here is a link to the documentation from which I was able to find your solution:
http://snmptt.sourceforge.net/docs/snmp ... ile-format

Below is taken from the test system I setup to re-create your testing scenario.


Hosts:
In the smnptt.conf file you need to create two identical EVENTs with a corresponding MATCH statement so it will use this trap when the host state 0 or 1 is received.

The only difference in each three events is the 1st and 4th lines:
"Host Up"
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Normal
MATCH $2: 0

"Host Down or Unreachable"
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Critical
MATCH $2: 1

Code: Select all

EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Normal
FORMAT The SNMP trap that is generated as a result of an event with the host $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the host $*"
MATCH $2: 0
SDESC
The SNMP trap that is generated as a result of an event with the host
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nHostStateType
  4: nHostAttempt
  5: nHostDurationSec
  6: nHostGroupName
  7: nHostLastCheck
  8: nHostLastChange
  9: nHostOutput
EDESC
#
#
#
EVENT nHostEvent .1.3.6.1.4.1.20006.1.5 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the host $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the host $*"
MATCH $2: 1
SDESC
The SNMP trap that is generated as a result of an event with the host
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nHostStateType
  4: nHostAttempt
  5: nHostDurationSec
  6: nHostGroupName
  7: nHostLastCheck
  8: nHostLastChange
  9: nHostOutput
EDESC

Services:
In the smnptt.conf file you need to create four identical EVENTs with a corresponding MATCH statement so it will use this trap when the service state 0, 1, 2 or 3 is received.

The only difference in each three events is the 1st and 4th lines:
"Ok State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Normal
MATCH $3: 0

"Warning State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Warning
MATCH $3: 1

"Critical State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
MATCH $3: 2

"Unknown State"
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
MATCH $3: 3

Code: Select all

EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Normal
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 0
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nSvcDesc
  4: nSvcStateID
  5: nSvcAttempt
  6: nSvcDurationSec
  7: nSvcGroupName
  8: nSvcLastCheck
  9: nSvcLastChange
  10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Warning
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 1
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nSvcDesc
  4: nSvcStateID
  5: nSvcAttempt
  6: nSvcDurationSec
  7: nSvcGroupName
  8: nSvcLastCheck
  9: nSvcLastChange
  10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 2
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nSvcDesc
  4: nSvcStateID
  5: nSvcAttempt
  6: nSvcDurationSec
  7: nSvcGroupName
  8: nSvcLastCheck
  9: nSvcLastChange
  10: nSvcOutput
EDESC
#
#
#
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Critical
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $3: 3
SDESC
The SNMP trap that is generated as a result of an event with the service
in Nagios.
Variables:
  1: nHostname
  2: nHostStateID
  3: nSvcDesc
  4: nSvcStateID
  5: nSvcAttempt
  6: nSvcDurationSec
  7: nSvcGroupName
  8: nSvcLastCheck
  9: nSvcLastChange
  10: nSvcOutput
EDESC
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked