running perl script from links plugin

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
mpb
Posts: 20
Joined: Mon Nov 06, 2006 5:46 am

running perl script from links plugin

Post by mpb »

hi

this sounds faq, but i didnt find any pointers, so if someone cares to comment....

im migrating to cacti - good job to all who code it, and in my older system ive got a bunch of perl scripts doing some monitoring and output-ing to a html to view by NOC staff.

how do i go about using the links plugin, so that the output of the links tab will be whats generated by the perl script - in fact the links tab will run the perl script, to avoid having to recode the stuff to php.

thanks
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm not sure, that you're on the right way. Please see the very first link of my signature as a start
Reinhard
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: running perl script from links plugin

Post by Howie »

mpb wrote:hi

this sounds faq, but i didnt find any pointers, so if someone cares to comment....

im migrating to cacti - good job to all who code it, and in my older system ive got a bunch of perl scripts doing some monitoring and output-ing to a html to view by NOC staff.

how do i go about using the links plugin, so that the output of the links tab will be whats generated by the perl script - in fact the links tab will run the perl script, to avoid having to recode the stuff to php.

thanks
If the perl scripts just generate some HTML, then you should be able to use the PHP popen() function to capture the output of that script, and print it inside the PHP code...

Code: Select all

<?php
    $handle = popen('/path/to/your/script', 'r');
   while(!feof($handle))
   {
    $read = fread($handle, 2096);
    echo $read;
    }
    pclose($handle);
?>
inside the changeme page should do it, I think.

Obviously, you are skipping all the nice framework that Cacti provides by using your old script this way, but I guess there's a good reason :-)
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!)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests