Reopen (UDP port 162 is taken by sh and python)

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

Reopen (UDP port 162 is taken by sh and python)

Post by phyo »

Hi, I want to reopen the previous case UDP port 162 is taken by sh and python. Link is here.
http://support.nagios.com/forum/viewtop ... 16&t=31105

Yesterday, I noticed some of the SNMP Traps are not updated on the nagios xi web interface even though nagios received the SNMP Traps from the remote hosts. Means with new snmptraphandling.py file, some device SNMP Traps can show on the NagiosXI web interface but some or not. So I just restore the previous snmptraphandling.py file.

Thanks.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Reopen (UDP port 162 is taken by sh and python)

Post by tmcdonald »

Are there any listings in /var/log/snmptt/snmpttunknown.log?
Former Nagios employee
questrad
Posts: 160
Joined: Wed Mar 21, 2012 3:08 pm
Location: Toronto
Contact:

Re: Reopen (UDP port 162 is taken by sh and python)

Post by questrad »

As I remember I did some changes in that script based on our configuration.
If you see some of them bit dont see anothers - the script is working, it just must much following:

The host should be always in UPPERCASE.

Code: Select all

def check_arg():
        try:
                host = sys.argv[1].upper()
Also this part is changed:

Code: Select all

        try:
                if  not sys.argv[5]:
                        mondata_res = sys.argv[6]
                else:
                        mondata_res = sys.argv[6] + " / " + sys.argv[5]
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Reopen (UDP port 162 is taken by sh and python)

Post by ssax »

Are you just giving us an update or are you experiencing an issue?

Sorry, it just sounds like from the second post that everything is working and you're just informing us.
questrad
Posts: 160
Joined: Wed Mar 21, 2012 3:08 pm
Location: Toronto
Contact:

Re: Reopen (UDP port 162 is taken by sh and python)

Post by questrad »

On our Nagios configuration it working as expected.
I have just informed what kind of changes else I did in additional to handling the nagios cmd file.

If @phyo wants to handle only nagios cmd file, he can just copy and paste the part of the file handling code.
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: Reopen (UDP port 162 is taken by sh and python)

Post by phyo »

tmcdonald wrote:Are there any listings in /var/log/snmptt/snmpttunknown.log?
All the snmp trap go to /var/log/snmptt/snmptt.log file. Some SNMP trap can update on the web interface but some are not.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Reopen (UDP port 162 is taken by sh and python)

Post by ssax »

Sorry questrad, I mistakenly thought you were OP.

phyo, did you modify the file to include the file handling code and is it working for you?
phyo
Posts: 162
Joined: Sun Dec 01, 2013 10:50 pm

Re: Reopen (UDP port 162 is taken by sh and python)

Post by phyo »

ssax wrote:phyo, did you modify the file to include the file handling code and is it working for you?
Change the code as "questrad" mention?
questrad
Posts: 160
Joined: Wed Mar 21, 2012 3:08 pm
Location: Toronto
Contact:

Re: Reopen (UDP port 162 is taken by sh and python)

Post by questrad »

Take a look at the code changes that I did.
If your hosts are in upper and lower cases then you need to change following:

Code: Select all

def check_arg():
        try:
                host = sys.argv[1].upper(
To:

Code: Select all

def check_arg():
        try:
                host = sys.argv[1](
Please try this one, I think your issue is that one, because you saying that some of you get some of you dont.
Check also this log: /tmp/snmptraphandling.log if you have the SNMP from thet host that you dont see in NagiosXI.
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: Reopen (UDP port 162 is taken by sh and python)

Post by cmerchant »

phyo, did you modify the file as questrad suggested (for the upper and lower case) and is it working for you?
Locked