Cacti as a frontend for collecd?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Moderators, Developers

Post Reply
Author
Message
TQ_
Posts: 2
Joined: Mon Jun 30, 2008 1:57 pm

Cacti as a frontend for collecd?

#1 Post by TQ_ » Thu Jul 10, 2008 1:41 pm

Hi,

I want to use collectd for collecting data from multiple hosts as it has much plugins for collecting different data and greater resolution that cacti and it comes with its own network plugin so I dont have to configure snmp for querying remote hosts. The tool however is just for collecting data and putting it in rrdtool DB (which is nice, you can use whatever visualization tool you like).

I`d like to use cacti just as a frontend for collectd - collectd will create data for all hosts and put it in rrdtool, I want to use cacti just for visualizing the data - no polling, no creating rrd files, just visualize from whatever rrdfiles I have. Is this possible and how (a link to some documentation about such setup would be appreciated). There are similiar tools that just do only visualization (like drraw), but cacti has a really nice interface and I would like to use it (ddraw looks like it was made in 199x).

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#2 Post by gandalf » Fri Jul 11, 2008 3:10 pm

Please see http://docs.cacti.net. Find the HowTo section and read rrdtool chapter. There's a hint on using "externally updated rrd files".
But you will NOT love this way.
Even if I do NOT know collectd, I think that cacti has similar functions to be extended by own scripts. See again link from above
Reinhard

Mulciber
Posts: 1
Joined: Sun Nov 22, 2009 4:28 pm

#3 Post by Mulciber » Sun Nov 22, 2009 5:45 pm

Hi,

I've made a script to add automatically the RRDs created by collectd into the Cacti database. It's a bit dirty but it works. Please, make a dump of your database before using this script so if it fails/bugs, you can reload your configuration. There is not a lot of comments (cause the script was not intended to be published) but i can add some.

It creates all the Graph Templates, Data Input Methods, Devices, data sources, etc... so you can use all the features of cacti. The colors are 100% random, but you can change them in the graph templates panel.

Cacti does nothing here. The hosts added by the script are automatically disabled.

'irq' and 'df' are disabled by default, but if you want to graph them, then delete the "#" at the beginning of the lines 47 & 48.

Tested on :
Linux (Ubuntu).
(dunno if it works on windows. If you need so, I may have a look on it)

You need :
Python (2.6)
the Python-Mysql library (MySQLdb)
RRDtool (>= 1.2 ?)

Configuration :
Open the file, and set the parameters :
- The path to the rrds
- Your logins for cacti
- The path for rrdtool (if not the one by default)

Example :
For 1 host, but works for every host in the collectd path

Code: Select all

[email protected]:~$ find /var/lib/collectd/rrd/
/var/lib/collectd/rrd/
/var/lib/collectd/rrd/Evy
/var/lib/collectd/rrd/Evy/disk-sda1
/var/lib/collectd/rrd/Evy/disk-sda1/disk_time.rrd
/var/lib/collectd/rrd/Evy/disk-sda1/disk_merged.rrd
/var/lib/collectd/rrd/Evy/disk-sda1/disk_octets.rrd
/var/lib/collectd/rrd/Evy/disk-sda1/disk_ops.rrd
/var/lib/collectd/rrd/Evy/disk-sda5
/var/lib/collectd/rrd/Evy/disk-sda5/disk_time.rrd
/var/lib/collectd/rrd/Evy/disk-sda5/disk_merged.rrd
/var/lib/collectd/rrd/Evy/disk-sda5/disk_octets.rrd
/var/lib/collectd/rrd/Evy/disk-sda5/disk_ops.rrd
/var/lib/collectd/rrd/Evy/entropy
/var/lib/collectd/rrd/Evy/entropy/entropy.rrd
[...]
Run the script :

Code: Select all

[email protected]:~$ mv ./scripts/collectd2cacti.txt ./scripts/collectd2cacti.py 
[email protected]:~$ chmod +x ./scripts/collectd2cacti.py 
[email protected]:~$ ./scripts/collectd2cacti.py 
Getting values for Evy.

##############################

Database stuff

Host : Evy.
	load
	processes
	users
	entropy
	swap
	memory
	interface
	disk
	cpu
A screenshot :
Image

Please feel free to ask any question in this post, by PM or by email ( thephylax ==at--[nospamplz] gmail__com )

Best regards,
Mathieu.

PS :tell me at least if it works :]
Attachments
collectd2cacti.txt
Rename this file
.txt -> .py
(21.54 KiB) Downloaded 1590 times

skywalka
Posts: 4
Joined: Tue Mar 17, 2009 10:14 pm

#4 Post by skywalka » Fri Jan 22, 2010 1:00 am

Thanks Mulciber! It works perfectly :)

gugansankar
Posts: 13
Joined: Sat Sep 07, 2013 12:30 am

Re: Cacti as a frontend for collecd?

#5 Post by gugansankar » Wed Apr 09, 2014 7:19 am

Thanks Mulciber !. Collectd datas are added perfectly in the Cacti by your script. But the problem here , threshold plugin is not working for me. Means, I tried to enable alert function for the collectd graphs via threshold plugin. Here I can add the threshold entry. But its not fetch the current threshold value for comparison.

Note : By default your script disabled all the checks for this host. I enabled that option too. But No luck.

Please help on this
Attachments
Selection_007.png
Selection_007.png (60.07 KiB) Viewed 5268 times

Post Reply