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

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

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

Post by gthe »

New version in first post:
CAMM --- 1.5.3 ---2009-04-06
  • - Fix showing "Console" and "Graph" tab based on user right;
    - Change sorting menu tree to [device_type_name asc, description, eventname];
    - Add option to send one mail per trap/syslog rather than grouping records together and sending one mail with all records;;
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
savagemindz
Posts: 10
Joined: Wed Feb 14, 2007 10:39 am

Post by savagemindz »

Hi gthe,
- Add option to send one mail per trap/syslog rather than grouping records together and sending one mail with all records;;
Sorry I am probably just being blind but where is the option to select this?

As a workaround I looked in the code and see where you are setting this so hacked the entry straight into a test rule in the DB and it works great I just couldn't work out how to set email_mode=2 using the front end.

Thanks

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

Post by gthe »

Clear browser cache!
Attachments
email_mode.png
email_mode.png (3.5 KiB) Viewed 7486 times
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: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

gthe wrote:Clear browser cache!
Gthe - in Savagemindz's defence, this function doesn't appear even after you clear the browser cache...
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

Post by gthe »

It is strange..
Try replace this file.
Attachments
cacti.plugin.camm-min.rar
(47.48 KiB) Downloaded 324 times
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: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

No difference :(

EDIT - second version posted works :)
Last edited by mcutting on Thu Apr 09, 2009 6:20 am, edited 1 time in total.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
savagemindz
Posts: 10
Joined: Wed Feb 14, 2007 10:39 am

Post by savagemindz »

Hi gthe,

Ok the original file didn't work (even after I cleared my browsers cache :oops: ) for me but the updated one you just posted does.

Thanks for your help again. :D

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

Post by L0gRuS »

i'm very confused.
i can't configure camm plugin and think what tommorow i continiutes work with it. but now i check plugin and i see what camm is worked
Now i have only one error:

04/09/2009 09:09:04 PM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1054', SQL:"INSERT INTO `syslog`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM `syslog`.`syslog_incoming` WHERE status=2'
on forum i search this
I think this is the fix in poller_camm.php:420
before
Code:

db_execute("INSERT INTO `" . read_config_option("camm_syslog_db_name") . "`.`plugin_camm_syslog` " . "SELECT * FROM " . $syslog_table . " WHERE status=2");

change to
Code:

db_execute("INSERT INTO `" . read_config_option("camm_syslog_db_name") . "`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) " . " SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM " . $syslog_table . " WHERE status=2");
but i have this fix.
How i can fix it?
Cacti v.087g + PAv2.9
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

just try

Code: Select all

INSERT INTO `syslog`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM `syslog`.`syslog_incoming` WHERE status=2'
in mysql and show error.
Also show syslog-ng.conf file.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
erickbe
Cacti User
Posts: 52
Joined: Sat Jan 17, 2009 1:01 am

Post by erickbe »

Thanks for the update fixing the tabs across the top.

One problem I have is, the tree on mine doesn't work out correctly.

I have devices in the root that are part of my "Cisco Router" group in Cacti but only am seeing 1 device under the "Cisco Router" section in tree and rest of those devices in root.

Is there a way to update the tree after it adds host to the camm SQL table? If I use PhpMyadmin and modify the tree SQL tables then I can put them whereever I want which is ok. I kind of like would like to be able to build this tree to suit my needs rather then it inherit it's structure from Cacti.

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

Post by gthe »

2 erickbe:
To answer I need mysql dump of plugin_camm_tree and rows from table host with correct and incorrect devices
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

Post by L0gRuS »

gthe wrote:just try

Code: Select all

INSERT INTO `syslog`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM `syslog`.`syslog_incoming` WHERE status=2'
in mysql and show error.
Also show syslog-ng.conf file.


my syslog-ng.conf
$camm_stats = sprintf(
"%s" ,
round($stat_ruleDeleSys-$stat_ruleDeleSys_end,4));
db_execute("REPLACE INTO settings (name,value) VALUES ('camm_stats_ruledel_syslog', '" . $camm_stats . "')");
db_execute("UPDATE " . $syslog_table . " set status=2 where status=1");

//IF use syslog pre table - need copy processed message to main table
if ($syslog_use_pretable) {
camm_debug("S1.3 Use syslog pre table. Move processed records to main syslog table");
// db_execute("INSERT INTO `" . read_config_option("camm_syslog_db_name") . "`.`plugin_camm_syslog` " .
// "SELECT * FROM " . $syslog_table . " WHERE status=2");

db_execute("INSERT INTO `syslog`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`)
SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM `syslog`.`syslog_incoming` WHERE status=2'

//db_execute("INSERT INTO `" . read_config_option("camm_syslog_db_name") . "`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) " .
//"SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM " . $syslog_table . " WHERE status=2");
//db_execute("DELETE FROM " . $syslog_table . " where `status`=2");

}

}
}

my snmptt.ini
#
# SNMPTT v1.2 Configuration File
#
# Linux / Unix
#

[General]
snmptt_system_name =
mode = daemon

multiple_event = 1

dns_enable = 0

strip_domain = 1

strip_domain_list = <<END
domain.com
END

resolve_value_ip_addresses = 0

net_snmp_perl_enable = 0

net_snmp_perl_best_guess = 0

translate_log_trap_oid = 0

translate_value_oids = 1

translate_enterprise_oid_format = 1

translate_trap_oid_format = 1

translate_varname_oid_format = 1

translate_integers = 1

mibs_environment = ALL

wildcard_expansion_separator = " "

allow_unsafe_regex = 0

remove_backslash_from_quotes = 0

dynamic_nodes = 0

description_mode = 0

description_clean = 1

threads_enable = 0

threads_max = 10

#time_format = %H:%M:%S

date_time_format = %Y-%m-%d %H:%M:%S

[DaemonMode]
daemon_fork = 1

daemon_uid = snmptt

pid_file = /var/run/snmptt.pid

spool_directory = /var/spool/snmptt/

sleep = 5

use_trap_time = 1

keep_unlogged_traps = 1

[Logging]
stdout_enable = 0

log_enable = 1

log_file = /var/log/snmptt.log

log_system_enable = 0

log_system_file = /var/log/snmpttsystem.log

unknown_trap_log_enable = 1

unknown_trap_log_file = /var/log/snmpttunknown.log

statistics_interval = 60

syslog_enable = 1

syslog_facility = local0

syslog_level_debug = <<END
END
syslog_level_info = <<END
END
syslog_level_notice = <<END
END
syslog_level_warning = <<END
END
syslog_level_err = <<END
END
syslog_level_crit = <<END
END
syslog_level_alert = <<END
END

syslog_level = warning

syslog_system_enable = 1

syslog_system_facility = local0

syslog_system_level = warning

[SQL]
db_translate_enterprise = 1
db_unknown_trap_format = '$-*'
sql_custom_columns = <<END
END

sql_custom_columns_unknown = <<END
END

mysql_dbi_enable = 1

mysql_dbi_host = localhost

mysql_dbi_port = 3306

mysql_dbi_database = cacti

mysql_dbi_table = plugin_camm_snmptt

mysql_dbi_table_unknown = plugin_camm_snmptt_unk

mysql_dbi_table_statistics = plugin_camm_snmptt_stat

mysql_dbi_username = cactiuser

mysql_dbi_password = passforcactisuer

mysql_ping_on_insert = 1

mysql_ping_interval = 300

postgresql_dbi_enable = 0

postgresql_dbi_module = 0

postgresql_dbi_hostport_enable = 0

postgresql_dbi_host = localhost

postgresql_dbi_port = 5432

postgresql_dbi_database = snmptt

postgresql_dbi_table_unknown = snmptt_unknown

postgresql_dbi_table_statistics =

postgresql_dbi_table = snmptt

postgresql_dbi_username = snmpttuser

postgresql_dbi_password = password

postgresql_ping_on_insert = 1

postgresql_ping_interval = 300

dbd_odbc_enable = 0

dbd_odbc_dsn = snmptt

dbd_odbc_table = snmptt

dbd_odbc_table_unknown = snmptt_unknown

dbd_odbc_table_statistics =

dbd_odbc_username = snmptt

dbd_odbc_password = password


dbd_odbc_ping_on_insert = 1

dbd_odbc_ping_interval = 300


stat_time_format_sql = %Y-%m-%d %H:%M:%S

[Exec]

exec_enable = 1

pre_exec_enable = 1

unknown_trap_exec =

unknown_trap_exec_format =

exec_escape = 1

[Debugging]
DEBUGGING = 2

DEBUGGING_FILE =

DEBUGGING_FILE_HANDLER =

[TrapFiles]
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
END

process:
[root@* ~]# /etc/init.d/syslog-ng status
syslog-ng (pid 5914) is running...
[root@* ~]# /etc/init.d/snmptt status
snmptt (pid 17410 17409) is running...
[root@* ~]# /etc/init.d/snmptrapd status
snmptrapd (pid 21792) is running...

cacti syslog:
04/10/2009 09:31:06 AM - UPTIME: Poller[0] Checking Uptime
04/10/2009 09:31:05 AM - SYSTEM THOLD STATS: Time:0.0400 Tholds:11 Hosts:0
04/10/2009 09:31:05 AM - SYSTEM STATS: Time:4.2393 Method:spine Processes:2 Threads:2 Hosts:62 HostsPerProcess:31 DataSources:1255 RRDsProcessed:643
fragment syslog
localhost 2009-04-10 09:14:33 snmptt-sys[0]: Total traps received=0,Total traps translated=0,Total traps ignored=0,Total unknown traps=0 local0 warning

localhost 2009-04-10 09:14:07 snmptrapd[21792]: 2009-04-10 09:14:07 10.1.40.73(via 10.1.40.73) TRAP, SNMP v1, community vata SNMPv2-SMI::mib-2.17 Enterprise Specific Trap (2) Uptime: 103 days, 13:33:27.47 SNMPv2-

and when i activate syslog in camm, on my syslog i not see new messages. only on camm-syslog. how i can duplicate messages to camm and syslog-ng?
Cacti v.087g + PAv2.9
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

L0gRuS wrote:
gthe wrote:just try

Code: Select all

INSERT INTO `syslog`.`plugin_camm_syslog` (`host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert`) SELECT `host`, `sourceip`, `facility`, `priority`, `sys_date`, `message`, `status`, `alert` FROM `syslog`.`syslog_incoming` WHERE status=2'
in mysql and show error.
And ?
Just run this command in mysql and show output

Edit: And I think You show not syslog-ng.conf
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

Edit 2:
L0gRuS wrote: and when i activate syslog in camm, on my syslog i not see new messages. only on camm-syslog. how i can duplicate messages to camm and syslog-ng?

Code: Select all

				source net {
					udp();
				};
				destination d_mysql {
				    pipe("/tmp/mysql.pipe"
			            template("INSERT INTO syslog_incoming             (host, sourceip, fullhost, facility, priority, date, time, message) VALUES ( '$HOST',  '$SOURCEIP', '$FULLHOST','$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );
								  INSERT INTO plugin_camm_syslog_incoming (host, sourceip, facility, priority, sys_date, message, status) VALUES ( '$HOST',  '$SOURCEIP', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$MSG', '0' );\n")
				    template-escape(yes)
				     );
				};

				log { source(net); destination(d_mysql); };
				log { source(s_sys); destination(d_mysql); };
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

Post by L0gRuS »

gthe wrote:Edit 2:
L0gRuS wrote: and when i activate syslog in camm, on my syslog i not see new messages. only on camm-syslog. how i can duplicate messages to camm and syslog-ng?

Code: Select all

				source net {
					udp();
				};
				destination d_mysql {
				    pipe("/tmp/mysql.pipe"
			            template("INSERT INTO syslog_incoming             (host, sourceip, fullhost, facility, priority, date, time, message) VALUES ( '$HOST',  '$SOURCEIP', '$FULLHOST','$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );
								  INSERT INTO plugin_camm_syslog_incoming (host, sourceip, facility, priority, sys_date, message, status) VALUES ( '$HOST',  '$SOURCEIP', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$MSG', '0' );\n")
				    template-escape(yes)
				     );
				};

				log { source(net); destination(d_mysql); };
				log { source(s_sys); destination(d_mysql); };



[root@* ~]# /etc/init.d/syslog-ng restart
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
[root@* ~]# ERROR 1054 (42S22) at line 1: Unknown column 'sourceip' in 'field list'


syslog_incomg:
facility
priority
date
time
host
message
seq
status

Code: Select all

# [size=9]syslog-ng configuration file.
#
# This should behave pretty much like the original syslog on RedHat. But
# it could be configured a lot smarter.
#
# See syslog-ng(8) and syslog-ng.conf(5) for more information.
#
# 20000925 gb@sysfive.com
#
# Updated by Frank Crawford (<Frank.Crawford@ac3.com.au>) - 10 Aug 2002
# 	- for Red Hat 7.3
#	- totally do away with klogd
#	- add message "kernel:" as is done with klogd.
#
# Updated by Frank Crawford (<Frank.Crawford@ac3.com.au>) - 22 Aug 2002
#	- use the log_prefix option as per Balazs Scheidler's email
#

options {
  sync(0);
  time_reopen(10);
  log_fifo_size(1024);
  long_hostnames(off);
  use_dns(yes);
  use_fqdn(no);
  create_dirs(no);
  keep_hostname(no);
  };

source s_sys { pipe ("/proc/kmsg" log_prefix("kernel: ")); unix-stream ("/dev/log"); internal(); };

destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog"); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_mlal { usertty("*"); };
destination d_kernel  { file("/var/log/kern"); };


filter f_filter1     { facility(kern); };
filter f_filter2     { level(info) and
                         not (facility(mail)
                             or facility(authpriv) 
                             or facility(cron)
                             or program("kernel")); };

filter f_filter3     { facility(authpriv); };
filter f_filter4     { facility(mail); };
filter f_filter5     { level(emerg); };
filter f_filter6     { facility(uucp) or
                     (facility(news) and level(crit)); };
filter f_filter7     { facility(local7); };
filter f_filter8     { facility(cron); };
filter f_kernel      { level(info) and program("kernel"); };

#log { source(s_sys); filter(f_filter1); destination(d_cons); };
log { source(s_sys); filter(f_filter2); destination(d_mesg); };
log { source(s_sys); filter(f_filter3); destination(d_auth); };
log { source(s_sys); filter(f_filter4); destination(d_mail); };
log { source(s_sys); filter(f_filter5); destination(d_mlal); };
log { source(s_sys); filter(f_filter6); destination(d_spol); };
log { source(s_sys); filter(f_filter7); destination(d_boot); };
log { source(s_sys); filter(f_filter8); destination(d_cron); };
log { source(s_sys); filter(f_kernel); destination(d_kernel); };

 source net {
               udp();
            };
            destination d_mysql {
                pipe("/tmp/mysql.pipe"
                     template("INSERT INTO syslog_incoming             (host, sourceip, fullhost, facility, priority, date, time, message) VALUES ( '$HOST',  '$SOURCEIP', '$FULLHOST','$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );
                          INSERT INTO plugin_camm_syslog_incoming (host, sourceip, facility, priority, sys_date, message, status) VALUES ( '$HOST',  '$SOURCEIP', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC', '$MSG', '0' );\n")
                template-escape(yes)
                 );
            };

            log { source(net); destination(d_mysql); };
            log { source(s_sys); destination(d_mysql); }; 

# vim: syntax=syslog-ng[/size]

Last edited by L0gRuS on Fri Apr 10, 2009 1:18 am, edited 1 time in total.
Cacti v.087g + PAv2.9
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests