CaMM (Cacti Message Management) plugin v1.6.7 2010-08-26

General discussion about Plugins for Cacti

Moderators: Moderators, Developers

Post Reply
Author
Message
User avatar
smlick
Cacti User
Posts: 267
Joined: Tue May 20, 2008 4:09 am
Location: Italy, Rome

#301 Post by smlick » Thu Sep 24, 2009 4:11 am

mcutting wrote:Works :) Rule count is increasing, messages are being deleted, and no longer show up in the main syslog view.

Thanks !
You wrote that now the count is increasing and the message are being deleted but this also happened with the old version.
I use yet the 1.5.4 that work like charm with 2.000.000 of record saved and over 100.000.000 of record deleted by over 20 rules.
I want to upgrade especially for the multi mail into rule but I have fear because this is a production environment and at the moment is not possible a test environment.
Have you find problem with updates from one version to other?
I want to upgrade from 1.5.4 to 1.6.4b, in this case can I upgrade directly from my version to the last?


Regards
Alessio
Cacti Version 0.8.8c production / 0.8.8c test W2008 -- Plugin:Weathermap - Monitor - CAMM 1.6.7 :) - Nectar - GPS Map

Wannes
Posts: 4
Joined: Wed May 13, 2009 6:22 am

#302 Post by Wannes » Thu Sep 24, 2009 4:21 am

Hi,

First of all, thank you for this great plugin.
I have read through this topic and haven't found a solution yet.
problem: created rules aren't being applied to collected data at poll-time.

The "test" rule I created is a simple rule that deletes all syslogs with the name "localhost"
rule name: remove_localhost
rule order: 1
rule enable: enable
filter SQL: host like '%localhost%'
X - Delete record

When I force this rule, the triggered counter raises, however, when left alone and when the poller polls, the number never raises and the localhost syslogs aren't being deleted.

some information about my setup that might help:

OS RHEL 4
Cacti Version 0.8.7b
Camm 1.6.4
Apache/2.0.52
PHP 4.3.9
MySQL 4.1.22

Errors I see in my Cacti log:
09/24/2009 11:15:04 AM - CMDPHP: Poller[0] ERROR: SQL Row Failed!, Error:'1064', SQL:"SHOW TABLE STATUS where Name = 'plugin_camm_tree2';"
09/24/2009 11:10:02 AM - CMDPHP: Poller[0] ERROR: SQL Cell Failed!, Error:'1064', SQL:"SELECT ROW_COUNT()"

User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

#303 Post by gthe » Thu Sep 24, 2009 5:02 am

from mysql site:
ROW_COUNT() was added in MySQL 5.0.1.

Perhaps we should take this into account in the next version
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]

Wannes
Posts: 4
Joined: Wed May 13, 2009 6:22 am

#304 Post by Wannes » Thu Sep 24, 2009 6:10 am

gthe wrote:from mysql site:
ROW_COUNT() was added in MySQL 5.0.1.

