项目作者: jamesboswell

项目描述 :
Cacti THOLD threshold alerts to Slack
高级语言: Python
项目地址: git://github.com/jamesboswell/thold-slack.git
创建时间: 2016-07-04T23:04:32Z
项目社区:https://github.com/jamesboswell/thold-slack

开源协议:

下载


ABOUT

thold-slack.py is a script to send Cacti THOLD alert messages to Slack

FEATURES

  • Sends Cacti THOLD message to a Slack channel of your choice
  • Allows hyperlink to URL of your choice (plugins/thold/thold_graph.php)
  • Hyperlink to graph of threshold breached
  • Optionally includes graph directly in Slack
  • RED (Alert), YELLOW (Warning), BLUE (Restored) alerts

INSTALLATION

This Python script is designed to ingest a Cacti THOLD email message as piped input from sendmail
and post the contents to a Slack channel as a rich format ‘attachment’ message as defined in the Slack API

It is highly recommended to run this through sendmail restricted shell (smrsh)

  1. cd /tmp
  2. git clone https://github.com/jamesboswell/thold-slack
  3. cd thold-slack
  4. # Edit thold-slack and set GLOBAL VARIABLES
  5. cp thold-slack /etc/smrsh
  6. chmod +x /etc/smrsh/thold-slack.py

Setup sendmail by doing the following, or manually editing /etc/aliases
You may, use any alias you choose, example below uses ‘thold-slack’

  1. sudo echo "thold-slack: | /etc/smrsh/thold-slack.py" >> /etc/aliases
  2. sudo newaliases

Optionally you can setup additional aliases that send THOLD messsages to different Slack channels by passing a channel name

For example to send to a #netadmin channel

  1. sudo echo "thold-slack-netadmin: \"| /etc/smrsh/thold-slack.py netadmin\"" >> /etc/aliases
  2. sudo newaliases

You will then need to setup your Cacti thresholds or threshold templates to send to the correct email alias as defined in previous steps.