Plugin Architecture for Cacti and Monitoring Module

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

Post by cigamit »

knobdy wrote:
cigamit wrote:Multiple emails works for me, I just use a comma, no space, but it shouldn't matter as it does a TRIM on the email before sending, so it strips the spaces.
Is there a script I can run manually to see why mine isn't working that way? I'm only getting them sent to the first e-mail configured.
I'm working on a more "robust" debugging ability, and included in it, it will show you emails that it sent, and exactly who it sent them to. So maybe that will help.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

cigamit wrote:I'm working on a more "robust" debugging ability, and included in it, it will show you emails that it sent, and exactly who it sent them to. So maybe that will help.
That will be very handy indeed.

Btw, is there a way that I can contact you directly, more easily than via a forum post? Do you check personal messages on here (forums.cacti.net)? I don't recall seeing your e-mail at cactiusers...
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

knobdy wrote:
cigamit wrote:I'm working on a more "robust" debugging ability, and included in it, it will show you emails that it sent, and exactly who it sent them to. So maybe that will help.
That will be very handy indeed.

Btw, is there a way that I can contact you directly, more easily than via a forum post? Do you check personal messages on here (forums.cacti.net)? I don't recall seeing your e-mail at cactiusers...
Email is usually a good way,
jimmy -()- sqmail -()- org
I get way too much spam already to just post it openly anymore.
Mikkel
Posts: 32
Joined: Thu May 12, 2005 12:41 am

Post by Mikkel »

Mikkel wrote:I don't know if this question has been asked before, but I am experiencing some kind of memory leak with the Monitor plugin. Internet Explorer seems to use loads of memory when the monitor plugin is displayed. I left IE running over night displaying the monitor page and the memory usage went from 64MB to 216MB!

Anybody else ever noticed this?
Kick!

Cigamit, have you heard about this before?
emericklaw
Posts: 21
Joined: Thu Jan 19, 2006 1:17 pm

Post by emericklaw »

Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

emericklaw wrote:Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
Yep, the same thing actually happened here when we used Internet Explorer to do the job, its an IE memory leak. Firefox works fine. For some added benefit, You can also use the Firefox extension "ReloadEvery" which allows you to automatically reload the page every few minutes. We just set it to 5 minutes, and if the page every stops reloading (maybe times out?) the extension will go ahead and reload it again anyways for us. Its not necessary, but it ensures that our monitor page is always refreshing.
Mikkel
Posts: 32
Joined: Thu May 12, 2005 12:41 am

Post by Mikkel »

emericklaw wrote:Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
cigamit wrote:
emericklaw wrote:Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
Yep, the same thing actually happened here when we used Internet Explorer to do the job, its an IE memory leak. Firefox works fine. For some added benefit, You can also use the Firefox extension "ReloadEvery" which allows you to automatically reload the page every few minutes. We just set it to 5 minutes, and if the page every stops reloading (maybe times out?) the extension will go ahead and reload it again anyways for us. Its not necessary, but it ensures that our monitor page is always refreshing.
I thought it happened in Firefox as well, but I have not yet tested it in the way I did with IE. I'll see if I get to it next week, I'll let you know.
Mikkel
Posts: 32
Joined: Thu May 12, 2005 12:41 am

Post by Mikkel »

Mikkel wrote:
emericklaw wrote:Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
cigamit wrote:
emericklaw wrote:Thats more of an IE problem than the monitor plugin. All the plugin is doing is displaying a page and a few images.

Have you tried firefox?
Yep, the same thing actually happened here when we used Internet Explorer to do the job, its an IE memory leak. Firefox works fine. For some added benefit, You can also use the Firefox extension "ReloadEvery" which allows you to automatically reload the page every few minutes. We just set it to 5 minutes, and if the page every stops reloading (maybe times out?) the extension will go ahead and reload it again anyways for us. Its not necessary, but it ensures that our monitor page is always refreshing.
I thought it happened in Firefox as well, but I have not yet tested it in the way I did with IE. I'll see if I get to it next week, I'll let you know.
Well, I finally came around to testing it with Firefox 1.5 and I'm sad to say the problem was not solved. The amount of memory consumed was less than in IE, but there was a leak nevertheless. I left work at 16:00 with one Firefox window open displaying the monitor page. Memory usage at that point was 24 MB. When I arrived at work this morning at 7:30, memory usage of Firefox was 126 MB. :(

