maxwo / snmp_notifier

A webhook to relay Prometheus alerts as SNMP traps, because sometimes, you have to deal with legacy
Apache License 2.0
55 stars 33 forks source link

Cannot see the snmp-server trap output #176

Closed bmgante closed 7 months ago

bmgante commented 8 months ago

What did you do? Send alert using curl to snmp-notifier and this one sending trap to snmp-server, both running in EKS. SNMP-Notifier installed using helm and snmp-server deploying the manifest available under scripts/kubernetes.

What did you expect to see? I was expecting to see the trap output in snmp-server stdout.

What did you see instead? Under which circumstances? The snmp-notifier receives the alert and with 200OK but i am not able to see anything on the snmp-server stdout.

Environment

alert1_warning_resolved.json:

{
  "receiver": "snmp-notifier",
  "status": "firing",
  "groupLabels": {
    "environment": "staging",
    "label": "test"
  },
  "alerts": [
    {
      "status": "firing",
      "labels": {
        "severity": "warning",
        "alertname": "TestAlert1"
      },
      "annotations": {
        "message": "this is the message of alert 1"
      }
    }
  ]
}

/var/lib/zabbix/snmptraps $ ps -ef PID USER TIME COMMAND 1 zabbix 0:00 /usr/sbin/snmptrapd -n -C -c /etc/snmp/snmptrapd.conf -Lo -A 24 zabbix 0:00 /bin/sh 33 zabbix 0:00 ps -ef

bmgante commented 8 months ago

The problem was the config for the snmp-server, i was using the default SNMPv2c on the snmp-notifier while the snmp-server config was set to snmpv3. Did the following changes

  snmptrapd.conf: |
    # A list of listening addresses, on which to receive incoming SNMP notifications
    snmpTrapdAddr udp:1162
    snmpTrapdAddr udp6:1162

    # Do not fork from the calling shell
    doNotFork yes
    # File in which to store the process ID of the notification receiver
    pidFile /tmp/snmptrapd.pid
    # Disables support for the NOTIFICATION-LOG-MIB
    doNotRetainNotificationLogs yes

    # Format of the trap output for SNMPv3
    # format2 %V\n% Agent Address: %A \n Agent Hostname: %B \n Date: %H - %J - %K - %L - %M - %Y \n Enterprise OID: %N \n Trap Type: %W \n Trap Sub-Type: %q \n Community/Infosec Context: %P \n Uptime: %T \n Description: %W \n PDU Attribute/Value Pair Array:\n%v \n -------------- \n

    # Format of the trap output for SNMPv2c
    format2 %B[%A]: %W-%q - %P - %U - %v\n

    #SNMPv3
    #createUser -e 0x8000000001020304 snmp_user_v3 SHA auth_password_v3 AES encrypt_password_v3

    #SNMPV3
    # authUser log,execute,net snmp_user_v3

    authCommunity log,execute,net public
maxwo commented 7 months ago

Thanks for your feedback. I can now close this issue. Thank you