Skip to content

Instantly share code, notes, and snippets.

@dalehamel
Created June 17, 2016 04:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalehamel/a57f7f7b189c2d3a50ff34ffcd4f9a2e to your computer and use it in GitHub Desktop.
Save dalehamel/a57f7f7b189c2d3a50ff34ffcd4f9a2e to your computer and use it in GitHub Desktop.
Enable snmp traps on supermicro ipmi
# Enable SNMP
USER=
PASS=
IPMI_HOST=
TARGET=127.0.0.1
INDEX=1 # one indexed alert to set
SESSION_ID=$(curl -d "name=${USER}&pwd=${PASS}" "https://${IPMI_HOST}/cgi/login.cgi" --silent --insecure -i | awk '/Set-Cookie/ && NR != 2 { print $2 }')
# Severity ->
# 0 -> 00 is disabled
# 1 -> 2 is informational
# 2 -> 8 is warn
# 3 -> 16 is critical
# 4 -> 32 is non-recoverable
curl -X POST -H "Cookie: ${SESSION_ID}" --insecure "https://${IPMI_HOST}/cgi/op.cgi" -d "&op=config_alert&ip=${TARGET}&severity=2&index=${index}&fun=m&time_stamp=12345"
@j-su
Copy link

j-su commented Oct 20, 2017

Hi,

Thanks for this one - I could really use it :-) One little typo though: In the declaration block index is written in capitals, in the curl call it is not. Fine if you only want to set one SNMP trap host. ;-)

Best,
Jan

@pasha-admin
Copy link

Could you share documentation where I can find different attributes for request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment