ADC

Custom SNMP traps

Starting from NetScaler version 14.1-34.x, you can create custom traps based on counters. The SNMP daemon monitors the counters and generates a trap whenever a trap criterion is met.

User input file

Create a YAML file snmpd_user_input.yaml in the /nsconfig/ folder and keep the custom SNMP trap details in the format specified in the following example. Here, the Trap1 based on the pcb_cur_inuse counter is triggered if the counter falls below the threshold value of 400.

Trap1:
    Counter: pcb_cur_inuse
    OID: 1.3.6.1.4.1.5951.2.1.0.100
    threshold: 400
    normal: 500
    ishighthresholdtrap: False
    entityname: ''
    entitytype: ''
    partitionid: 0

<!--NeedCopy-->

If there are any errors present in the snmpd_user_input.yaml file, you can see those in the /var/log/csnmpd.log file.

For the default partition, add the YAML file to the /nsconfig/ folder. If partitions are configured, add the file in the partition specific folder. The file is automatically synchronized for an HA or a cluster setup.

Similarly, you can add entries for the maximum 100 custom traps combining all YAML files for various partitions. For example, if partition 1 has 50 entries, partition 2 can have 20 entries, and partition 3 can have 30 entries. If there are no partitions, you can add entries for maximum 100 custom traps in the single snmpd_user_input.yaml file.

Trap1:
        Counter: tcp_tot_rxbytes
        OID: 1.3.6.1.4.1.5951.2.1.0.191
        threshold: 47777777
        normal: 0
        ishighthresholdtrap: True
        entityname: ''
        entitytype: ''
        partitionid: 0
Trap2:
        Counter: nic_tot_tx_mbits
        OID: 1.3.6.1.4.1.5951.2.1.0.192
        threshold: 47
        normal: 0
        ishighthresholdtrap: True
        entityname: 'Lo/1'
        entitytype: 'interface'
        partitionid: 0

<!--NeedCopy-->
Field Description Permissible value
Counter Unique name of the NetScaler counter. For a list of common NetScaler counters, see the NetScaler ‘Counters’ Grab-Bag! blog  
OID Unique object identifier. Must be from the range 1.3.6.1.4.1.5951.2.1.0.100 to 1.3.6.1.4.1.5951.2.1.0.200.
threshold Maximum or minimum value beyond which the trap is triggered. Any integer value.
normal Any permissible value either higher or lower than the specified threshold value based on ishighthresholdtrap value. Any integer value.
ishighthresholdtrap The criteria when a trap is triggered. If the value is set to true, the trap is triggered if a value exceeds the threshold value. If the value is set to false, the trap is triggered if a value falls below the threshold value. True or False.
entityname Name of the NetScaler entity associated with the counter. ’’ if there is an empty value.
entitytype Type of the NetScaler entity associated with the counter. ’’ if there is an empty value.
partitionid ID of the partition. O in the default partition. Any valid partition ID. Generally between O to 255.

Admin partitions

Traps are sent with partition ID details to the destination.

Custom traps behavior in a high availability setup

The snmpd_user_input.yaml file is synchronized to the secondary node. For an HA and admin partition setup, the snmpd_user_input.yaml is synchronized to the partition folders on the secondary node. Custom traps are sent on both the primary and secondary nodes when the trap condition is met.

Custom traps behavior in a cluster setup

The snmpd_user_input.yaml file is synchronized to other nodes when placed in the cluster configuration coordinator (CCO) node. In a cluster setup, if the trap condition is met on:

  • Individual node - the individual node sends the trap to the trap destination.
  • CCO node - the trap condition is checked against the aggregated status value and the CCO node sends the trap to the trap destination.

After setting up the YAML file, you can configure SNMP v1, SNMP v2, or SNMP v3 traps. For more information, see Configuring the NetScaler to generate SNMP traps.

Custom SNMP traps