Hello
I am inexperienced with Nagios and SNMP in general and want to know if the is a quicker more efficient way to go about writing traps / service for a project i'm working on.
i estimate i have approximately 800 - 1000 traps to define and then the corresponding services .
------ Outline of Project -----
I have 40 cameras being monitored by 5 Video servers (8 cameras per server)
Each camera has 10 different alarm conditions (PASSIVE TRAPS) - power - tamper - runtime - service interal etc
can be either in a CRITICAL or OK State
so currently i have 40x10x2 ==800 traps to write (the way that i'm currently writing them)
but the format i'm using is the same for the snmp trap ie the Object of the netSnmpExampleHeartbeatName string "SITE ID_FAULT_STATE" see below.
Passive traps for these cameras are generated by the Video Servers and not the cameras
So these passive traps sent by the servers contain camera identifiers so i cannot use IP addresses
so an example of a trap being sent is power failure at camera ABC
snmptrap -v 2c -c public 192.168.xxx.yyy '' netSnmpExampleHeartbeatNotification netSnmpExampleHeartbeatName s "ABC_POWER_CRITICAL."
and the reset trap is
snmptrap -v 2c -c public 192.162.xxx.yyy '' netSnmpExampleHeartbeatNotification netSnmpExampleHeartbeatName s "ABC_POWER_OK."
so currently i am defining the traps as per below --
example power fault reset at site ABC
*********Edit Trap Definition***************************
Trap Details
Event Name:ABC_POWER_OK
OID:netSnmpExampleHeartbeatNotification
Category:Alarm
Severity:Ok
Description:camera power alarm reset
-------
Passive Service Setup
These inputs will also work with the EXEC macros table.
Enable Passive Service Setup:
Host Name: camera ABC
Service Description:POWER ABC
Severity:OK
Service Output: power fault reset
--------
Exec:
--------
Advanced
MATCH $1: (.*ABC_POWER_OK.$)
********************************************************************
this way i calculate approx 1000 definition have to be written but is the an easier way
800 + 200 more for server traps video stream traps
Please any help will be GREATLY appreciated
Regards
Richie
BULK Trap and Service writing support
Re: BULK Trap and Service writing support
Unfortunately, there isn't a bulk method of doing this at this time because of the differences in each.
-
richie7tech
- Posts: 14
- Joined: Mon Sep 28, 2020 7:29 am
Re: BULK Trap and Service writing support
Hi
i can see that the defined traps are stored in /etc/snmp/snmptt.conf.nxti ------ see sample below
can i copy this file - rename -
then run a script that automatically copies the text but replaces the ZZZ with other site id's and add them to the file .
so once the new file with all 800+ defined traps included
can this be added back into the system.?
i have seen the warning saying that manually altering the file changes will be overwritten when Nagios restarts.
but i think i also think i saw a procedure to follow that this altered nxti can be implemented ..
also are there other files that would need updating ?
regards
Richie
--- Sample ---
EVENT ZZZ_POWER_FAULT_OK netSnmpExampleHeartbeatNotification "Alarm" Ok
FORMAT Received trap "$N" with variables "$+*"
EXEC php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*"
EXEC /usr/local/bin/snmptraphandling.py "Site ZZZ" " POWER ZZZ" "OK" "$@" "" "Trap Received $+*"
MATCH $1: (.*ZZZ_POWER_OK.$)
SDESC
ZZZ POWER alert received
EDESC
EVENT ZZZ_POWER_FAULT_CRITICAL netSnmpExampleHeartbeatNotification "Alarm" Critical
FORMAT Received trap "$N" with variables "$+*"
EXEC php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*"
EXEC /usr/local/bin/snmptraphandling.py "Site ZZZ" "POWER ZZZ" "CRITICAL" "$@" "" "POWER FAULT REVCEIVED"
MATCH $1: (.*ZZZ_POWER_CRITICAL.$)
SDESC
ZZZ POWER FAULT
EDESC
i can see that the defined traps are stored in /etc/snmp/snmptt.conf.nxti ------ see sample below
can i copy this file - rename -
then run a script that automatically copies the text but replaces the ZZZ with other site id's and add them to the file .
so once the new file with all 800+ defined traps included
can this be added back into the system.?
i have seen the warning saying that manually altering the file changes will be overwritten when Nagios restarts.
but i think i also think i saw a procedure to follow that this altered nxti can be implemented ..
also are there other files that would need updating ?
regards
Richie
--- Sample ---
EVENT ZZZ_POWER_FAULT_OK netSnmpExampleHeartbeatNotification "Alarm" Ok
FORMAT Received trap "$N" with variables "$+*"
EXEC php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*"
EXEC /usr/local/bin/snmptraphandling.py "Site ZZZ" " POWER ZZZ" "OK" "$@" "" "Trap Received $+*"
MATCH $1: (.*ZZZ_POWER_OK.$)
SDESC
ZZZ POWER alert received
EDESC
EVENT ZZZ_POWER_FAULT_CRITICAL netSnmpExampleHeartbeatNotification "Alarm" Critical
FORMAT Received trap "$N" with variables "$+*"
EXEC php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*"
EXEC /usr/local/bin/snmptraphandling.py "Site ZZZ" "POWER ZZZ" "CRITICAL" "$@" "" "POWER FAULT REVCEIVED"
MATCH $1: (.*ZZZ_POWER_CRITICAL.$)
SDESC
ZZZ POWER FAULT
EDESC
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: BULK Trap and Service writing support
HI richie7tech,
We're are currently working on your issue and are going to some research on this question with the team here and will follow up.
Thank you for your patience.
Best Regards,
Benjamin
We're are currently working on your issue and are going to some research on this question with the team here and will follow up.
Thank you for your patience.
Best Regards,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: BULK Trap and Service writing support
Yes, you can do that, just don't edit the /etc/snmp/snmptt.conf.nxti directly as it will be overwritten. Put your modified ones in a different file and then follow page 15 of this guide:
https://assets.nagios.com/downloads/nag ... h-NXTI.pdf
https://assets.nagios.com/downloads/nag ... h-NXTI.pdf