projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2729 from cekstam/add-scale-and-shift-to-modbus
[collectd.git]
/
src
/
pf.c
diff --git
a/src/pf.c
b/src/pf.c
index
533dffe
..
88a4c2d
100644
(file)
--- a/
src/pf.c
+++ b/
src/pf.c
@@
-58,7
+58,7
@@
static char const *pf_scounters[SCNT_MAX + 1] = SCNT_NAMES;
static char const *pf_device = "/dev/pf";
static void pf_submit(char const *type, char const *type_instance, uint64_t val,
static char const *pf_device = "/dev/pf";
static void pf_submit(char const *type, char const *type_instance, uint64_t val,
-
_B
ool is_gauge) {
+
b
ool is_gauge) {
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
@@
-83,45
+83,41
@@
static int pf_read(void) {
fd = open(pf_device, O_RDONLY);
if (fd < 0) {
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) {
}
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);
close(fd);
- return
(-1)
;
+ return
-1
;
}
close(fd);
if (!state.running) {
WARNING("pf plugin: PF is not running.");
}
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_counters", pf_reasons[i], state.counters[i],
}
for (int i = 0; i < PFRES_MAX; i++)
pf_submit("pf_counters", pf_reasons[i], state.counters[i],
- /* is gauge = */
0
);
+ /* is gauge = */
false
);
for (int i = 0; i < LCNT_MAX; i++)
pf_submit("pf_limits", pf_lcounters[i], state.lcounters[i],
for (int i = 0; i < LCNT_MAX; i++)
pf_submit("pf_limits", pf_lcounters[i], state.lcounters[i],
- /* is gauge = */
0
);
+ /* is gauge = */
false
);
for (int i = 0; i < FCNT_MAX; i++)
pf_submit("pf_state", pf_fcounters[i], state.fcounters[i],
for (int i = 0; i < FCNT_MAX; i++)
pf_submit("pf_state", pf_fcounters[i], state.fcounters[i],
- /* is gauge = */
0
);
+ /* is gauge = */
false
);
for (int i = 0; i < SCNT_MAX; i++)
pf_submit("pf_source", pf_scounters[i], state.scounters[i],
for (int i = 0; i < SCNT_MAX; i++)
pf_submit("pf_source", pf_scounters[i], state.scounters[i],
- /* is gauge = */
0
);
+ /* is gauge = */
false
);
pf_submit("pf_states", "current", (uint32_t)state.states,
pf_submit("pf_states", "current", (uint32_t)state.states,
- /* is gauge = */
1
);
+ /* is gauge = */
true
);
- return
(0)
;
+ return
0
;
} /* int pf_read */
void module_register(void) { plugin_register_read("pf", pf_read); }
} /* int pf_read */
void module_register(void) { plugin_register_read("pf", pf_read); }