Oh yeah, we're on the same page. The part that I missed was that there are multiple clusters. That changes things. Now we need to ssh into the Nagios system and start playing around with files.
But first, you still need to create a Host object, just like in the explanation above. Except this time you're going to create 3 Host objects, one to represent each cluster. Each Host object also needs a Service object for SNMP traps to be sent to.
Hosts:
Cluster 1
Cluster 2
Cluster 3
Services, all passive:
Cluster 1 SNMP Trap
Cluster 2 SNMP Trap
Cluster 3 SNMP Trap
Next, I am going to presume that each cluster has its own subnet, just to help keep things nice and clean. If this isn't the case, you are going to have to find some piece of commonality so that you can match up which cluster an incoming OID came from.
Cluster 1 - 8 nodes = 192.168.1.0/24
Cluster 2 - 3 nodes = 192.168.2.0/24
Cluster 3 - 11 nodes = 192.168.3.0/24
There are two important files in question here.
/etc/snmp/snmptt.conf
/etc/snmp/snmptt.conf.nxti
What's happening here is that the Nagios web interface configured SNMP trap definitions, writes the definitions to the database, and when the configuration is applied, it writes the information in the database out to /etc/snmp/snmptt.conf.nxti. Do not edit this file. Doing so would result in the same problems as manually editing a host or service configuration file.
But, you can use it to get a sort of template definition, if you already have an SNMP trap defined in the GUI. Grab your trap definition out of snmptt.conf.nxti (if you have one, if not, grab one of the example trap definitions), and we will put it in /etc/snmp/snmptt.conf. But do remember, if you are pulling one of your Nutanix traps out of snmptt.conf.nxti, you will want to remove it from the web interface before you add it to snmptt.conf.
Here is a generic example,
Code: Select all
EVENT .1.3.6.1.4.1.12356.100.1.3.0.999 "Status Events" Normal
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 "$r" "SNMP Traps" "$s" "$@" "$-*" "$*"
SDESC
Trap sent for diagnostic purposes by an administrator.
Variables:
1: fnSysSerial
2: sysName
EDESC
This is roughly what one of the example trap definitions look like. You're going to modify it, like so.
Code: Select all
EVENT .1.3.6.1.4.1.12356.100.1.3.0.999 "Status Events" Normal
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 "Cluster 1" "Cluster 1 SNMP Trap" "$s" "$@" "$-*" "$*"
MATCH $aA: 192.168.1.0/24
SDESC
Trap sent for diagnostic purposes by an administrator.
Variables:
1: fnSysSerial
2: sysName
EDESC
And because I can't use formatting in a code block, here are the key differences.
Original:
EXEC /usr/local/bin/snmptraphandling.py "$r" "SNMP Traps" "$s" "$@" "$-*" "$*"
Updated:
EXEC /usr/local/bin/snmptraphandling.py "Cluster 1" "Cluster 1 SNMP Trap" "$s" "$@" "$-*" "$*"
MATCH $aA: 192.168.1.0/24
Now, what the heck is happening here? What we've done is we're configuring snmptt and telling it what to do when it receives OID .1.3.6.1.4.1.12356.100.1.3.0.999. We are going to define this OID 3 times, one for each cluster. Change the above EXEC and MATCH lines accordingly.
Once you have defined the OID 3 times, one for each cluster, save the file, restart snmptt, and send a trap from one of your clusters. When this is done, any one of the nodes in cluster 1 (for example) could send out a trap using the specified OID, and based on the IP address that sent the trap (the node's IP address), snmptt will see which IP range it belongs to, and assign the trap to the correct Host object in Nagios.
This is the deep dark side of SNMP, so if this isn't terribly clear, let me know, and I will try to explain it better.
Reference, keep this handy:
http://snmptt.sourceforge.net/docs/snmp ... ile-format