forked from netdata/netdata
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Windows storage metrics (netdata#18810)
* added disk.ops * claiming should wait for node id and status ONLINE only * fix compilation on linux * fix ops on windows * added disk.util * disk.busy * disk.iotime * disk.qops * added cleanup to windows disk metrics * updated cmake * remove duplicate cleanup * undo identation * do not repeateadly try to find non-existing metrics * log once the metrics perflib gives up
- Loading branch information
Showing
12 changed files
with
530 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_DISK_BUSY_H | ||
#define NETDATA_DISK_BUSY_H | ||
|
||
#include "common-contexts.h" | ||
|
||
typedef struct { | ||
RRDSET *st_busy; | ||
RRDDIM *rd_busy; | ||
} ND_DISK_BUSY; | ||
|
||
static inline void common_disk_busy(ND_DISK_BUSY *d, const char *id, const char *name, uint64_t busy_ms, int update_every, instance_labels_cb_t cb, void *data) { | ||
if(unlikely(!d->st_busy)) { | ||
d->st_busy = rrdset_create_localhost( | ||
"disk_busy" | ||
, id | ||
, name | ||
, "utilization" | ||
, "disk.busy" | ||
, "Disk Busy Time" | ||
, "milliseconds" | ||
, _COMMON_PLUGIN_NAME | ||
, _COMMON_PLUGIN_MODULE_NAME | ||
, NETDATA_CHART_PRIO_DISK_BUSY | ||
, update_every | ||
, RRDSET_TYPE_AREA | ||
); | ||
|
||
rrdset_flag_set(d->st_busy, RRDSET_FLAG_DETAIL); | ||
|
||
d->rd_busy = rrddim_add(d->st_busy, "busy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); | ||
|
||
if(cb) | ||
cb(d->st_busy, data); | ||
} | ||
|
||
// this always have to be in base units, so that exporting sends base units to other time-series db | ||
rrddim_set_by_pointer(d->st_busy, d->rd_busy, (collected_number)busy_ms); | ||
rrdset_done(d->st_busy); | ||
} | ||
|
||
#endif //NETDATA_DISK_BUSY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_DISK_IOTIME_H | ||
#define NETDATA_DISK_IOTIME_H | ||
|
||
#include "common-contexts.h" | ||
|
||
typedef struct { | ||
RRDSET *st_iotime; | ||
RRDDIM *rd_reads_ms; | ||
RRDDIM *rd_writes_ms; | ||
} ND_DISK_IOTIME; | ||
|
||
static inline void common_disk_iotime(ND_DISK_IOTIME *d, const char *id, const char *name, uint64_t reads_ms, uint64_t writes_ms, int update_every, instance_labels_cb_t cb, void *data) { | ||
if(unlikely(!d->st_iotime)) { | ||
d->st_iotime = rrdset_create_localhost( | ||
"disk_iotime" | ||
, id | ||
, name | ||
, "utilization" | ||
, "disk.iotime" | ||
, "Disk Total I/O Time" | ||
, "milliseconds/s" | ||
, _COMMON_PLUGIN_NAME | ||
, _COMMON_PLUGIN_MODULE_NAME | ||
, NETDATA_CHART_PRIO_DISK_IOTIME | ||
, update_every | ||
, RRDSET_TYPE_AREA | ||
); | ||
|
||
rrdset_flag_set(d->st_iotime, RRDSET_FLAG_DETAIL); | ||
|
||
d->rd_reads_ms = rrddim_add(d->st_iotime, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); | ||
d->rd_writes_ms = rrddim_add(d->st_iotime, "writes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); | ||
|
||
if(cb) | ||
cb(d->st_iotime, data); | ||
} | ||
|
||
// this always have to be in base units, so that exporting sends base units to other time-series db | ||
rrddim_set_by_pointer(d->st_iotime, d->rd_reads_ms, (collected_number)reads_ms); | ||
rrddim_set_by_pointer(d->st_iotime, d->rd_writes_ms, (collected_number)writes_ms); | ||
rrdset_done(d->st_iotime); | ||
} | ||
|
||
#endif //NETDATA_DISK_IOTIME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_DISK_OPS_H | ||
#define NETDATA_DISK_OPS_H | ||
|
||
#include "common-contexts.h" | ||
|
||
typedef struct { | ||
RRDSET *st_ops; | ||
RRDDIM *rd_ops_reads; | ||
RRDDIM *rd_ops_writes; | ||
} ND_DISK_OPS; | ||
|
||
static inline void common_disk_ops(ND_DISK_OPS *d, const char *id, const char *name, uint64_t ops_read, uint64_t ops_write, int update_every, instance_labels_cb_t cb, void *data) { | ||
if(unlikely(!d->st_ops)) { | ||
d->st_ops = rrdset_create_localhost( | ||
"disk_ops" | ||
, id | ||
, name | ||
, "ops" | ||
, "disk.ops" | ||
, "Disk Completed I/O Operations" | ||
, "operations/s" | ||
, _COMMON_PLUGIN_NAME | ||
, _COMMON_PLUGIN_MODULE_NAME | ||
, NETDATA_CHART_PRIO_DISK_OPS | ||
, update_every | ||
, RRDSET_TYPE_LINE | ||
); | ||
|
||
d->rd_ops_reads = rrddim_add(d->st_ops, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); | ||
d->rd_ops_writes = rrddim_add(d->st_ops, "writes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); | ||
|
||
if(cb) | ||
cb(d->st_ops, data); | ||
} | ||
|
||
// this always have to be in base units, so that exporting sends base units to other time-series db | ||
rrddim_set_by_pointer(d->st_ops, d->rd_ops_reads, (collected_number)ops_read); | ||
rrddim_set_by_pointer(d->st_ops, d->rd_ops_writes, (collected_number)ops_write); | ||
rrdset_done(d->st_ops); | ||
} | ||
|
||
#endif //NETDATA_DISK_OPS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_DISK_QOPS_H | ||
#define NETDATA_DISK_QOPS_H | ||
|
||
#include "common-contexts.h" | ||
|
||
typedef struct { | ||
RRDSET *st_qops; | ||
RRDDIM *rd_qops; | ||
} ND_DISK_QOPS; | ||
|
||
static inline void common_disk_qops(ND_DISK_QOPS *d, const char *id, const char *name, uint64_t queued_ops, int update_every, instance_labels_cb_t cb, void *data) { | ||
if(unlikely(!d->st_qops)) { | ||
d->st_qops = rrdset_create_localhost( | ||
"disk_qops" | ||
, id | ||
, name | ||
, "ops" | ||
, "disk.qops" | ||
, "Disk Current I/O Operations" | ||
, "operations" | ||
, _COMMON_PLUGIN_NAME | ||
, _COMMON_PLUGIN_MODULE_NAME | ||
, NETDATA_CHART_PRIO_DISK_QOPS | ||
, update_every | ||
, RRDSET_TYPE_LINE | ||
); | ||
|
||
d->rd_qops = rrddim_add(d->st_qops, "operations", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); | ||
|
||
if(cb) | ||
cb(d->st_qops, data); | ||
} | ||
|
||
// this always have to be in base units, so that exporting sends base units to other time-series db | ||
rrddim_set_by_pointer(d->st_qops, d->rd_qops, (collected_number)queued_ops); | ||
rrdset_done(d->st_qops); | ||
} | ||
|
||
#endif //NETDATA_DISK_QOPS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
#ifndef NETDATA_DISK_UTIL_H | ||
#define NETDATA_DISK_UTIL_H | ||
|
||
#include "common-contexts.h" | ||
|
||
typedef struct { | ||
RRDSET *st_util; | ||
RRDDIM *rd_util; | ||
} ND_DISK_UTIL; | ||
|
||
static inline void common_disk_util(ND_DISK_UTIL *d, const char *id, const char *name, uint64_t percent, int update_every, instance_labels_cb_t cb, void *data) { | ||
if(unlikely(!d->st_util)) { | ||
d->st_util = rrdset_create_localhost( | ||
"disk_util" | ||
, id | ||
, name | ||
, "utilization" | ||
, "disk.util" | ||
, "Disk Utilization Time" | ||
, "% of time working" | ||
, _COMMON_PLUGIN_NAME | ||
, _COMMON_PLUGIN_MODULE_NAME | ||
, NETDATA_CHART_PRIO_DISK_UTIL | ||
, update_every | ||
, RRDSET_TYPE_AREA | ||
); | ||
|
||
rrdset_flag_set(d->st_util, RRDSET_FLAG_DETAIL); | ||
|
||
d->rd_util = rrddim_add(d->st_util, "utilization", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); | ||
|
||
if(cb) | ||
cb(d->st_util, data); | ||
} | ||
|
||
// this always have to be in base units, so that exporting sends base units to other time-series db | ||
rrddim_set_by_pointer(d->st_util, d->rd_util, (collected_number)percent); | ||
rrdset_done(d->st_util); | ||
} | ||
|
||
#endif //NETDATA_DISK_UTIL_H |
Oops, something went wrong.