Was trying to use snmptrapd for the first time in years. Incoming traps generates this error:
2024-10-30 11:00:25,287 [ERROR] [zen.pynetsnmp.callback] Exception in _callback invalid input syntax for type inet: "None" LINE 1: ... LEFT JOIN gwportprefix USING (interfaceid) WHERE 'None' IN ... ^ Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pynetsnmp/netsnmp.py", line 464, in _callback sess.callback(pdu.contents) File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/agent_pynetsnmp.py ", line 221, in callback self._callback(addr, pdu) File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/agent_pynetsnmp.py ", line 130, in callback self._client_callback(trap) File "/usr/local/lib/python3.9/site-packages/nav/bin/snmptrapd.py", line 234, in trap_handler _log_trap_handle_result(handled_by, trap) File "/usr/local/lib/python3.9/site-packages/nav/bin/snmptrapd.py", line 239, in _log_trap_handle_result trap.netbox.sysname + ' ({})'.format(trap.agent) if trap.netbox else trap.agent File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/trap.py", line 87, in netbox setattr(self, '_netbox', self._lookup_agent()) File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/trap.py", line 67, in _lookup_agent cur.execute( psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type inet: "None" LINE 1: ... LEFT JOIN gwportprefix USING (interfaceid) WHERE 'None' IN ... ^
2024-10-30 11:02:07,171 [ERROR] [zen.pynetsnmp.callback] Exception in _callback current transaction is aborted, commands ignored until end of transaction block Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/pynetsnmp/netsnmp.py", line 464, in _callback sess.callback(pdu.contents) File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/agent_pynetsnmp.py ", line 221, in callback self._callback(addr, pdu) File "/usr/local/lib/python3.9/site-packages/nav/snmptrapd/agent_pynetsnmp.py ", line 130, in callback self._client_callback(trap) File "/usr/local/lib/python3.9/site-packages/nav/bin/snmptrapd.py", line 207, in trap_handler connection = getConnection('default') File "/usr/local/lib/python3.9/site-packages/nav/db/__init__.py", line 170, in getConnection _connection_cache.invalidate() File "/usr/local/lib/python3.9/site-packages/nav/__init__.py", line 55, in invalidate if self[key].is_invalid(): File "/usr/local/lib/python3.9/site-packages/nav/db/__init__.py", line 57, in is_invalid if self.ping(): File "/usr/local/lib/python3.9/site-packages/nav/db/__init__.py", line 77, in ping cursor.execute('SELECT 1') psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block
The incoming traps does not have any corresponding handler (yet), but I was expecting the code to handle unknown traps without barfing.
--Ingeborg
On Wed 30 Oct 2024 at 11:09, Ingeborg Hellemo ingeborg.hellemo@uit.no wrote:
Was trying to use snmptrapd for the first time in years. Incoming traps generates this error:
2024-10-30 11:00:25,287 [ERROR] [zen.pynetsnmp.callback] Exception in _callback invalid input syntax for type inet: "None" LINE 1: ... LEFT JOIN gwportprefix USING (interfaceid) WHERE 'None' IN ...
Hi Ingeborg,
would you be able to expound on what kind of trap you are sending? The error you posted shows that snmptrapd fails miserably as it tries to identify which Netbox sent the alert, because the received trap somehow has nothing identifying the sender's IP address...
morten.brekkevold@sikt.no said:
would you be able to expound on what kind of trap you are sending? The error you posted shows that snmptrapd fails miserably as it tries to identify which Netbox sent the alert, because the received trap somehow has nothing identifying the sender's IP address...
It is traps from a PaloAlto firewall. Now that I know what I am looking for, I realise that the trap only contains OIDs from the panTrapMibsModule (.1.3.6.1.4.1.25461.1.1.5) which NAV knows nothing about.
I will try something else.
--Ingeborg
On Thu 31 Oct 2024 at 10:45, Ingeborg Hellemo ingeborg.hellemo@uit.no wrote:
It is traps from a PaloAlto firewall. Now that I know what I am looking for, I realise that the trap only contains OIDs from the panTrapMibsModule (.1.3.6.1.4.1.25461.1.1.5) which NAV knows nothing about.
That shouldn't matter. Which SNMP version are these traps using?
v2c
--
Børge Brunes, Faggruppeleder Tilkobling og nettverk
Avdeling for IT (ITA), UiT Norges arktiske universitet
epost/sip: borge.brunes@uit.no
Tel: +47tel:+47 77644113
________________________________ Fra: Morten Brekkevold morten.brekkevold@sikt.no Sendt: fredag 1. november 2024 15:34 Til: Ingeborg Østrem Hellemo ingeborg.hellemo@uit.no Kopi: nav-users@lister.sikt.no nav-users@lister.sikt.no Emne: [Nav-users] Re: Error in snmptrapd
On Thu 31 Oct 2024 at 10:45, Ingeborg Hellemo ingeborg.hellemo@uit.no wrote:
It is traps from a PaloAlto firewall. Now that I know what I am looking for, I realise that the trap only contains OIDs from the panTrapMibsModule (.1.3.6.1.4.1.25461.1.1.5) which NAV knows nothing about.
That shouldn't matter. Which SNMP version are these traps using?
-- Sincerely, Morten Brekkevold
Sikt – Norwegian Agency for Shared Services in Education and Research _______________________________________________ Nav-users mailing list -- nav-users@lister.sikt.no To unsubscribe send an email to nav-users-leave@lister.sikt.no
On Sun 03 Nov 2024 at 12:39, Børge Brunes borge.brunes@uit.no wrote:
v2c
The reason I ask is that snmptrapd's behavior in the case of SNMP v3 is still undefined.
The IP address of the sender is extracted from the transport data in the PDU data structure as presented by the Net-SNMP library whenever a trap comes in.
So other pertinent questions would be: Which version of Net-SNMP are you using? Is the sender using IPv4 or IPv6?
Hi Morten,
We are using net-snmp v5.9.4 and the sender is using IPv4
--
Børge Brunes, Faggruppeleder Tilkobling og nettverk
Avdeling for IT (ITA), UiT Norges arktiske universitet
epost/sip: borge.brunes@uit.no
Tel: +47tel:+47 77644113
________________________________ Fra: Morten Brekkevold morten.brekkevold@sikt.no Sendt: mandag 4. november 2024 11:40 Til: Børge Brunes borge.brunes@uit.no Kopi: Ingeborg Østrem Hellemo ingeborg.hellemo@uit.no; nav-users@lister.sikt.no nav-users@lister.sikt.no Emne: Re: [Nav-users] Re: Error in snmptrapd
On Sun 03 Nov 2024 at 12:39, Børge Brunes borge.brunes@uit.no wrote:
v2c
The reason I ask is that snmptrapd's behavior in the case of SNMP v3 is still undefined.
The IP address of the sender is extracted from the transport data in the PDU data structure as presented by the Net-SNMP library whenever a trap comes in.
So other pertinent questions would be: Which version of Net-SNMP are you using? Is the sender using IPv4 or IPv6?
-- Sincerely, Morten Brekkevold
Sikt – Norwegian Agency for Shared Services in Education and Research
On Mon 04 Nov 2024 at 11:10, Børge Brunes borge.brunes@uit.no wrote:
We are using net-snmp v5.9.4 and the sender is using IPv4
Ok, thank you. Not sure I am immediately able to test specifically on 5.9.4 (Our production servers are currently running a 5.9 release candidate with Debian patches).
But are other traps getting through without problems?