[Reconnoiter-users] collectd integration

Dan Di Spaltro dan.dispaltro at gmail.com
Sun Jul 26 21:30:22 EDT 2009


I added very *very* basic support for collectd to noit.  It is very
rough, but it actually works, which is pretty cool!  Anyways, there is
a couple weird things I did in the code apart from ripping the whole
parsing routing  from the collectd project.  For instance they have a
concept of a plugin, plugin_instance, type and type_instance, so I
flattened that out and basically everything is under the umbrella of
the collectd module.  It uses the get-check-by-reversing
-the-target-and-module, which was a very handy construct.

Here are a couple things that need doing
* I didn't really even try to get it working with ipv6 so that needs work.
* look for a better way to interface with the collectd system.  I had
to rip out a ton of structs from all sorts of files to get it working.
 libcollectdclient looks promising.
* flattening out the names is kinda wonky, should be reviewed.
* maybe add a configuration thing so it only parses stats once every X mins.
* Didn't make any attempt to document using the xml and xmlh facilities.

I actually don't know if its logging correctly but it is listening on
a UDP port and receiving requests from the collectd instance, parsing
them and hopefully adding them to jlog.  Again, it is super early and
there is a lot that needs to be cleaned up and reviewed but this was
an itch for us that I have started to scratch.

Dan Di Spaltro
-------------- next part --------------
Index: modules/Makefile.in
--- modules/Makefile.in	(revision 790)
+++ modules/Makefile.in	(working copy)
@@ -25,7 +25,7 @@
 MODULES=ping_icmp. at MODULEEXT@ http. at MODULEEXT@ postgres. at MODULEEXT@ \
 	lua. at MODULEEXT@ dns. at MODULEEXT@ selfcheck. at MODULEEXT@ \
-	external. at MODULEEXT@ \
+	external. at MODULEEXT@ collectd. at MODULEEXT@ \
 all:	$(MODULES)
@@ -87,6 +87,12 @@
 	@$(MODULELD) $(LDFLAGS) -o $@ ssh2.lo -lssh2
 	@echo "- linking $@"
+collectd. at MODULEEXT@: collectd.lo
+	@$(MODULELD) $(LDFLAGS) -o $@ collectd.lo 
+	@echo "- linking $@"
+collectd.lo: collectd.xmlh
 ssh2.lo:	ssh2.xmlh
 ping_icmp.lo:	ping_icmp.xmlh
@@ -107,6 +113,7 @@
 snmp.lo:	snmp.xmlh snmptrap.xmlh
 	@$(CC) $(CPPFLAGS) $(SHCFLAGS) -c $< -o $@
 	@echo "- compiling $<"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd.c
Type: text/x-csrc
Size: 30873 bytes
Desc: not available
Url : http://lists.omniti.com/pipermail/reconnoiter-users/attachments/20090726/0674cc53/attachment-0001.bin 

More information about the Reconnoiter-users mailing list