Send Xymon/Hobbit Alerts to Slack Channel

22 sec read

How to sent xymon/hobbit alerts to slack channel

0. create bash script to push xymon/hobbit alerts to slack
vim /etc/xymon/scripts/alert_to_slack.sh

#!/bin/bash

hostname=$BBHOSTNAME
level=$BBCOLORLEVEL
msg=$BBALPHAMSG
title="$BBHOSTSVC $level"

url="https://hooks.slack.com/services/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXX"
channel="#${RCPT}"
assigned="@channel"

if [[ $level == "red" ]]; then
  emoji=":rage:"
  color="danger"
  status="Critical!"
elif [[ $level == "yellow" ]]; then
  emoji=":sunny:"
  color="warning"
  status="Warning!"
elif [[ $level == "green" ]]; then
  emoji=":white_check_mark:"
  color="good"
  status="OK!"
elif [[ $level == "purple" ]]; then
  emoji=":imp:"
  color="#800080"
  status="No report!"
else
  emoji=":ghost:"
  color="#000000"
  status="No data!"
fi

payload=$(< <(cat <

1. add script alert on hobbit/xymon-alerts.cfg
vim /etc/xymon/xymon-alerts.cfg

host=*
  SCRIPT /etc/xymon/scripts/alert_to_slack.sh channel_name DURATION>10 

If you're looking to enhance your understanding of alert systems and communication tools, you might be interested in delving deeper into concepts like monitoring systems and messaging platforms. Speaking of monitoring systems, you might find the history and technology behind Network Monitoring fascinating. Additionally, exploring the evolution of communication tools can provide useful context; check out the development of Slack to see how it has transformed team collaboration. Understanding these related topics can enrich your knowledge and help you implement better alerting solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *