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
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

#91 Post by gthe » Tue Apr 14, 2009 9:53 am

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

#92 Post by niobe » Tue Apr 14, 2009 11:45 pm

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

#93 Post by gthe » Tue Apr 14, 2009 11:54 pm

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

#94 Post by niobe » Wed Apr 15, 2009 2:54 am

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: 1874
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

#95 Post by mcutting » Wed Apr 15, 2009 3:05 am

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

#96 Post by gthe » Wed Apr 15, 2009 3:13 am

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: 1874
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

#97 Post by mcutting » Wed Apr 15, 2009 3:15 am

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

#98 Post by gthe » Wed Apr 15, 2009 3:52 am

(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: 1874
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

#99 Post by mcutting » Wed Apr 15, 2009 3:59 am

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

#100 Post by L0gRuS » Fri Apr 17, 2009 12:09 am

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

#101 Post by gthe » Fri Apr 17, 2009 12:35 am

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

#102 Post by L0gRuS » Mon Apr 20, 2009 2:10 am

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 4864 times
Cacti v.087g + PAv2.9

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

#103 Post by gthe » Mon Apr 20, 2009 2:21 am

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 172 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: 1874
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Syslog Purge - Not Working ?

#104 Post by mcutting » Wed Apr 22, 2009 1:14 am

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

#105 Post by gthe » Wed Apr 22, 2009 3:54 am

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