Shell script as Cacti Tab

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
akalaidjieva
Posts: 5
Joined: Thu Nov 12, 2009 5:47 am

Shell script as Cacti Tab

Post by akalaidjieva »

Hallo, I have a simple shell script (for sending an e-mail) and I need to create a Cacti tab (superlink) with it. The idea is to have a link in the Cacti tab and when you press the link, the shell script is executed. Can someone help me do that?

Thank you!
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Shell script as Cacti Tab

Post by Howie »

akalaidjieva wrote:Hallo, I have a simple shell script (for sending an e-mail) and I need to create a Cacti tab (superlink) with it. The idea is to have a link in the Cacti tab and when you press the link, the shell script is executed. Can someone help me do that?

Thank you!
This is what CGI is. Google around for "CGI shell script", but the basic version would be:

Code: Select all

#!/bin/sh
echo "Content-type: text/html"
echo

# your script here - output goes to the browser
and configure your webserver to allow CGI scripts to execute from whereever that shellscript is.

I'd do it in php with the mail() function personally, but if you already have the script...
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
akalaidjieva
Posts: 5
Joined: Thu Nov 12, 2009 5:47 am

Post by akalaidjieva »

OK, I rewrote the script with the PHP mail() function and it works perfectly when executed from the console. But when I add it as a Cacti tab nothing happens- just a blank page and no e-mail.

Can anyone give me a hint what I am doing wrong?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

akalaidjieva wrote:OK, I rewrote the script with the PHP mail() function and it works perfectly when executed from the console. But when I add it as a Cacti tab nothing happens- just a blank page and no e-mail.

Can anyone give me a hint what I am doing wrong?
Care to post the script? Or some of it? Or the contents of the httpd error log?
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
akalaidjieva
Posts: 5
Joined: Thu Nov 12, 2009 5:47 am

Post by akalaidjieva »

<?php
$txt = "Test e-mail\nPlease ignore";


mail("akalaidzhieva@abv.bg","Test",$txt);
?>

As simple as that but I don't know what to do with it :)
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests