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 »

That because I need You 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]
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

sorry. slow internet today. in previous mesage i put my syslog-ng.conf
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 »

Ok, but I need it without my changes.
You after all did a backup copy?
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:Ok, but I need it without my changes.
You after all did a backup copy?

my original syslog-ng.conf

Code: Select all

# 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, facility, priority, date, time, message) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );\n")
	 template-escape(yes)
	);
 };

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

# vim: syntax=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 »

Ya! :D
Soo here it is must work for you:

Code: Select all

				source net {
					udp();
				};
				destination d_mysql {
				    pipe("/tmp/mysql.pipe"
			            template("INSERT INTO syslog_incoming             (host, facility, priority, date, time, message) VALUES ( '$HOST', '$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:Ya! :D
Soo here it is must work for you:

Code: Select all

				source net {
					udp();
				};
				destination d_mysql {
				    pipe("/tmp/mysql.pipe"
			            template("INSERT INTO syslog_incoming             (host, facility, priority, date, time, message) VALUES ( '$HOST', '$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); };

maybe i must use plugin_camm_syslog?
when i use plugin_camm_syslog_incoming i not see any new messages.

or i must change in my camm settings syslog ?

now i have base syslog
table syslog incoming


error on cacti log
04/10/2009 11:04:04 AM - 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'
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 »

Use what you set in "Syslog incoming table" setting in camm.
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 »

please give me you table status on your syslog database
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 »

mysql> show table status from syslog_ng \G;
*************************** 1. row ***************************
Name: plugin_camm_syslog
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 169276
Avg_row_length: 148
Data_length: 44156280
Max_data_length: 281474976710655
Index_length: 26972160
Data_free: 18955592
Auto_increment: 1214230
Create_time: 2009-02-09 18:16:55
Update_time: 2009-04-10 12:55:13
Check_time: 2009-02-09 18:16:55
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment: SNMPTT plugin SYSLOG Data
*************************** 2. row ***************************
Name: plugin_camm_syslog_incoming
Engine: MEMORY
Version: 10
Row_format: Fixed
Rows: 0
Avg_row_length: 468
Data_length: 0
Max_data_length: 234380016
Index_length: 0
Data_free: 0
Auto_increment: 1
Create_time: NULL
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
2 rows in set (0.00 sec)
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 »

i check my table:
*************************** 1. row ***************************
Name: plugin_camm_syslog
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 0
Avg_row_length: 0
Data_length: 0
Max_data_length: 281474976710655
Index_length: 1024
Data_free: 0
Auto_increment: 1
Create_time: 2009-04-10 12:18:00
Update_time: 2009-04-10 12:18:00
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment:
why? i think what problem this.
04/10/2009 12:29:05 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'
we put into 2 tables with different field name

[/code]
Cacti v.087g + PAv2.9
erickbe
Cacti User
Posts: 52
Joined: Sat Jan 17, 2009 1:01 am

Post by erickbe »

2 erickbe:
To answer I need mysql dump of plugin_camm_tree and rows from table host with correct and incorrect devices
How can I just get a dump of those 2 tables? Not really good with MySQL yet.
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

syslog problems

Post by niobe »

Hi gthe,

I have just installed 1.5.3 and have snmptt working, but no joy with syslog-ng.

syslog-ng.conf:

Code: Select all

source external { udp(ip(0.0.0.0) port(514)); };

destination d_mysql {
    pipe("/tmp/mysql.pipe" template("INSERT INTO plugin_camm_syslog (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(external); destination(d_mysql); };
My syslog-ng still logs to files ok, but nothing is happening in the db. I don't normally use mysql for syslog messages, so I just want to use the cacti db directly to put messages in - no need for a separate syslog db. So I manually imported plugin_camm_syslog.sql into the cacti db. Settings page has been updated to reflect this.

I also had to manually create the named pipe as I had syslog-ng errors complaining it couldn't open the file:

Code: Select all

mkfifo /tmp/mysql.pipe
Should this have been automatically created?

No errors in cacti log (even with camm debug mode) and no errors in syslog-ng log either. The named pipe always shows zero bytes but I think this may be normal:

Code: Select all

oberon1 sql # ls -l /tmp/mysql.pipe
prw------- 1 root root 0 Apr 13 19:12 /tmp/mysql.pipe
Syslog messages definitely coming in, and syslog-ng is not complaining. Any ideas where to start?
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

i can't configure snmptt. in my unknown traps:
SNMPv2-SMI::enterprises.81.1.1.1.0.2 10.1.1.2 10.1.1.2 01-Jan-1970 \'SNMPv2-SMI::enterprises.81.9.1.1.14.7.9 (unknown):01 00 00 00 00 00 SNMP-COMMUNITY-MIB::snmpTrapAddress.0 (unknown):10.1.40.72\'
SNMPv2-SMI::enterprises.81.1.1.1.0.1 10.1.1.2 10.1.1.2 01-Jan-1970 \'SNMPv2-SMI::enterprises.81.28.2.1.1.1.31.7.9 (unknown):4 SNMP-COMMUNITY-MIB::snmpTrapAddress.0 (unknown):10.1.1.2\'
IF-MIB::linkDown 10.1.1.2 10.1.1.2 01-Jan-1970 \'IF-MIB::ifIndex.7177 (unknown):7177 SNMP-COMMUNITY-MIB::snmpTrapAddress.0 (unknown):10.1.40.72 SNMPv2-MIB::snmpTrapEnterprise.0 (unknown):SNMPv2-SMI::enterprises.81.1.1.1\'
snmptt.ini
TrapFiles]
# A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path
# and filename. Ex: '/etc/snmp/snmptt.conf'
snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
/etc/snmp/extreme.conf
/etc/snmp/avaya.conf
END
and why my date at 1970? switches configured with ntp server

where i repair config?
Attachments
avaya.conf.txt
(59.25 KiB) Downloaded 585 times
snmptt.conf.extremehost.txt
(29.19 KiB) Downloaded 586 times
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 »

erickbe wrote:
2 erickbe:
To answer I need mysql dump of plugin_camm_tree and rows from table host with correct and incorrect devices
How can I just get a dump of those 2 tables? Not really good with MySQL yet.
On linux:

Code: Select all

mysqldump --opt -q --password=<you password> cacti plugin_camm_tree > plugin_camm_tree.sql
and

Code: Select all

mysql> select * from host where id='<you device id>' \G;
and send output to me in PM
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 »

niobe wrote:Hi gthe,

I have just installed 1.5.3 and have snmptt working, but no joy with syslog-ng.
........
Do you read this - http://forums.cacti.net/viewtopic.php?t=26040
noflies wrote:HOW-TO Install Syslog 0.5.2 plugin on Linux/Unix Cacti versions 0.8.7, 0.8.7a and 0.8.7b
-------------------------------------------------------------------------------------------
[submitted by noflies, 26 Feb 2008]
[updated by noflies, 16 May 2008 with suggestions by joez...adding "SQL grant priv" commands in 4a]

NOTE: These instructions reference variables for documentation purposes only.
<cacti_path> Cacti's root path (usually /var/www/html or /usr/share/cacti)
<cacti_user> Cacti's user for polling access (usually cacti or cactiuser)
<cacti_pass> Cacti's password for polling access (usually cacti or cactiuser)
<cacti_dbuser> Cacti's user for database access (usually cacti or cactiuser)
<cacti_dbpass> Cacti's password for database access (usually cacti or cactiuser)
<http_user> HTTP daemon user for running web server (usually apache)
<http_pass> HTTP daemon password for running web server
Substitute your specific locations and parameters.

........................................

5. Edit the /etc/init.d/syslog-ng file.
--INSERT the following line AFTER the "start() {" line

Code: Select all

/sbin/syslogtomysql &
--INSERT the following line AFTER the "stop() {" line

Code: Select all

killall -9 syslogtomysql > /dev/null
6. Create the /sbin/syslogtomysql bash script.

Code: Select all

#!/bin/bash
if [ ! -e /tmp/mysql.pipe ]; then
        mkfifo /tmp/mysql.pipe
fi  

while [ -e /tmp/mysql.pipe ]
do
        mysql -u <cacti_dbuser> --password=<cacti_dbpass> syslog < /tmp/mysql.pipe
done
NOTE: Change the above user credentials to your specific installation.

7. Change the /sbin/syslogtomysql file permissions to 755 owned by root:root.

Code: Select all

shell> chmod 755 /sbin/syslogtomysql
shell> chown root:root /sbin/syslogtomysql
8. ADD the following lines to the /etc/syslog-ng/syslog-ng.conf file to the END of the file

Code: Select all

source net {
    udp();
};

destination d_mysql {
    pipe("/tmp/mysql.pipe"
    template("INSERT INTO syslog_incoming (host, facility, priority, date, time, message) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );\n")
    template-escape(yes)
     );
};
[/quote]
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests