Plugin Architecture for Cacti and Monitoring Module

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
scavenger67
Posts: 49
Joined: Fri Mar 18, 2005 7:33 am
Location: France

settings of monitor..

Post by scavenger67 »

i just want to know how to configure the monitor plugin. have some questions :

- where must i put the files /monitor ? the readme speak about a plugin directory. where is it ? i have version 0.8.6.f

- how and where to add the entry in config.php in order to made the monitor plugin working ?

thanks for your help
:wink:
Schwan
Posts: 8
Joined: Sun Jul 31, 2005 11:10 am

Post by Schwan »

The errors you are receiving appear to be with a bad patch on the config.php file. The patch was made to be used before you setup cacti or modify the config.php (if you use a RPM based solution, they may have already made modifications).

I have now added the actual patched files to the download, so you can redownload it and override your files with that version. Please test it that way, and see if it then works for you. I will see if I can add a little more fuzz to the patch to make it work in more situations.
ok, i started with fresh sources for cacti and the plugin-patch:

Code: Select all

#!/bin/bash

# a script to download and install cacti-0.8.f & plugin-0.4 patch
# Version 0.1 01.08.2005
# by schwan


# create a directory & move inside the new dir
mkdir cactiplugin && cd cactiplugin
echo -e "\n---------------------------------\ndirectory created ...\n---------------------------------\n"

# download cacti & plugin patch
wget -nv http://www.cacti.net/downloads/cacti-0.8.6f.tar.gz
wget -nv http://cactiusers.org/downloads/cacti-plugin-arch.gzip
echo -e "\n---------------------------------\nfiles downloaded ...\n---------------------------------\n"


# unzip the dowloaded files
tar xvzf cacti-0.8.6f.tar.gz &> /dev/null
tar xvzf cacti-plugin-arch.gzip &> /dev/null
echo -e "\n---------------------------------\nfiles unzipped ...\n---------------------------------\n"


# copy the plugin patch to the main cacti directory
cp cacti-plugin-arch/cacti-plugin-0.8.6f.diff cacti-0.8.6f/.
echo -e "\n---------------------------------\ncopied the plugin diff ...\n---------------------------------\n"


# apply the plugin patch
cd cacti-0.8.6f
patch -p1 -N < cacti-plugin-0.8.6f.diff
cd ..
echo -e "\n---------------------------------\npatched cacti with the plugin patch ...\n---------------------------------\n"

# go back to the directory where we started
cd ..
created a new db & virtual website for this. Browsed to the new website,
said "new install" in the wizzard, changed admin pw.

I got the error "Notice: Undefined index: url_path in /tmp/cactiplugin/cacti-0.8.6f/lib/html.php on line 473" showed in the attached screenshot.

Then i copied all your pre-patched files over my new ones to see if there is a change ... i still get the same error.

:o

best regards,
Schwan
Attachments
fresh_patched.png
fresh_patched.png (40.03 KiB) Viewed 7317 times
Last edited by Schwan on Mon Aug 01, 2005 1:18 pm, edited 1 time in total.
Schwan
Posts: 8
Joined: Sun Jul 31, 2005 11:10 am

Post by Schwan »

short test on the same server with cacti-0.8.6d and the monitor plugin for 0.8.6d
... well this works "out of the box" :)

CU,
Schwan
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Schwan,

I believe I have found the cause of the 2 errors, and have fixed them. It was some stupid errors on my part, but I am not sure why they didn't show up on my test system.

Go ahead and give it another go and see if it works for you now. And thanks for the help in resolving these 2 bugs.
Schwan
Posts: 8
Joined: Sun Jul 31, 2005 11:10 am

Post by Schwan »

qpduong wrote:@cigamit

it doesn't work for me, i used ur already patched files but the same errors .

@schwan

Yeah it works with the first page but with graphs/threshold tab I receive:
Parse error: syntax error, unexpected T_STRING in c:\wamp\www\cacti\include\top_graph_header.php on line 114

