Skip to contentSkip to conversation

Add Graphite output module

PATCH In review Eric Leblond 1 participant 4 messages Dec 22, 2012 – Dec 27, 2012 netfilter

lore
Share & tools
lore
#0 lore raw

cover Add Graphite output module

This patchset adds a new output module to ulogd2. This is a module which sends NFACCT accounting data to a graphite server. Graphite is a web application which provide real-time visualization and storage of numeric time-series data. The exchange format is really simple and does not rely on any depedencies.

For a example dashboard and some more explanations see:
https://home.regit.org/2012/12/visualize-netfilter-accounting-in-graphite/

BR,
--
Eric Leblond <[email protected]>

#1 lore raw

PATCH 1/2 Add missing u64 function.

---
 include/ulogd/ulogd.h |    5 +++++
 1 file changed, 5 insertions(+)
include/ulogd/ulogd.h +5 -0
index 81933f2..41c2e9b 100644
@@ -184,6 +184,11 @@ static inline u_int32_t ikey_get_u32(struct ulogd_key *key)
 	return key->u.source->u.value.ui32;
 }
 
+static inline u_int64_t ikey_get_u64(struct ulogd_key *key)
+{
+	return key->u.source->u.value.ui64;
+}
+
 static inline void *ikey_get_u128(struct ulogd_key *key)
 {
 	return &key->u.source->u.value.ui128;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 Add GRAPHITE output module.

In reply to Eric Leblond

Graphite is a web application which provide real-time visualization and storage of numeric time-series data. This patch adds a module named GRAPHITE which sends NFACCT accounting data to a graphite server.

---
 output/Makefile.am             |    6 +-
 output/ulogd_output_GRAPHITE.c |  246 ++++++++++++++++++++++++++++++++++++++++
 ulogd.conf.in                  |   10 ++
 3 files changed, 261 insertions(+), 1 deletion(-)
 create mode 100644 output/ulogd_output_GRAPHITE.c
output/Makefile.am +5 -1
index fe0a19c..17427d0 100644
@@ -6,7 +6,8 @@ SUBDIRS= pcap mysql pgsql sqlite3 dbi
 
 pkglib_LTLIBRARIES = ulogd_output_LOGEMU.la ulogd_output_SYSLOG.la \
 			 ulogd_output_OPRINT.la ulogd_output_GPRINT.la \
-			 ulogd_output_NACCT.la ulogd_output_XML.la
+			 ulogd_output_NACCT.la ulogd_output_XML.la \
+			 ulogd_output_GRAPHITE.la
 
 ulogd_output_GPRINT_la_SOURCES = ulogd_output_GPRINT.c
 ulogd_output_GPRINT_la_LDFLAGS = -avoid-version -module
@@ -28,3 +29,6 @@ ulogd_output_XML_la_LIBADD  = ${LIBNETFILTER_LOG_LIBS} \
 			      ${LIBNETFILTER_CONNTRACK_LIBS} \
 			      ${LIBNETFILTER_ACCT_LIBS}
 ulogd_output_XML_la_LDFLAGS = -avoid-version -module
+
+ulogd_output_GRAPHITE_la_SOURCES = ulogd_output_GRAPHITE.c
+ulogd_output_GRAPHITE_la_LDFLAGS = -avoid-version -module
output/ulogd_output_GRAPHITE.c new file +246 -0

246 lines not on this page · raw message

ulogd.conf.in +10 -0
index c630b88..6aff802 100644
@@ -49,6 +49,7 @@ plugin="@pkglibdir@/ulogd_output_GPRINT.so"
 #plugin="@pkglibdir@/ulogd_output_DBI.so"
 plugin="@pkglibdir@/ulogd_raw2packet_BASE.so"
 plugin="@pkglibdir@/ulogd_inpflow_NFACCT.so"
+plugin="@pkglibdir@/ulogd_output_GRAPHITE.so"
 
 # this is a stack for logging packet send by system via LOGEMU
 #stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU
@@ -80,6 +81,9 @@ plugin="@pkglibdir@/ulogd_inpflow_NFACCT.so"
 # this is a stack for accounting-based logging via XML
 #stack=acct1:NFACCT,xml1:XML
 
+# this is a stack for accounting-based logging to a Graphite server
+#stack=acct1:NFACCT,graphite1:GRAPHITE
+
 # this is a stack for NFLOG packet-based logging to PCAP
 #stack=log2:NFLOG,base1:BASE,pcap1:PCAP
 
@@ -280,3 +284,9 @@ pollinterval = 2
 # Set timestamp (default is 0, which means not set). This timestamp can be
 # interpreted by the output plugin.
 #timestamp = 1
+
+[graphite1]
+host="127.0.0.1"
+port="2003"
+# Prefix of data name sent to graphite server
+prefix="netfilter.nfacct"
Signature · 1 line
1.7.10.4
#3 lore raw
In reply to Eric Leblond

Hello,

Quoted 8 lines · Eric Leblond

This patchset adds a new output module to ulogd2. This is a module which sends NFACCT accounting data to a graphite server. Graphite is a web application which provide real-time visualization and storage of numeric time-series data. The exchange format is really simple and does not rely on any depedencies.

For a example dashboard and some more explanations see:
https://home.regit.org/2012/12/visualize-netfilter-accounting-in-graphite/

Patches have been applied.

BR,

Signature · 2 lines
Eric Leblond <[email protected]>
Blog: https://home.regit.org/