Jump to content

Testing Trap With Linux Operating System: Difference between revisions

no edit summary
No edit summary
Line 23: Line 23:
  $ sudo nano /etc/snmp/snmpd.conf
  $ sudo nano /etc/snmp/snmpd.conf


Find a line containing '''"agenAddress udp:127.0.0.1:161"''' and comment it by adding '''#''' symbol at the beginning of the line. Uncomment line '''"agenAddress udp:161,udp6[::1]:161"'''. If you chose diferent SNMP port change '''161''' into your chosen port. '''Make sure to use exactly the same port as in SNMP package configuration on Teltonika device'''.
Find a line containing '''"agenAddress udp:127.0.0.1:161"''' and comment it by adding '''#''' symbol at the beginning of the line. Uncomment line '''"agenAddress udp:161,udp6[::1]:161"'''. If you chose different SNMP port change '''161''' into your chosen port. '''Make sure to use exactly the same port as in SNMP package configuration on Teltonika device'''.


[[File:Networking device configurationexample traps with terminal snmpd config v1.png]]
[[File:Networking device configurationexample traps with terminal snmpd config v1.png]]
Line 51: Line 51:
===Creating Trap listening service===
===Creating Trap listening service===


This is required for launching Trap listening service with extra configurations, we will use it to describe the log file, where all traps will be recorded.
This is required for launching Trap listening service with extra configurations, we will use it to describe the log file to which all traps will be recorded.


Use this command:
Use this command:
Line 63: Line 63:
'''ExecStart=/usr/sbin/snmptrapd -Ln -f -Lf /var/log/snmptrapd.log'''
'''ExecStart=/usr/sbin/snmptrapd -Ln -f -Lf /var/log/snmptrapd.log'''


This configuration will write the log into ''' ''/var/log/'' ''' folder and into ''' ''snmptrapd.log'' ''' file. You can change the log file directory and file name.
This configuration will write the log of caught Trap messages into ''' ''/var/log/'' ''' folder and into ''' ''snmptrapd.log'' ''' file. You can change the log file directory and file name.


[[File:Networking device configurationexample creating snmptrapd service v1.png]]
[[File:Networking device configurationexample creating snmptrapd service v1.png]]
Line 70: Line 70:
MIB file will be used to translate OID codes to more readable format.
MIB file will be used to translate OID codes to more readable format.


If you dont have the MIB file download it from SNMP packge WebUI window [[SNMP configuration example#SNMP Configuration]]
If you dont have the MIB file, download it from SNMP packge WebUI window [[SNMP configuration example#SNMP Configuration]]


After downloading the MIB file, place it in ''' ''/usr/share/snmp/mib'' ''' directory, you can use this command:
After downloading the MIB file, place it in ''' ''/usr/share/snmp/mib'' ''' directory, you can use this command:
Line 99: Line 99:
[[File:Networking device configurationexample traps with terminal snmptarpd start v1.png]]
[[File:Networking device configurationexample traps with terminal snmptarpd start v1.png]]


To restart or launch it you can use this command:
To restart or launch the service you can use this command:


  $ sudo /etc/init.d/snmptrapd restart
  $ sudo /etc/init.d/snmptrapd restart
Line 118: Line 118:


If SNMP manager caught any traps, connection information can be represented with service status information.
If SNMP manager caught any traps, connection information can be represented with service status information.
'''Important note:''' if status shows failed message, one solution could be changing the SNMP Trap port, some other process might be using the described port.


===Testing if SNMP Trap listening service works===
===Testing if SNMP Trap listening service works===
Firs make sure that SNMP Trap package has Trap rules configured in order to test if listening service works correctly. More information here [[SNMP configuration example#Trap Configuration]]
First make sure that SNMP Trap package has Trap rules configured in order to test if listening service works correctly. More information here [[SNMP configuration example#Trap Configuration]]


If any Trap was triggered you can check if Trap message was caught and logged. Check service '''status''' to see if any connections were esablished.
If any Trap was triggered, you can check, if Trap message was caught and logged. Check service '''status''' to see if any connections were established.


Open ''' ''/var/log/snmptrapd.log'' '''. If you specified different directory and file name, open it. Example commands:
Open ''' ''/var/log/snmptrapd.log'' '''. If you specified different directory and file name, open it. Example commands:
Line 130: Line 132:




snmptrapd.log file after triggering ''' ''trapDigitalRelayOutputStatus'' ''' by changing '''Digital relay output''' value in WebUI (Services -> Input/Output, Output tab -> ON/OFF tab using RUT955).
snmptrapd.log file after triggering ''' ''trapDigitalRelayOutputStatus'' ''' by changing '''Digital relay output''' value in WebUI (Services -> Input/Output, Output tab -> ON/OFF tab, using RUT955).


[[File:Networking device configurationexample traps with terminal log file after catching trap v1.png]]
[[File:Networking device configurationexample traps with terminal log file after catching trap v1.png]]
0

edits