Perhaps we should take this into account in the next version
Could it be that this function is only being called in the later versions of camm?
(I didn't have any problems with earlier versions of camm)
and is this function needed for the rule processing?

Wannes
Posts: 4
Joined: Wed May 13, 2009 6:22 am

#305 Post by Wannes » Fri Sep 25, 2009 8:58 am

gthe wrote:from mysql site:
ROW_COUNT() was added in MySQL 5.0.1.

Perhaps we should take this into account in the next version
I searched the folder to see where this function was used.

./poller_camm.php: $stat_allTraps=db_fetch_cell("SELECT ROW_COUNT()");
./poller_camm.php: $stat_allSyslogs=db_fetch_cell("SELECT ROW_COUNT()");

I replaced those lines with the PHP function to check the row count;

$stat_allTraps=mysql_affected_rows();
$stat_allSyslogs=mysql_affected_rows();

It looks like the rules are being applied again, so it works for MySQL4 too.

cspenpen
Cacti User
Posts: 67
Joined: Tue Dec 05, 2006 5:10 am

increase query performance

#306 Post by cspenpen » Wed Sep 30, 2009 1:15 am

Hello Gthe

My camm table(plugin_camm_syslog ) has about 986,763 rows now. Some devices of mine have a lot of rows in table, when I read some devices have many rows that will query about 5~10 seconds to display result..
So..,how to increase query performance?

Thx~
Attachments
camm_rows.PNG
camm_rows.PNG (8.73 KiB) Viewed 5120 times

User avatar
streaker69
Cacti Pro User
Posts: 711
Joined: Mon Mar 27, 2006 10:35 am
Location: Psychic Amish Network Administrator

Re: increase query performance

#307 Post by streaker69 » Wed Sep 30, 2009 3:07 pm

cspenpen wrote:Hello Gthe

My camm table(plugin_camm_syslog ) has about 986,763 rows now. Some devices of mine have a lot of rows in table, when I read some devices have many rows that will query about 5~10 seconds to display result..
So..,how to increase query performance?

Thx~
Google for Mysql performance tuning. There's a lot of things you can do.
Attachments
CammRows.gif
CammRows.gif (2.19 KiB) Viewed 5094 times
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1

cspenpen
Cacti User
Posts: 67
Joined: Tue Dec 05, 2006 5:10 am

Re: increase query performance

#308 Post by cspenpen » Wed Sep 30, 2009 8:37 pm

streaker69 wrote:
cspenpen wrote:Hello Gthe

My camm table(plugin_camm_syslog ) has about 986,763 rows now. Some devices of mine have a lot of rows in table, when I read some devices have many rows that will query about 5~10 seconds to display result..
So..,how to increase query performance?

Thx~
Google for Mysql performance tuning. There's a lot of things you can do.
Hello streaker69

I have tuned mysql performance, I use my-medium.cnf for my.cnf, and I use show status command in mysql to tuned some variable for my environment(2G ram and four core cpu), like

table_cache,sort_buffer_size,key_buffer,tmp_table_size,query_cache_size......

If first loing camm, it will query quickly, but my problem is some devices have a lot of rows which query is very slow. I am not good in php or mysql, so need some suggestions.. thx~
Attachments
camm_rows2.PNG
first loing camm
camm_rows2.PNG (925 Bytes) Viewed 5080 times

L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

#309 Post by L0gRuS » Thu Oct 08, 2009 7:09 am

after upgrade to last version some times in cacti log i look this error

Code: Select all

10/08/2009 04:03:13 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:10 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:03:08 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:05 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:02 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:02:57 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:02:54 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:02:50 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','all',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE 1=1 GROUP BY `host`, `sysl`.`priority`' 10/08/2009 04:03:13 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:10 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:03:08 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:05 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:03:02 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','hour',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d-%H')='2009-10-08-16' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:02:57 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'facility',`sysl`.`facility`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`facility`'
10/08/2009 04:02:54 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`'
10/08/2009 04:02:50 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1062', SQL:"INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`) SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','all',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl WHERE 1=1 GROUP BY `host`, `sysl`.`priority`' 
who have any idea about it?
Cacti v.087g + PAv2.9

User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Re: increase query performance

#310 Post by gthe » Thu Oct 08, 2009 7:24 am

cspenpen wrote: If first loing camm, it will query quickly, but my problem is some devices have a lot of rows which query is very slow. I am not good in php or mysql, so need some suggestions.. thx~
Sorry for this late response - try this:

Code: Select all

optimize table plugin_camm_syslog;
optimize table plugin_camm_tree2;
L0gRuS - 1062 is mysql "Duplicate entry error".
Try run manually this sql:

Code: Select all

INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`)
SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl
WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`
to see full error description.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]

L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Re: increase query performance

#311 Post by L0gRuS » Thu Oct 08, 2009 9:24 am

L0gRuS - 1062 is mysql "Duplicate entry error".
Try run manually this sql:

Code: Select all