I am not php guy so i should stay still and wait good news from you
:D
@qpduong

i think i found a quick and dirty fix .... in changed in top_graph_header.php the line 114 back to the statement like in the file for 0.8.6d

Code: Select all

						<a href="<?php echo $config['url_path']; ?>graph_settings.php"><img src="<?php echo $config['url_path']; ?>images/tab_settings<?php if (basename($_SERVER["PHP_SELF"]) == "graph_settings.php") { print "_down"; }?>.gif" border="0" alt="Settings" align="absmiddle"></a>&nbsp;&nbsp;<?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_tree"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=tree"><img src="<?php echo $config['url_path']; ?>images/tab_mode_tree<?php if ($_REQUEST["action"] == "tree") { print "_down"; }?>.gif" border="0" title="Tree View" alt="Tree View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_list"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=list"><img src="<?php echo $config['url_path']; ?>images/tab_mode_list<?php if ($_REQUEST["action"] == "list") { print "_down"; }?>.gif" border="0" title="List View" alt="List View" align="absmiddle"></a><?php }?><?php if ((!isset($_SESSION["sess_user_id"])) || ($current_user["show_preview"] == "on")) {?><a href="<?php echo $config['url_path']; ?>graph_view.php?action=preview"><img src="<?php echo $config['url_path']; ?>images/tab_mode_preview<?php if ($_REQUEST["action"] == "preview") { print "_down"; }?>.gif" border="0" title="Preview View" alt="Preview View" align="absmiddle"></a><?php }?>&nbsp;<br>
now the monitor page and the graps page are there. cooooool :D

cheers,
Schwan
Schwan
Posts: 8
Joined: Sun Jul 31, 2005 11:10 am

Post by Schwan »

cigamit wrote:Schwan,

I believe I have found the cause of the 2 errors, and have fixed them. It was some stupid errors on my part, but I am not sure why they didn't show up on my test system.

Go ahead and give it another go and see if it works for you now. And thanks for the help in resolving these 2 bugs.
cigamit,

i installed it again with my script, now the pages "monitor" and "graphs" are coming without errors :)

for the thold plugin i got the error "Table 'cactifixed.thold_data' doesn't exist" ... so i had a look in the
thold plugin directory and found the thold.sql file. when i tried to import it to my mysql, i got this message:

Code: Select all

mysql -u root -p cactifixed < thold.sql
ERROR 1062 (23000) at line 46: Duplicate entry '18-1' for key 1
hmm, i think this has something to do with thold 2.1a and not with the plugin code, have to read the thold 2.1a thread for this :wink:

best regards,
Schwan
Schwan
Posts: 8
Joined: Sun Jul 31, 2005 11:10 am

Post by Schwan »

cigamit,

it is maybe possible to enable realm permission
"Configure Thresholds"
"View Thresholds"
"View Monitoring"
per default for the admin user ?

CU,
Schwan
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Schwan wrote: cigamit,

i installed it again with my script, now the pages "monitor" and "graphs" are coming without errors :)

for the thold plugin i got the error "Table 'cactifixed.thold_data' doesn't exist" ... so i had a look in the
thold plugin directory and found the thold.sql file. when i tried to import it to my mysql, i got this message:

Code: Select all

mysql -u root -p cactifixed < thold.sql
ERROR 1062 (23000) at line 46: Duplicate entry '18-1' for key 1
hmm, i think this has something to do with thold 2.1a and not with the plugin code, have to read the thold 2.1a thread for this :wink:

best regards,
Schwan
The SQL file is the one directly from the Thold Module. The line in question is this one

Code: Select all

INSERT INTO `user_auth_realm` VALUES (18, 1);
Which means that for some reason, your database already contains the authorization for the admin user for the Threshold realm.

