You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by Satyanarayana Jampa <sj...@innominds.com> on 2017/06/06 06:09:54 UTC

Enabling SNMP alerts

Hi,
                I am using Ambari 2.2 and I would like to enable the SNMP alerts.
                For  enabling the alerts I followed the below link:
                                https://community.hortonworks.com/articles/74370/snmp-alert.html
                The "snmp_mib_script.sh" has snmptrap command, which take localhost as the "HOST" parameter as below:
Can this "Host" parameter be taken from the Ambari "Edit Notification" screen, just like the alert state, alertname etc?


HOST=localhost
COMMUNITY=public

STATE=0
if [ $4 == "OK" ]; then
  STATE=0
elif [ $4 == "UNKNOWN" ]; then
  STATE=1
elif [ $4 == "WARNING" ]; then
  STATE=2
elif [ $4 == "CRITICAL" ]; then
  STATE=3
fi

/usr/bin/snmptrap -v 2c -c $COMMUNITY $HOST '' APACHE-AMBARI-MIB::apacheAmbariAlert alertDefinitionName s "$1" alertName s "$2" alertText s "$5" alertState i $STATE alertService s "$3"

Thanks,
Satya.


Re: Enabling SNMP alerts

Posted by Jonathan Hurley <jh...@hortonworks.com>.
No, it cannot. The script-approach for SNMP in Ambari 2.2 is meant as a way of providing your own custom behavior on top of Ambari. The core logic of Ambari only passes the fields that you see here. (alert state, name, service, etc).

You need to edit the script to provide your own host. I've seen people actually put several hosts in this script since they want to push to multiple SNMP managers for the same notification.

Something else to mention; the web client in Ambari 2.2 didn't support edittng script dispatchers. You shouldn't try to edit it from the web client as it could change the type.

On Jun 6, 2017, at 2:09 AM, Satyanarayana Jampa <sj...@innominds.com>> wrote:

Hi,
                I am using Ambari 2.2 and I would like to enable the SNMP alerts.
                For  enabling the alerts I followed the below link:
                                https://community.hortonworks.com/articles/74370/snmp-alert.html
                The “snmp_mib_script.sh” has snmptrap command, which take localhost as the “HOST” parameter as below:
Can this “Host” parameter be taken from the Ambari “Edit Notification” screen, just like the alert state, alertname etc?


HOST=localhost
COMMUNITY=public

STATE=0
if [ $4 == "OK" ]; then
  STATE=0
elif [ $4 == "UNKNOWN" ]; then
  STATE=1
elif [ $4 == "WARNING" ]; then
  STATE=2
elif [ $4 == "CRITICAL" ]; then
  STATE=3
fi

/usr/bin/snmptrap -v 2c -c $COMMUNITY $HOST '' APACHE-AMBARI-MIB::apacheAmbariAlert alertDefinitionName s "$1" alertName s "$2" alertText s "$5" alertState i $STATE alertService s "$3"

Thanks,
Satya.