Everytime I press the F5 button I can see the memory usage increasing in the Task Manager.

Am I really the only one with this problem?
User avatar
psyber
Cacti User
Posts: 84
Joined: Tue Aug 02, 2005 7:18 pm

Post by psyber »

I think its a browser problem. I can replicate this in IE by repeatidly reloading google the memory usage just keeps going up (not as much as I see with the monitor page) but none the less I see it goes up and does not come down. Firefox seems more agressive in cleaning up after itself but it still consumes more and more memory the more you refresh a page. I even tried it with a blank html only page and a plaintext file from the local file system. Its the browsers.
CPF
Posts: 27
Joined: Sun Aug 28, 2005 8:25 am

Downed Host Notifications

Post by CPF »

Hi,

I'm trying to figure out how the 'Dead Hosts Notifications' works.

If I'm monitoring a host, then stop the SNMP service on that host (to test), Thold (and Cacti) will report that host as 'Down'.

BUT, I don't get an email Alerting me to the fact, even though I've enabled this option...

Is this by design, because the host isn't really down; just not responding to SNMP?

I'm using:

- SMTP Email Method (Test Mail and actual Threshold Alerts work fine)
- Downed Host Detection = SNMP - Reliable
- Ping Type = UDP Ping

Can anyone confirm if it's me that's gone a bit mad, or Thold.

Many Thanks,

Graham.
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

Might be a good time to ask for an update on that debug tool - to see what the e-mail function is doing.
User avatar
psyber
Cacti User
Posts: 84
Joined: Tue Aug 02, 2005 7:18 pm

Post by psyber »

OK I had to break out the code on this on:


from setup.php:

Code: Select all

function thold_update_host_status ($update) {
	global $config;
	$deadnotify = (read_config_option("alert_deadnotify") == "on");
	if (!$deadnotify) return;
	if (!$update['issue_log_message']) return;

	include_once($config["base_path"] . '/plugins/thold/thold-functions.php');

	$host_id = $update['host_id'];
	$hosts = $update['hosts'];
	$status = $update['status'];

	if ($status != HOST_DOWN) {
		$subject = "Host Notice : " . $hosts[$host_id]["hostname"] . " returned from DOWN state";
		$msg= $subject;
		thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
	} else {
		$subject = "Host Error : " . $hosts[$host_id]["hostname"] . " is DOWN";
		$msg ="Host Error : " . $hosts[$host_id]["hostname"] . " is DOWN<br>Message : " . $hosts[$host_id]["status_last_error"];
		thold_mail(read_config_option("alert_email"), '', $subject, $msg, '');
	}
}
and from graph_thold.php

Code: Select all

	switch($host["status"]) {
		case HOST_UNKNOWN:
		$color = "gray";
		$status = "Unknown";
		break;
		case HOST_DOWN:
		$color = "red";
		$status = "DOWN";
		break;
		case HOST_RECOVERING:
		$color = "yellow";
		$status = "Recovering";
		break;
		case HOST_UP:
		$color = "green";
		$status = "up";
		break;
	}
So if I read it right and your host shows red and says down then you should get an email. I'm not sure if it waits the set number of poll cycles or if it fires right away. You could try setting $debug=1 on line 21 of check-thold.php and see what if anything turns up in the logs.
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

I think the main highlights of the code to point out are theses...

1. You must have an Alert e-mail for it to send an email to. If needed, I could add an option for another email address besides the global one.

2. Cacti should believe that a host went down that was previously up (or vice-versa). I have no control over this, its all Cacti's internal code, so it should be working perfectly.

3. Your mail functions should be setup correctly. It uses the same functions as the regular thold mails, so if those are working, or the test emails are working everything should be fine.

If all those are correct, but you still don't receive emails, I will create a "heavily" debuggable version for you to try out so you can see what is happening, if anything...
CPF
Posts: 27
Joined: Sun Aug 28, 2005 8:25 am

Post by CPF »

Thanks all,

OK, just to confirm what I've got set. In 'Console\Settings\Alerting/Thold', I've got the following set:

Alert e-mail = deleted@deleted.com
Dead Hosts notifications = Ticked

And from the database [with server / my email removed]:

mysql> select * from settings where name like'%alert%';
+------------------------+--------------------------------------+
| name | value |
+------------------------+--------------------------------------+
| alert_base_url | http://server.domain.com:9081/ |
| alert_bl_past_default | 86400 |
| alert_bl_percent_def | 20 |
| alert_bl_timerange_def | 10800 |
| alert_bl_trigger | 3 |
| alert_deadnotify | on |
| alert_email | deleted@deleted.com |
| alert_exempt | on |
| alert_notify_bl | on |
| alert_notify_default | on |
| alert_repeat | 12 |
| alert_show_alerts_only | |
| alert_show_host_status | on |
| alert_syslog | |
| alert_trigger | 1 |
+------------------------+--------------------------------------+

I've tried turning on the 'Debug' option in 'check-thold.php' as suggested by psyber.

I'm only testing from one host for CPU, so the debug log contains:

03-09-06.09:38:08 element: CLOSE-100235 - CPU Utilization - CPU0 alertstat: 0 graph_id: 1740 thold_low: thold_hi: 50 rra: 2119 trigger: 1 triggerct: 0 current: 3 logset:

The cacti log for the same poll contains:

03/09/2006 09:38:07 AM - CACTID: Poller[0] Host[166] ERROR: HOST EVENT: Host is DOWN Message: Host did not respond to SNMP
03/09/2006 09:38:08 AM - SYSTEM STATS: Time:8.1076 Method:cactid Processes:10 Threads:2 Hosts:3 HostsPerProcess:1 DataSources:32 RRDsProcessed:17
03/09/2006 09:38:08 AM - THOLD: Poller[0] Checking Thresholds

And just to totally confirm, the Database has:

mysql> select id,disabled,status,status_fail_date from host where id=166;
+-----+----------+--------+---------------------+
| id | disabled | status | status_fail_date |
+-----+----------+--------+---------------------+
| 166 | | 1 | 2006-03-09 09:38:00 |
+-----+----------+--------+---------------------+

BUT, still no email...

I there's anything else that anyone can suggest, I'm happy to try.

Just to confirm, Test Email and Threshold breach Emails work just fine. It's only Downed Host notifications.

Thanks to all,

Graham.
(Sorry about the bad spacing in the database output)
ksoliz
Posts: 14
Joined: Wed Mar 01, 2006 6:34 pm

Post by ksoliz »

Ok so I’m running ubuntu server 5.10, my cacti setup differs a somewhat then most... I used apt-get to install all the necessary components for cacti. The install path for cacti is sitting in /usr/share/cacti/site with a virtual alias setup in apache, I have no /var/www/html/cacti path. Also in include/config.php, cacti is getting the DB info from a file sitting in /etc/cacti/debian.php...

Code: Select all

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
require('/etc/cacti/debian.php');
My question is will any of this cause issues when trying to install this plug-in mod or for that matter any other patches or mods? I went ahead and downloaded and ran patch using dryrun. Here is what I got...

Code: Select all

root@ks-ubuntu:/usr/share/cacti/site# patch -p1 -N --dry-run < cacti-plugin-0.8.6f.diff
(Stripping trailing CRs from patch.)
patching file data_sources.php
(Stripping trailing CRs from patch.)
patching file graphs_new.php
(Stripping trailing CRs from patch.)
patching file include/config_arrays.php
(Stripping trailing CRs from patch.)
patching file include/config_form.php
(Stripping trailing CRs from patch.)
patching file include/config.php
Hunk #1 FAILED at 26.
Hunk #2 succeeded at 172 (offset -3 lines).
1 out of 2 hunks FAILED -- saving rejects to file include/config.php.rej
(Stripping trailing CRs from patch.)
patching file include/config_settings.php
(Stripping trailing CRs from patch.)
patching file include/plugins.php
(Stripping trailing CRs from patch.)
patching file include/top_graph_header.php
(Stripping trailing CRs from patch.)
patching file include/top_header.php
(Stripping trailing CRs from patch.)
patching file lib/api_device.php
(Stripping trailing CRs from patch.)
patching file lib/functions.php
(Stripping trailing CRs from patch.)
patching file lib/html_form.php
(Stripping trailing CRs from patch.)
patching file lib/html.php
(Stripping trailing CRs from patch.)
patching file plugins/index.php
(Stripping trailing CRs from patch.)
patching file poller.php
At first glance it appears everything would work with the exception of the stuff for config.php which I assume I could fix manually. I was just wondering if the custom way apt-get installs cacti would cause issues.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests