-
nagios notiIT 2019. 4. 30. 10:54
#출처 https://github.com/obaarne/Nagios2Slack/blob/master/slack_host_notify.sh
#!/usr/bin/env bash # Edit your Slack hook URL and footer icon URL SLACK_URL=https://hooks.slack.com/services/XXXXXXXXX/XXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX FOOTER_ICON=http://env.baarnes.com/Nagios.png # Host Notification command example : # define command { # command_name slack-host # command_line /usr/lib64/nagios/plugins/slack_host_notify "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTADDRESS$" "$HOSTSTATE$" "$HOSTOUTPUT$" "$LONGDATETIME$" # } case $4 in "DOWN") MSG_COLOR="#EE0000" ;; "UP") MSG_COLOR="#00CC00" ;; *) MSG_COLOR="#CCCCCC" ;; esac IFS='%' SLACK_MSG="payload={\"attachments\":[{\"color\": \"$MSG_COLOR\",\"title\": \"Host $1 notification\", \"text\": \"Host: $2\\nIP: $3\\nState: $4\"}, {\"color\": \"$MSG_COLOR\",\"title\":\"Additional Info :\",\"text\":\"\\n$5\", \"footer\": \"Nagios notification: $6\",\"footer_icon\": \"$FOOTER_ICON\"}]}" #Send message to Slack curl -4 -X POST --data "$SLACK_MSG" $SLACK_URL unset IFS 'IT' 카테고리의 다른 글
보안그룹 인바운드 추가 (0) 2019.08.29 JVM 환경에서 LDAP 연동 후 빈번한 로그인 실패 발생시 대응 방법출처: https://mcpaint.tistory.com/276 [MC빼인트와 함께] (0) 2019.08.22 이벤트뷰어 백업 (0) 2019.06.18 ssh pem로 접속 (0) 2019.05.16 쉘스크립트 리스트 (0) 2019.04.16