summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59fc91a)
raw | patch | inline | side by side (parent: 59fc91a)
author | Stefan Rinkes <stefan.rinkes@gmail.com> | |
Sat, 16 Apr 2011 09:06:56 +0000 (11:06 +0200) | ||
committer | Stefan Rinkes <stefan.rinkes@gmail.com> | |
Sat, 16 Apr 2011 09:06:56 +0000 (11:06 +0200) |
src/pf.c | patch | blob | history | |
types.pfrules.db | [new file with mode: 0644] | patch | blob |
diff --git a/src/pf.c b/src/pf.c
index b4d2a45863a54a12d3d128683bce6b4c5b157897..02eb5aed3e34f68a0c2dab620a93d93f48f8f1d8 100644 (file)
--- a/src/pf.c
+++ b/src/pf.c
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <net/pfvar.h>
-
-#include <limits.h>
-#include <fcntl.h>
-#include <paths.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-
-#ifndef TEST
-#include "collectd.h"
-#include "common.h"
-#include "plugin.h"
-#include "configfile.h"
-#else
-#include <err.h>
-typedef u_int64_t counter_t;
-#endif
-
-#define PF_SOCKET "/dev/pf"
-
-struct pfdata {
- int pd_dev;
-};
-
-static struct pfdata pd;
+#include "pfcommon.h"
static int pf_init(void);
static int pf_read(void);
{
struct pf_status status;
- memset(&pd, '\0', sizeof(pd));
-
- if ((pd.pd_dev = open(PF_SOCKET, O_RDWR)) == -1) {
+ if ((dev = open(PF_SOCKET, O_RDWR)) == -1) {
return (-1);
}
- if (ioctl(pd.pd_dev, DIOCGETSTATUS, &status) == -1) {
+ if (ioctl(dev, DIOCGETSTATUS, &status) == -1) {
return (-1);
}
- close(pd.pd_dev);
+ close(dev);
if (!status.running)
return (-1);
char *lnames[] = LCNT_NAMES;
char *names[] = { "searches", "inserts", "removals" };
- if ((pd.pd_dev = open(PF_SOCKET, O_RDWR)) == -1) {
+ if ((dev = open(PF_SOCKET, O_RDWR)) == -1) {
return (-1);
}
- if (ioctl(pd.pd_dev, DIOCGETSTATUS, &status) == -1) {
+ if (ioctl(dev, DIOCGETSTATUS, &status) == -1) {
return (-1);
}
- close(pd.pd_dev);
+ close(dev);
for (i = 0; i < PFRES_MAX; i++)
submit_counter("pf_counters", cnames[i], status.counters[i]);
for (i = 0; i < LCNT_MAX; i++)
diff --git a/types.pfrules.db b/types.pfrules.db
--- /dev/null
+++ b/types.pfrules.db
@@ -0,0 +1,8 @@
+scrub_states_current value:GAUGE:U:U
+scrub_states_total value:GAUGE:U:U
+scrub_evaluations value:GAUGE:U:U
+scrub_bytes value:GAUGE:U:U
+rule_states_current value:GAUGE:U:U
+rule_states_total value:GAUGE:U:U
+rule_evaluations value:GAUGE:U:U
+rule_bytes value:GAUGE:U:U