Update request for MONITOR plugin

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
AndyStewart
Cacti User
Posts: 102
Joined: Thu Sep 29, 2005 5:21 am
Location: Edinburgh, Scotland

Update request for MONITOR plugin

Post by AndyStewart »

Can the images for the hosts be hyperlinked to their graph pages?
I don't care if the glass is half full or half empty, i want to know, who's been drinking my pint!!!

[size=75][Windows 2003 & IIS6] [Cacti 0.8.7b] [ActivePerl 5.8.8.817] [MySql 5.0.19] [NetSNMP 5.2.1.2-1] [PHP 5.1.2] [RRDTool 1.2.11]
[Plugins: PluginArchitecture, Monitor, Discovery, Threshold, Update, Reports, Manage, RealTime][/size]
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Moved to Addons
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Seems a reasonable request.

Add a ticket as a Feature Request to the bug tracker located here

http://cactiusers.org/bugs/

and I will get to it when I get the chance.
bdiez
Posts: 15
Joined: Thu Sep 08, 2005 8:09 am
Location: Spain

Update request for MONITOR plugin

Post by bdiez »

It's not difficult to reach this with some simple changes. I managed to do it in a short time during this afternoon and now is working for me. So in the meantime that cigamit publish a new official version of the monitor plugin with this feature you can try to do the following steps:


1. Open for editing the "monitor.php" file under the /plugins/monitor folder

(it's always a good idea to maintain a backup copy of the original file).


2. Locate the line with the following code:

Code: Select all

$sql = "SELECT description, status, hostname, cur_time, status_rec_date, availability FROM host where disabled = '' and monitor = 'on' ORDER BY description";
Then replace it with the following line:

Code: Select all

$sql = "SELECT id, description, status, hostname, cur_time, status_rec_date, availability FROM host where disabled = '' and monitor = 'on' ORDER BY description";
(note that we're simply adding the id field to the select statement).


3. Locate the lines with the following code:

Code: Select all

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	// Loop through each host one by one
	$name = $row['description'];
	$status = $row['status'];
	...
	...
	etc.
...and insert the following extra line:

Code: Select all

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	// Loop through each host one by one
	$anchor = $config['url_path'] . "graph_view.php?action=preview&host_id=" . $row['id'];
	$name = $row['description'];
	$status = $row['status'];
	...
	...
	etc.
(we create a new $anchor variable to be used later).


4. And finally, locate the line who says:

Code: Select all

	print "<td valign=top><center><img src='images/$i' name='$name' id='$name' title='$title'><br>$s$name$s2</center></td>\n";
...then replace it with the following code:

Code: Select all

	print "<td valign=top>
	         <center>
	           <a href=$anchor>
	             <img src='images/$i' name='$name' id='$name' title='$title' border='0'><br>
	             <font color='black'>$s$name$s2</font>
	           </a>
	         </center>
	       </td>\n";
(here is when we're creating the anchor corresponding to each icon, but trying to maintain the original aspect of the page).


Save your modified file (as "monitor.php", do not rename it), refresh your monitor tab ...et voila! It works for me

For sure you're thinking that it would be easier if I post my modified monitor.php file, but I prefer not to do this, because I think my installed monitor plugin is an outdated version and maybe it can cause compatibility problems to others.


:wink: Good luck.

Bernardo
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Added this to my SVN copy, works perfectly for me.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest