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 »

2 L0gRuS - And what in you snmptrapd.log ?

Edit: data may be incorrect if they come in different format that in snmptt.ini. May be you also need capture snmp trap in interface by tcpdump
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

Hi Gthe,
gthe wrote:Do you read this - http://forums.cacti.net/viewtopic.php?t=26040
Are you saying the syslog cacti plugin is a requirement for SNMPTT syslog? That's not very clear from your statement where you say to install syslog-ng:
gthe wrote:1. Install syslog-ng ([HOWTO] Install Syslog-ng on Linux/Unix Cacti vers - http://forums.cacti.net/viewtopic.php?t=26040)
I didn't follow this since I already know how to install syslog-ng and had it installed. If syslog-ng needs to be configured in a particular way I think better to copy that part of the thread to your original post to minimise the cross-referencing confusion :) Or do I need to use syslog plugin and follow the whole guide?

cheers,

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

Post by gthe »

ok. Do you do this:
noflies wrote: 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> <cacti_db_name> < /tmp/mysql.pipe
done
NOTE: Change the above user credentials to your specific installation.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

Ok the penny dropped and I have this working now. GTHE this is a very cool plugin as I have mentioned before.

So here is the process followed. This should work for anyone who doesn't want to use the syslog cacti plugin, but does want to log direct to the cacti database. If you are just using camm I don't see any reason to create a separate syslog database.

1) Create the plugin_camm_syslog table

Code: Select all

shell> mysql --user=<cacti_user> --password=<cacti_pass> cacti < <cacti_path>/plugins/camm/sql/plugin_camm_syslog.sql
2) 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
3) Create the /sbin/syslogtomysql bash script.

ENTER the following text

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_user> --password=<cacti_pass> cacti < /tmp/mysql.pipe
done
NOTE: Change the above user credentials to your specific installation.

4) Change the /sbin/syslogtomysql file permissions to 755 owned by root:root (if it is not already)

Code: Select all

shell> chmod 755 /sbin/syslogtomysql
shell> chown root:root /sbin/syslogtomysql
5) 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 plugin_camm_syslog (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); };
NOTE: The "template(" line begins with "template(" and ends with the $MSG' );\n"). The line may appear to wrap due to the length of the line. MAKE SURE your config file does not break the line apart.

6) Restart the syslog-ng daemon

Code: Select all

shell> /etc/init.d/syslog-ng restart
7) Change CAMM db name to 'cacti' in settings!

8. Generate syslog and verify that it is present in the database

Code: Select all

mysql> SELECT * from plugin_camm_syslog;
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

One thing I have noticed with CAMM is that the auto-purging of records doesn't seem to work ?

I might have understood this incorrectly, but I read it that (I have mine set for 3 days - Syslogs) after 3 days, the data should be removed from the database ? At present, I'm having to execute commands manually in MySQL to keep the size of the DB down.
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 »

mcutting wrote:One thing I have noticed with CAMM is that the auto-purging of records doesn't seem to work ?

I might have understood this incorrectly, but I read it that (I have mine set for 3 days - Syslogs) after 3 days, the data should be removed from the database ? At present, I'm having to execute commands manually in MySQL to keep the size of the DB down.
What is the "max rows in table" and "max rows per device in day" config ?
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 »

Max Rows In Table = 50000
Max Rows Per Device In Day = 1200

Currently, I have 40607 rows.
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 »

(40607 < 50000) => no autopurge
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:(40607 < 50000) => no autopurge
Thanks - So I need to lower this then...
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
L0gRuS
Cacti User
Posts: 127
Joined: Thu Nov 06, 2008 7:57 am

Post by L0gRuS »

today i see new error

Code: Select all

04/17/2009 09:02:05 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'1054', SQL:"DELETE FROM `plugin_camm_snmptt` where (date(`sys_date`) = date('2009-04-15')) and `hostname`='xxx.xxx.xxx.xxx' order by `traptime` desc limit 1518' 
i think what plugin want delete rows (upper limit) but it can't
why it cant?
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 »

Thaks for reporting. Fixed file in attach. Please replace it.
Attachments
poller_camm.rar
(4.65 KiB) Downloaded 182 times
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:Thaks for reporting. Fixed file in attach. Please replace it.

Big Thanks. no error in log.

But now error:


when i clicked ok. all my syslog message delete from this rule, because erased sql field.
Attachments
camm2.JPG
camm2.JPG (82.84 KiB) Viewed 5674 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 »

L0gRuS, sorry, my mistake.
Fix in attach. I also update attach in first post.
Thanks for reporting.
Attachments
camm_functions.rar
(5.72 KiB) Downloaded 218 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:

Syslog Purge - Not Working ?

Post by mcutting »

Hi gthe,

I've been enjoying this plugin for several weeks now. The only "bug" I have noticed now is that the auto purge of records doesn't seem to work (for me anyway). I have the max rows set at 40,000, and am currently at 107,000 rows - no auto prune so far.

Any thoughts ? I have written a custom sql query that I have to fire off manually in phpMyAdmin to dump the records out of the syslog db to prevent it from becoming huge.

Thanks
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 »

mcutting, can you show me result of sql query:

Code: Select all

SELECT * FROM settings where name like 'camm_autop%' or name like 'camm_sys%';
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 2 guests