/*
- * Copyright (c) 2010 Pierre-Yves Ritschard <pyr@openbsd.org>
- * Copyright (c) 2011 Stefan Rinkes <stefan.rinkes@gmail.org>
+ * Copyright (c) 2010 Pierre-Yves Ritschard
+ * Copyright (c) 2011 Stefan Rinkes
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors:
+ * Pierre-Yves Ritschard <pyr at openbsd.org>
+ * Stefan Rinkes <stefan.rinkes at gmail.org>
*/
#include "collectd.h"
+
#include "plugin.h"
#include "common.h"
#if HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
-#if HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
#if HAVE_NET_IF_H
# include <net/if.h>
#endif
struct pf_status state;
int fd;
int status;
- int i;
fd = open (pf_device, O_RDONLY);
if (fd < 0)
return (-1);
}
- memset (&state, 0, sizeof (state));
status = ioctl (fd, DIOCGETSTATUS, &state);
if (status != 0)
{
}
close (fd);
- fd = -1;
if (!state.running)
{
return (-1);
}
- for (i = 0; i < PFRES_MAX; i++)
+ for (int i = 0; i < PFRES_MAX; i++)
pf_submit ("pf_counters", pf_reasons[i], state.counters[i],
/* is gauge = */ 0);
- for (i = 0; i < LCNT_MAX; i++)
+ for (int i = 0; i < LCNT_MAX; i++)
pf_submit ("pf_limits", pf_lcounters[i], state.lcounters[i],
/* is gauge = */ 0);
- for (i = 0; i < FCNT_MAX; i++)
+ for (int i = 0; i < FCNT_MAX; i++)
pf_submit ("pf_state", pf_fcounters[i], state.fcounters[i],
/* is gauge = */ 0);
- for (i = 0; i < SCNT_MAX; i++)
+ for (int i = 0; i < SCNT_MAX; i++)
pf_submit ("pf_source", pf_scounters[i], state.scounters[i],
/* is gauge = */ 0);