summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c97677)
raw | patch | inline | side by side (parent: 6c97677)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 29 Mar 2017 15:31:43 +0000 (21:31 +0600) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Wed, 5 Jul 2017 12:25:04 +0000 (19:25 +0700) |
Before this patch, Collectd reports /proc/PID/io fields 'io_rchar/io_wchar' as
'ps_disk_octets' type and 'io_syscr/io_syscw' as 'ps_disk_ops' type.
The names of these types do not match values they represent.
New, correct mapping implemented:
io_rchar/io_wchar -> io_octets (was ps_disk_octets, not used anymore)
io_syscr/io_syscw -> io_ops (was ps_disk_ops, not used anymore)
read_bytes/write_bytes -> disk_octets (new data collected)
Closes: #1990
'ps_disk_octets' type and 'io_syscr/io_syscw' as 'ps_disk_ops' type.
The names of these types do not match values they represent.
New, correct mapping implemented:
io_rchar/io_wchar -> io_octets (was ps_disk_octets, not used anymore)
io_syscr/io_syscw -> io_ops (was ps_disk_ops, not used anymore)
read_bytes/write_bytes -> disk_octets (new data collected)
Closes: #1990
src/processes.c | patch | blob | history | |
src/types.db | patch | blob | history |
diff --git a/src/processes.c b/src/processes.c
index 6e472e600f4bb9c6a260461f206c76e7e6672f5b..2f1980be306f0e8b07d254c04375243726f767a3 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
derive_t io_wchar;
derive_t io_syscr;
derive_t io_syscw;
+ derive_t io_diskr;
+ derive_t io_diskw;
_Bool has_io;
derive_t cswitch_vol;
derive_t io_wchar;
derive_t io_syscr;
derive_t io_syscw;
+ derive_t io_diskr;
+ derive_t io_diskw;
derive_t cswitch_vol;
derive_t cswitch_invol;
derive_t io_wchar;
derive_t io_syscr;
derive_t io_syscw;
+ derive_t io_diskr;
+ derive_t io_diskw;
derive_t cswitch_vol;
derive_t cswitch_invol;
new->io_wchar = -1;
new->io_syscr = -1;
new->io_syscw = -1;
+ new->io_diskr = -1;
+ new->io_diskw = -1;
new->cswitch_vol = -1;
new->cswitch_invol = -1;
ps_update_counter(&ps->io_syscw, &pse->io_syscw, entry->io_syscw);
}
+ if ((entry->io_diskr != -1) && (entry->io_diskw != -1)) {
+ ps_update_counter(&ps->io_diskr, &pse->io_diskr, entry->io_diskr);
+ ps_update_counter(&ps->io_diskw, &pse->io_diskw, entry->io_diskw);
+ }
+
if ((entry->cswitch_vol != -1) && (entry->cswitch_vol != -1)) {
ps_update_counter(&ps->cswitch_vol, &pse->cswitch_vol,
entry->cswitch_vol);
plugin_dispatch_values(&vl);
if ((ps->io_rchar != -1) && (ps->io_wchar != -1)) {
- sstrncpy(vl.type, "ps_disk_octets", sizeof(vl.type));
+ sstrncpy(vl.type, "io_octets", sizeof(vl.type));
vl.values[0].derive = ps->io_rchar;
vl.values[1].derive = ps->io_wchar;
vl.values_len = 2;
}
if ((ps->io_syscr != -1) && (ps->io_syscw != -1)) {
- sstrncpy(vl.type, "ps_disk_ops", sizeof(vl.type));
+ sstrncpy(vl.type, "io_ops", sizeof(vl.type));
vl.values[0].derive = ps->io_syscr;
vl.values[1].derive = ps->io_syscw;
vl.values_len = 2;
plugin_dispatch_values(&vl);
}
+ if ((ps->io_diskr != -1) && (ps->io_diskw != -1)) {
+ sstrncpy(vl.type, "disk_octets", sizeof(vl.type));
+ vl.values[0].derive = ps->io_diskr;
+ vl.values[1].derive = ps->io_diskw;
+ vl.values_len = 2;
+ plugin_dispatch_values(&vl);
+ }
+
if (ps->num_fd > 0) {
sstrncpy(vl.type, "file_handles", sizeof(vl.type));
vl.values[0].gauge = ps->num_fd;
"cpu_user_counter = %" PRIi64 "; cpu_system_counter = %" PRIi64 "; "
"io_rchar = %" PRIi64 "; io_wchar = %" PRIi64 "; "
"io_syscr = %" PRIi64 "; io_syscw = %" PRIi64 "; "
+ "io_diskr = %" PRIi64 "; io_diskw = %" PRIi64 "; "
"cswitch_vol = %" PRIi64 "; cswitch_invol = %" PRIi64 ";",
ps->name, ps->num_proc, ps->num_lwp, ps->num_fd, ps->vmem_size,
ps->vmem_rss, ps->vmem_data, ps->vmem_code, ps->vmem_minflt_counter,
ps->vmem_majflt_counter, ps->cpu_user_counter, ps->cpu_system_counter,
- ps->io_rchar, ps->io_wchar, ps->io_syscr, ps->io_syscw, ps->cswitch_vol,
- ps->cswitch_invol);
+ ps->io_rchar, ps->io_wchar, ps->io_syscr, ps->io_syscw, ps->io_diskr,
+ ps->io_diskw, ps->cswitch_vol, ps->cswitch_invol);
} /* void ps_submit_proc_list */
#if KERNEL_LINUX || KERNEL_SOLARIS
val = &(ps->io_syscr);
else if (strncasecmp(buffer, "syscw:", 6) == 0)
val = &(ps->io_syscw);
+ else if (strncasecmp(buffer, "read_bytes:", 11) == 0)
+ val = &(ps->io_diskr);
+ else if (strncasecmp(buffer, "write_bytes:", 12) == 0)
+ val = &(ps->io_diskw);
else
continue;
ps->io_wchar = -1;
ps->io_syscr = -1;
ps->io_syscw = -1;
+ ps->io_diskr = -1;
+ ps->io_diskw = -1;
ps->cswitch_vol = -1;
ps->cswitch_invol = -1;
ps->io_wchar = myUsage->pr_oublk * chars_per_block;
ps->io_syscr = myUsage->pr_sysc;
ps->io_syscw = myUsage->pr_sysc;
+ ps->io_diskr = -1;
+ ps->io_diskw = -1;
/*
* TODO: context switch counters for Solaris
pse.io_wchar = -1;
pse.io_syscr = -1;
pse.io_syscw = -1;
+ pse.io_diskr = -1;
+ pse.io_diskw = -1;
/* File descriptor count not implemented */
pse.num_fd = 0;
pse.io_wchar = -1;
pse.io_syscr = -1;
pse.io_syscw = -1;
+ pse.io_diskr = -1;
+ pse.io_diskw = -1;
/* file descriptor count not implemented */
pse.num_fd = 0;
pse.io_wchar = -1;
pse.io_syscr = -1;
pse.io_syscw = -1;
+ pse.io_diskr = -1;
+ pse.io_diskw = -1;
/* file descriptor count not implemented */
pse.num_fd = 0;
pse.io_wchar = -1;
pse.io_syscr = -1;
pse.io_syscw = -1;
+ pse.io_diskr = -1;
+ pse.io_diskw = -1;
pse.num_fd = 0;
diff --git a/src/types.db b/src/types.db
index 68551875f2b3938cc1d8a1cd8c5539c473f6b545..d86a891582501ee1a98e6ea5f1ae59ccff378ae8 100644 (file)
--- a/src/types.db
+++ b/src/types.db
if_tx_packets value:DERIVE:0:U
invocations value:DERIVE:0:U
io_octets rx:DERIVE:0:U, tx:DERIVE:0:U
+io_ops read:DERIVE:0:U, write:DERIVE:0:U
io_packets rx:DERIVE:0:U, tx:DERIVE:0:U
ipc value:GAUGE:0:U
ipt_bytes value:DERIVE:0:U