Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Apr 27, 2017 5:32 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Cacti THOLD alerts to Slack
PostPosted: Mon Jul 04, 2016 6:41 pm 
Offline

Joined: Mon Jul 04, 2016 6:21 pm
Posts: 1
I've written a Python script that will turn THOLD email alerts into Slack rich messages with graph.
The script leverages Sendmail aliases and the sendmail restricted shell (smrsh) to pipe the default THOLD email message in.

You will need to edit set some global variables (within the script). Please let me know if you have any questions.

Download here: https://github.com/jamesboswell/thold-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

Screenshot examples:


Attachments:
File comment: Restored example
cacti-thold-slack-restored.png
cacti-thold-slack-restored.png [ 157.38 KiB | Viewed 2229 times ]
File comment: ALERT example
cacti-thold-slack-ALERT-baseline.png
cacti-thold-slack-ALERT-baseline.png [ 197.7 KiB | Viewed 2229 times ]
Top
 Profile  
 
 Post subject: Re: Cacti THOLD alerts to Slack
PostPosted: Wed Apr 12, 2017 4:08 pm 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 16
I know this is a couple years old, but your script works perfectly!!!!

However, I'm trying to figure out how to implement putting graphs directly into the THOLD messages in Slack. I'm a little confused as to what you mean by mapping a directory to Apache.

N00b at this, I guess.

Help?


Top
 Profile  
 
 Post subject: Re: Cacti THOLD alerts to Slack
PostPosted: Sun Apr 23, 2017 6:35 pm 
Offline
Cacti User
User avatar

Joined: Mon Jan 05, 2015 10:10 am
Posts: 210
Thats pretty cool.

_________________
Before history, there was a paradise, now dust.


Top
 Profile  
 
 Post subject: Re: Cacti THOLD alerts to Slack
PostPosted: Mon Apr 24, 2017 3:07 pm 
Offline
User avatar

Joined: Thu Mar 16, 2017 8:43 am
Posts: 18
This is great!! anyone know if you can use sendmail and SMTP notification? I am using SMTP right now, but would have to switch to sendmail to implement this.

Update: never mind I got SendMail installed and working with all my notifications with no problem. Now working on getting the graph's in the Slack notifications.


Top
 Profile  
 
 Post subject: Re: Cacti THOLD alerts to Slack
PostPosted: Wed Apr 26, 2017 9:51 am 
Offline
User avatar

Joined: Thu Mar 16, 2017 8:43 am
Posts: 18
MissouriSpartan wrote:
I know this is a couple years old, but your script works perfectly!!!!

However, I'm trying to figure out how to implement putting graphs directly into the THOLD messages in Slack. I'm a little confused as to what you mean by mapping a directory to Apache.

N00b at this, I guess.

Help?


What it is saying is that :

Code:
slack_image_url     =   "http://cacti/tmp/img/"


Needs to go to the same folder as :

Code:
image_path           = '/var/www/html/tmp/img/'


This is my path's and I am using ubuntu server 16.04. I also have "cacti" map to the ip address of my server in DNS.

I still have not got this to work yet. I think the script is looking for an image attachment and the new system puts inline images into the e-mail. I have tried to change it to PNG and JPEG attached images and it still does not work. The images are not getting copied to that directory. I am at a loss at this point. It also does not look like the e-mails are changing image formats when I change the settings, so I am not sure whats going on.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group