INSERT INTO `plugin_camm_temp` (`hostname`,`gr_f`,`gr_v`,`type`,`period`,`agentip_source`,`count`)
SELECT `sysl`.`host`, 'priority',`sysl`.`priority`, 'syslog','day',`sysl`.`sourceip`,count(*) FROM `syslog`.`plugin_camm_syslog` as sysl
WHERE DATE_FORMAT(`sys_date`,'%Y-%m-%d')='2009-10-08' GROUP BY `host`, `sysl`.`priority`
to see full error description.[/quote]

full description:


ERROR 1062 (23000): Duplicate entry 'host-priority-crit-syslog-day-127.0.0.1' for key 1


i think what in camm action need add action delete all row at this device.
Cacti v.087g + PAv2.9

User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Re: increase query performance

#312 Post by gthe » Fri Oct 09, 2009 12:16 am

L0gRuS wrote: i think what in camm action need add action delete all row at this device.
Already done.

May be you just try:

Code: Select all

truncate plugin_camm_temp ;
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]

mcutting
Cacti Guru User
Posts: 1874
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

CAMM - HTML Email Notifications

#313 Post by mcutting » Mon Oct 19, 2009 1:43 am

I was asked to convert the existing test-only emails from CAMM into HTML (don't ask why). If you'd like a similar function, make the following changes around line 467 in \camm\lib\camm_functions.php

Code: Select all

function camm_sendemail($to, $from, $subject, $message) {
 $headers = "MIME-Version: 1.0\r\n";
 $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

 	if (camm_check_dependencies()) {
 		camm_debug("  Sending Alert email to '" . $to . "'\n");
 		send_mail($to, $from, $subject, "<html><body>$message</body></html>", $headers);
 	} else {
 		camm_debug("  Error: Could not send alert, you are missing the Settings plugin\n");
 	}
 }
In addition to this, I also made some changes around line 748 to "pretty" the format of the text:

Code: Select all

                $alertm .= "<b>An alert has been issued that requires your attention.</b><br><br>";
									$alertm .= 'Host :      ' . $alerted_trap['host'] . "<br>";
									$alertm .= 'Date :      ' . $alerted_trap['sys_date'] . "<br>";
									$alertm .= 'IP Address :  ' . $alerted_trap['sourceip'] . "<br>";
									$alertm .= 'Facility :  ' . strtoupper($alerted_trap['facility']) . "<br>";
									$alertm .= 'Priority :  ' . strtoupper($alerted_trap['priority']) . "<br>";
									$alertm .= 'Message  :  ' . $alerted_trap['message'] . "<br><br>";					
									$alertm .= 'Alert : <b><font color=red>'  . $rule['email_message'] . "</b></font color=red><br><br>";			
I suppose we could have a drop-down in the settings to switch this on or off if gthe wants to incorporate it.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b

User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

#314 Post by gthe » Mon Oct 19, 2009 6:02 am

mcutting wrote: I suppose we could have a drop-down in the settings to switch this on or off if gthe wants to incorporate it.
No problem.
Thanks.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]

User avatar
mpdsville1
Cacti User
Posts: 71
Joined: Wed Mar 16, 2005 12:11 pm
Location: Albany , NY , USA

#315 Post by mpdsville1 » Thu Oct 22, 2009 11:19 am

Wonderful Plugin!
I'm using this plugin to monitor TRAPS only. Its all working just fine and I know how to change the snmptt.conf to change the severity of a trap, but I'm having trouble understanding how to manipulate the color displayed based on the severity of the trap.

What needs to be changed to make a TrapSeverity Normal = Green and TrapSeverity Major = Red? Currently both display as black txt on white bg.
Mike Donnelly , Albany , NY
| Cacti 0.8.7g | Spine 0.8.7g | MySQL 5.0.77 | Net-SNMP 5.3.2.2 | Apache 2.2.3 | PHP 5.3.3 | RRDtool 1.2.27 | Rhel6 | Dual Xeon [email protected] | Sunfire x4150

Post Reply