vl.values = values;
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, "pf", sizeof(vl.plugin));
sstrncpy(vl.type, type, sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
fd = open(pf_device, O_RDONLY);
if (fd < 0) {
- char errbuf[1024];
- ERROR("pf plugin: Unable to open %s: %s", pf_device,
- sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ ERROR("pf plugin: Unable to open %s: %s", pf_device, STRERRNO);
+ return -1;
}
status = ioctl(fd, DIOCGETSTATUS, &state);
if (status != 0) {
- char errbuf[1024];
- ERROR("pf plugin: ioctl(DIOCGETSTATUS) failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("pf plugin: ioctl(DIOCGETSTATUS) failed: %s", STRERRNO);
close(fd);
- return (-1);
+ return -1;
}
close(fd);
if (!state.running) {
WARNING("pf plugin: PF is not running.");
- return (-1);
+ return -1;
}
for (int i = 0; i < PFRES_MAX; i++)
pf_submit("pf_states", "current", (uint32_t)state.states,
/* is gauge = */ 1);
- return (0);
+ return 0;
} /* int pf_read */
void module_register(void) { plugin_register_read("pf", pf_read); }