EDIT:
After more research, I find that this happens if you goto the user permissions and give Admin permissions to these areas before you actually import the database for Thold. As I have now updated the plugin to auto-create the database, this should not be a problem anymore.
Last edited by cigamit on Tue Aug 02, 2005 12:23 am, edited 1 time in total.
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Schwan wrote:cigamit,

it is maybe possible to enable realm permission
"Configure Thresholds"
"View Thresholds"
"View Monitoring"
per default for the admin user ?

CU,
Schwan
The "Configure Thresholds", "View Thresholds" permissions are included in the thold.sql file already. I can easily add the "View Monitoring" permissions when it does the initial database update.

I will be adding code that auto-checks for the thold tables, and create them if they don't exist. I had planned on adding this in sooner, but I would like to find a nice place for a new hook for doing initial checks, in order to cut down on extra SQL queries.

(Edit: I have gone ahead and added the code to auto-create the database if it is not found.)
Last edited by cigamit on Tue Aug 02, 2005 12:21 am, edited 1 time in total.
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: settings of monitor..

Post by cigamit »

scavenger67 wrote:i just want to know how to configure the monitor plugin. have some questions :

- where must i put the files /monitor ? the readme speak about a plugin directory. where is it ? i have version 0.8.6.f

- how and where to add the entry in config.php in order to made the monitor plugin working ?

thanks for your help
:wink:
You must first install the Plugin Architecture. When you do, this will create a directory in your cacti directory named "plugins". You will need to extract the monitor plugin to a temporary directory. The files and folders in this directory need to be placed in a directory named "monitor" inside the "plugins" directory.

Once you have all that in place, you will need to edit your "include/config.php" which is in your cacti directory. You will see code that looks like this.

//$plugins[] = 'thold';

You will need to change that to this

$plugins[] = 'monitor';

Once that is done, your monitor plugin should be installed.
qpduong
Posts: 11
Joined: Tue Jul 26, 2005 7:59 pm
Contact:

Post by qpduong »

schwan,

thold[1][1].2.1b works with 0.8.6f but sometimes it make cacti go to a loop (see benhanson posts) and I still haven't found any solution for this in thold 2.1a thread.

rgds,
qpduong
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

qpduong wrote:schwan,

thold[1][1].2.1b works with 0.8.6f but sometimes it make cacti go to a loop (see benhanson posts) and I still haven't found any solution for this in thold 2.1a thread.

rgds,
qpduong
I believe you would be talking about this post here
http://forums.cacti.net/viewtopic.php?p=27163#27163

I have a few bits of code that I had added to our modified version of Cacti to take care of this problem (it was on Linux, so its was not causing freezing but it was creating an issue). I will be adding all of my patches to the Threshold Plugin fairly shortly. This should take care of alot of the issues that the current one causes.

I will also be adding in my code for the templating of thresholds. This will allow you to setup default thresholds for the data sources, and when you auto-create thresholds, it will only create the thresholds you want with the data you want.

(Edit: I have added in all my bug fixes and code to automatically create the database. I now just need to add the changes to allow Threshold Templates)
qpduong
Posts: 11
Joined: Tue Jul 26, 2005 7:59 pm
Contact:

Post by qpduong »

very cool cigamit, pls let us know when stable version is available on download :D
scavenger67
Posts: 49
Joined: Fri Mar 18, 2005 7:33 am
Location: France

it's working now !

Post by scavenger67 »

ok the plugin and thold is working now fine on 0.8.6f
but.. you say that the thold module will poll automatically.
how it is possible, because i use cactid instead of cmd.php
is it also working and how ?
thx.
:wink:
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: it's working now !

Post by cigamit »

scavenger67 wrote:ok the plugin and thold is working now fine on 0.8.6f
but.. you say that the thold module will poll automatically.
how it is possible, because i use cactid instead of cmd.php
is it also working and how ?
thx.
:wink:
It does not matter if you use cmd.php or cactid, as both of them are launched through poller.php, which is were the hook is tied into.

I have not tested it completely on Win32, so if anyone out there can verify that it is working correctly on it, please let me know.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests