mirror of
https://github.com/netdata/netdata.git
synced 2025-04-14 17:48:37 +00:00
Format Windows.plugin (#19554)
* format_windows: Format GetSystemCPU.[c] * format_windows: Format GetSystemRAM.[c] * format_windows: Format GetSystemUptime.[c] * format_windows: Format perflib-hyperv.[c] * format_windows: Format perflib-memory.[c] * format_windows: Format perflib-mssql.[c] * format_windows: Format perflib-network.[c] * format_windows: Format perflib-objects.[c] * format_windows: Format perflib-processes.[c] * format_windows: Format perflib-processor.[c] * format_windows: Format perflib-rrd.[ch] * format_windows: Format perflib-storage.[ch] * format_windows: Format perflib-thermalzone.[ch] * format_windows: Format perflib-web-service.[c] * format_windows: Format windows-internals.[h]
This commit is contained in:
parent
9eaccc08cd
commit
768ad06d7e
16 changed files with 1092 additions and 904 deletions
|
@ -3,10 +3,11 @@
|
|||
#include "windows_plugin.h"
|
||||
#include "windows-internals.h"
|
||||
|
||||
int do_GetSystemCPU(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_GetSystemCPU(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
FILETIME idleTime, kernelTime, userTime;
|
||||
|
||||
if(GetSystemTimes(&idleTime, &kernelTime, &userTime) == 0) {
|
||||
if (GetSystemTimes(&idleTime, &kernelTime, &userTime) == 0) {
|
||||
netdata_log_error("GetSystemTimes() failed.");
|
||||
return 1;
|
||||
}
|
||||
|
@ -20,21 +21,20 @@ int do_GetSystemCPU(int update_every, usec_t dt __maybe_unused) {
|
|||
|
||||
static RRDSET *st = NULL;
|
||||
static RRDDIM *rd_user = NULL, *rd_kernel = NULL, *rd_idle = NULL;
|
||||
if(!st) {
|
||||
if (!st) {
|
||||
st = rrdset_create_localhost(
|
||||
"system"
|
||||
, "cpu"
|
||||
, NULL
|
||||
, "cpu"
|
||||
, "system.cpu"
|
||||
, "Total CPU utilization"
|
||||
, "percentage"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "GetSystemTimes"
|
||||
, NETDATA_CHART_PRIO_SYSTEM_CPU
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
"system",
|
||||
"cpu",
|
||||
NULL,
|
||||
"cpu",
|
||||
"system.cpu",
|
||||
"Total CPU utilization",
|
||||
"percentage",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"GetSystemTimes",
|
||||
NETDATA_CHART_PRIO_SYSTEM_CPU,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
rd_user = rrddim_add(st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
rd_kernel = rrddim_add(st, "system", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
|
@ -42,9 +42,9 @@ int do_GetSystemCPU(int update_every, usec_t dt __maybe_unused) {
|
|||
rrddim_hide(st, "idle");
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(st, rd_user, (collected_number )user);
|
||||
rrddim_set_by_pointer(st, rd_kernel, (collected_number )kernel);
|
||||
rrddim_set_by_pointer(st, rd_idle, (collected_number )idle);
|
||||
rrddim_set_by_pointer(st, rd_user, (collected_number)user);
|
||||
rrddim_set_by_pointer(st, rd_kernel, (collected_number)kernel);
|
||||
rrddim_set_by_pointer(st, rd_idle, (collected_number)idle);
|
||||
rrdset_done(st);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#define _COMMON_PLUGIN_MODULE_NAME "GetSystemRam"
|
||||
#include "../common-contexts/common-contexts.h"
|
||||
|
||||
int do_GetSystemRAM(int update_every, usec_t dt __maybe_unused) {
|
||||
MEMORYSTATUSEX memStat = { 0 };
|
||||
int do_GetSystemRAM(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
MEMORYSTATUSEX memStat = {0};
|
||||
memStat.dwLength = sizeof(memStat);
|
||||
|
||||
if (!GlobalMemoryStatusEx(&memStat)) {
|
||||
|
|
|
@ -3,26 +3,26 @@
|
|||
#include "windows_plugin.h"
|
||||
#include "windows-internals.h"
|
||||
|
||||
int do_GetSystemUptime(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_GetSystemUptime(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
ULONGLONG uptime = GetTickCount64(); // in milliseconds
|
||||
|
||||
static RRDSET *st = NULL;
|
||||
static RRDDIM *rd_uptime = NULL;
|
||||
if (!st) {
|
||||
st = rrdset_create_localhost(
|
||||
"system"
|
||||
, "uptime"
|
||||
, NULL
|
||||
, "uptime"
|
||||
, "system.uptime"
|
||||
, "System Uptime"
|
||||
, "seconds"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "GetSystemUptime"
|
||||
, NETDATA_CHART_PRIO_SYSTEM_UPTIME
|
||||
, update_every
|
||||
, RRDSET_TYPE_LINE
|
||||
);
|
||||
"system",
|
||||
"uptime",
|
||||
NULL,
|
||||
"uptime",
|
||||
"system.uptime",
|
||||
"System Uptime",
|
||||
"seconds",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"GetSystemUptime",
|
||||
NETDATA_CHART_PRIO_SYSTEM_UPTIME,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
rd_uptime = rrddim_add(st, "uptime", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#define _COMMON_PLUGIN_MODULE_NAME "PerflibHyperV"
|
||||
#include "../common-contexts/common-contexts.h"
|
||||
|
||||
#define HYPERV "hyperv"
|
||||
#define HYPERV "hyperv"
|
||||
|
||||
static void get_and_sanitize_instance_value(
|
||||
PERF_DATA_BLOCK *pDataBlock,
|
||||
|
@ -72,15 +72,16 @@ struct hypervisor_memory {
|
|||
COUNTER_DATA GuestAvailableMemory;
|
||||
};
|
||||
|
||||
void initialize_hyperv_memory_keys(struct hypervisor_memory *p) {
|
||||
void initialize_hyperv_memory_keys(struct hypervisor_memory *p)
|
||||
{
|
||||
p->CurrentPressure.key = "Current Pressure";
|
||||
p->PhysicalMemory.key = "Physical Memory";
|
||||
p->GuestVisiblePhysicalMemory.key = "Guest Visible Physical Memory";
|
||||
p->GuestAvailableMemory.key = "Guest Available Memory";
|
||||
}
|
||||
|
||||
|
||||
void dict_hyperv_memory_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_hyperv_memory_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct hypervisor_memory *p = value;
|
||||
initialize_hyperv_memory_keys(p);
|
||||
}
|
||||
|
@ -97,7 +98,6 @@ struct hypervisor_partition {
|
|||
|
||||
COUNTER_DATA PhysicalPagesAllocated;
|
||||
COUNTER_DATA RemotePhysicalPages;
|
||||
|
||||
};
|
||||
|
||||
void initialize_hyperv_partition_keys(struct hypervisor_partition *p)
|
||||
|
@ -106,7 +106,8 @@ void initialize_hyperv_partition_keys(struct hypervisor_partition *p)
|
|||
p->RemotePhysicalPages.key = "Remote Physical Pages";
|
||||
}
|
||||
|
||||
void dict_hyperv_partition_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_hyperv_partition_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct hypervisor_partition *p = value;
|
||||
initialize_hyperv_partition_keys(p);
|
||||
}
|
||||
|
@ -120,16 +121,17 @@ static bool do_hyperv_memory(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
return false;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for(LONG i = 0; i < pObjectType->NumInstances ; i++) {
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
struct hypervisor_memory *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
||||
if(!p->collected_metadata) {
|
||||
if (!p->collected_metadata) {
|
||||
p->collected_metadata = true;
|
||||
}
|
||||
|
||||
|
@ -140,13 +142,13 @@ static bool do_hyperv_memory(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
|
||||
if (!p->charts_created) {
|
||||
p->charts_created = true;
|
||||
if(!p->st_vm_memory_physical) {
|
||||
if (!p->st_vm_memory_physical) {
|
||||
p->st_vm_memory_physical = rrdset_create_localhost(
|
||||
"vm_memory_physical",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_memory_physical",
|
||||
HYPERV ".vm_memory_physical",
|
||||
"VM assigned memory",
|
||||
"bytes",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -160,7 +162,7 @@ static bool do_hyperv_memory(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_memory_physical_guest_visible",
|
||||
HYPERV ".vm_memory_physical_guest_visible",
|
||||
"VM guest visible memory",
|
||||
"bytes",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -174,7 +176,7 @@ static bool do_hyperv_memory(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_memory_pressure_current",
|
||||
HYPERV ".vm_memory_pressure_current",
|
||||
"VM Memory Pressure",
|
||||
"percentage",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -184,13 +186,20 @@ static bool do_hyperv_memory(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_CurrentPressure = rrddim_add(p->st_pressure, "pressure", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_PhysicalMemory = rrddim_add(p->st_vm_memory_physical, "assigned", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_GuestVisiblePhysicalMemory = rrddim_add(p->st_vm_memory_physical_guest_visible, "visible", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_GuestAvailableMemory = rrddim_add(p->st_vm_memory_physical_guest_visible, "available", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_PhysicalMemory =
|
||||
rrddim_add(p->st_vm_memory_physical, "assigned", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_GuestVisiblePhysicalMemory = rrddim_add(
|
||||
p->st_vm_memory_physical_guest_visible, "visible", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_GuestAvailableMemory = rrddim_add(
|
||||
p->st_vm_memory_physical_guest_visible, "available", NULL, 1024 * 1024, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
|
||||
rrdlabels_add(p->st_vm_memory_physical->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(p->st_pressure->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(p->st_vm_memory_physical_guest_visible->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_vm_memory_physical_guest_visible->rrdlabels,
|
||||
"vm_name",
|
||||
windows_shared_buffer,
|
||||
RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,21 +224,21 @@ static bool do_hyperv_vid_partition(PERF_DATA_BLOCK *pDataBlock, int update_ever
|
|||
return false;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for(LONG i = 0; i < pObjectType->NumInstances ; i++) {
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
struct hypervisor_partition *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
||||
if(!p->collected_metadata) {
|
||||
|
||||
if (!p->collected_metadata) {
|
||||
p->collected_metadata = true;
|
||||
}
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
GET_INSTANCE_COUNTER(RemotePhysicalPages);
|
||||
|
@ -266,11 +275,15 @@ static bool do_hyperv_vid_partition(PERF_DATA_BLOCK *pDataBlock, int update_ever
|
|||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_PhysicalPagesAllocated = rrddim_add(p->st_vm_vid_physical_pages_allocated, "allocated", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_RemotePhysicalPages = rrddim_add(p->st_vm_vid_remote_physical_pages, "remote_physical", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_PhysicalPagesAllocated =
|
||||
rrddim_add(p->st_vm_vid_physical_pages_allocated, "allocated", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_RemotePhysicalPages =
|
||||
rrddim_add(p->st_vm_vid_remote_physical_pages, "remote_physical", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
|
||||
rrdlabels_add(p->st_vm_vid_physical_pages_allocated->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(p->st_vm_vid_remote_physical_pages->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_vm_vid_physical_pages_allocated->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_vm_vid_remote_physical_pages->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
SETP_DIM_VALUE(st_vm_vid_remote_physical_pages, RemotePhysicalPages);
|
||||
|
@ -399,7 +412,8 @@ struct hypervisor_root_partition {
|
|||
};
|
||||
|
||||
// Initialize the keys for the root partition metrics
|
||||
void initialize_hyperv_root_partition_keys(struct hypervisor_root_partition *p) {
|
||||
void initialize_hyperv_root_partition_keys(struct hypervisor_root_partition *p)
|
||||
{
|
||||
p->DeviceSpacePages4K.key = "4K device pages";
|
||||
p->DeviceSpacePages2M.key = "2M device pages";
|
||||
p->DeviceSpacePages1G.key = "1G device pages";
|
||||
|
@ -422,7 +436,11 @@ void initialize_hyperv_root_partition_keys(struct hypervisor_root_partition *p)
|
|||
}
|
||||
|
||||
// Callback function for inserting root partition metrics into the dictionary
|
||||
void dict_hyperv_root_partition_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_hyperv_root_partition_insert_cb(
|
||||
const DICTIONARY_ITEM *item __maybe_unused,
|
||||
void *value,
|
||||
void *data __maybe_unused)
|
||||
{
|
||||
struct hypervisor_root_partition *p = value;
|
||||
initialize_hyperv_root_partition_keys(p);
|
||||
}
|
||||
|
@ -442,9 +460,10 @@ static bool do_hyperv_root_partition(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
struct hypervisor_root_partition *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
@ -472,7 +491,6 @@ static bool do_hyperv_root_partition(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
GET_INSTANCE_COUNTER(VirtualTLBPages);
|
||||
GET_INSTANCE_COUNTER(VirtualTLBFlushEntiresSec);
|
||||
|
||||
|
||||
// Create charts
|
||||
if (!p->charts_created) {
|
||||
p->charts_created = true;
|
||||
|
@ -680,9 +698,9 @@ static bool do_hyperv_root_partition(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
|
||||
// Set the data for each dimension
|
||||
|
||||
SETP_DIM_VALUE(st_device_space_pages,DeviceSpacePages4K);
|
||||
SETP_DIM_VALUE(st_device_space_pages,DeviceSpacePages2M);
|
||||
SETP_DIM_VALUE(st_device_space_pages,DeviceSpacePages1G);
|
||||
SETP_DIM_VALUE(st_device_space_pages, DeviceSpacePages4K);
|
||||
SETP_DIM_VALUE(st_device_space_pages, DeviceSpacePages2M);
|
||||
SETP_DIM_VALUE(st_device_space_pages, DeviceSpacePages1G);
|
||||
|
||||
SETP_DIM_VALUE(st_gpa_space_pages, GPASpacePages4K);
|
||||
SETP_DIM_VALUE(st_gpa_space_pages, GPASpacePages2M);
|
||||
|
@ -744,9 +762,9 @@ struct hypervisor_storage_device {
|
|||
COUNTER_DATA ErrorCount;
|
||||
};
|
||||
|
||||
|
||||
// Initialize the keys for the root partition metrics
|
||||
void initialize_hyperv_storage_device_keys(struct hypervisor_storage_device *p) {
|
||||
void initialize_hyperv_storage_device_keys(struct hypervisor_storage_device *p)
|
||||
{
|
||||
p->ReadOperationsSec.key = "Read Operations/Sec";
|
||||
p->WriteOperationsSec.key = "Write Operations/Sec";
|
||||
|
||||
|
@ -756,7 +774,11 @@ void initialize_hyperv_storage_device_keys(struct hypervisor_storage_device *p)
|
|||
}
|
||||
|
||||
// Callback function for inserting root partition metrics into the dictionary
|
||||
void dict_hyperv_storage_device_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_hyperv_storage_device_insert_cb(
|
||||
const DICTIONARY_ITEM *item __maybe_unused,
|
||||
void *value,
|
||||
void *data __maybe_unused)
|
||||
{
|
||||
struct hypervisor_storage_device *p = value;
|
||||
initialize_hyperv_storage_device_keys(p);
|
||||
}
|
||||
|
@ -769,16 +791,16 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
struct hypervisor_storage_device *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
@ -796,14 +818,14 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
GET_INSTANCE_COUNTER(ErrorCount);
|
||||
|
||||
if (!p->charts_created) {
|
||||
p->charts_created = true;
|
||||
p->charts_created = true;
|
||||
if (!p->st_operations) {
|
||||
p->st_operations = rrdset_create_localhost(
|
||||
"vm_storage_device_operations",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_storage_device_operations",
|
||||
HYPERV ".vm_storage_device_operations",
|
||||
"VM storage device IOPS",
|
||||
"operations/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -813,9 +835,11 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_ReadOperationsSec = rrddim_add(p->st_operations, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_WriteOperationsSec = rrddim_add(p->st_operations, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_WriteOperationsSec =
|
||||
rrddim_add(p->st_operations, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
rrdlabels_add(p->st_operations->rrdlabels, "vm_storage_device", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_operations->rrdlabels, "vm_storage_device", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
if (!p->st_bytes) {
|
||||
|
@ -824,7 +848,7 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_storage_device_bytes",
|
||||
HYPERV ".vm_storage_device_bytes",
|
||||
"VM storage device IO",
|
||||
"bytes/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -845,7 +869,7 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_storage_device_errors",
|
||||
HYPERV ".vm_storage_device_errors",
|
||||
"VM storage device errors",
|
||||
"errors/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -860,13 +884,13 @@ static bool do_hyperv_storage_device(PERF_DATA_BLOCK *pDataBlock, int update_eve
|
|||
}
|
||||
}
|
||||
|
||||
SETP_DIM_VALUE(st_operations,ReadOperationsSec);
|
||||
SETP_DIM_VALUE(st_operations,WriteOperationsSec);
|
||||
SETP_DIM_VALUE(st_operations, ReadOperationsSec);
|
||||
SETP_DIM_VALUE(st_operations, WriteOperationsSec);
|
||||
|
||||
SETP_DIM_VALUE(st_bytes,ReadBytesSec);
|
||||
SETP_DIM_VALUE(st_bytes,WriteBytesSec);
|
||||
SETP_DIM_VALUE(st_bytes, ReadBytesSec);
|
||||
SETP_DIM_VALUE(st_bytes, WriteBytesSec);
|
||||
|
||||
SETP_DIM_VALUE(st_errors,ErrorCount);
|
||||
SETP_DIM_VALUE(st_errors, ErrorCount);
|
||||
|
||||
// Mark the charts as done
|
||||
rrdset_done(p->st_operations);
|
||||
|
@ -992,7 +1016,7 @@ static bool do_hyperv_switch(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
struct hypervisor_switch *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
@ -1029,7 +1053,7 @@ static bool do_hyperv_switch(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
GET_INSTANCE_COUNTER(PurgedMacAddresses);
|
||||
|
||||
if (!p->charts_created) {
|
||||
p->charts_created = true;
|
||||
p->charts_created = true;
|
||||
|
||||
p->st_bytes = rrdset_create_localhost(
|
||||
"vswitch_traffic",
|
||||
|
@ -1256,7 +1280,6 @@ static bool do_hyperv_switch(PERF_DATA_BLOCK *pDataBlock, int update_every, void
|
|||
rrdset_done(p->st_flooded);
|
||||
rrdset_done(p->st_learned_mac);
|
||||
rrdset_done(p->st_purged_mac);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1328,16 +1351,19 @@ void initialize_hyperv_network_adapter_keys(struct hypervisor_network_adapter *p
|
|||
p->BytesReceivedSec.key = "Bytes Received/sec";
|
||||
|
||||
p->IPsecoffloadBytesReceivedSec.key = "IPsec offload Bytes Receive/sec";
|
||||
p->IPsecoffloadBytesSentSec.key = "IPsec offload Bytes Sent/sec";
|
||||
p->DirectedPacketsSentSec.key = "Directed Packets Sent/sec";
|
||||
p->DirectedPacketsReceivedSec.key = "Directed Packets Received/sec";
|
||||
p->BroadcastPacketsSentSec.key = "Broadcast Packets Sent/sec";
|
||||
p->BroadcastPacketsReceivedSec.key = "Broadcast Packets Received/sec";
|
||||
p->MulticastPacketsSentSec.key = "Multicast Packets Sent/sec";
|
||||
p->MulticastPacketsReceivedSec.key = "Multicast Packets Received/sec";
|
||||
p->IPsecoffloadBytesSentSec.key = "IPsec offload Bytes Sent/sec";
|
||||
p->DirectedPacketsSentSec.key = "Directed Packets Sent/sec";
|
||||
p->DirectedPacketsReceivedSec.key = "Directed Packets Received/sec";
|
||||
p->BroadcastPacketsSentSec.key = "Broadcast Packets Sent/sec";
|
||||
p->BroadcastPacketsReceivedSec.key = "Broadcast Packets Received/sec";
|
||||
p->MulticastPacketsSentSec.key = "Multicast Packets Sent/sec";
|
||||
p->MulticastPacketsReceivedSec.key = "Multicast Packets Received/sec";
|
||||
}
|
||||
|
||||
void dict_hyperv_network_adapter_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
void dict_hyperv_network_adapter_insert_cb(
|
||||
const DICTIONARY_ITEM *item __maybe_unused,
|
||||
void *value,
|
||||
void *data __maybe_unused)
|
||||
{
|
||||
struct hypervisor_network_adapter *p = value;
|
||||
initialize_hyperv_network_adapter_keys(p);
|
||||
|
@ -1357,9 +1383,10 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
struct hypervisor_network_adapter *p = dictionary_set(item->instance, windows_shared_buffer, NULL, sizeof(*p));
|
||||
|
@ -1396,7 +1423,7 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV".vm_net_interface_packets_dropped",
|
||||
HYPERV ".vm_net_interface_packets_dropped",
|
||||
"VM interface packets dropped",
|
||||
"drops/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
|
@ -1405,10 +1432,13 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_DroppedPacketsIncomingSec = rrddim_add(p->st_dropped_packets, "incoming", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_DroppedPacketsOutgoingSec = rrddim_add(p->st_dropped_packets, "outgoing", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_DroppedPacketsIncomingSec =
|
||||
rrddim_add(p->st_dropped_packets, "incoming", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_DroppedPacketsOutgoingSec =
|
||||
rrddim_add(p->st_dropped_packets, "outgoing", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
rrdlabels_add(p->st_dropped_packets->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_dropped_packets->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
|
||||
p->st_send_receive_packets = rrdset_create_localhost(
|
||||
"vm_net_interface_packets",
|
||||
|
@ -1424,28 +1454,34 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_PacketsReceivedSec = rrddim_add(p->st_send_receive_packets, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_PacketsSentSec = rrddim_add(p->st_send_receive_packets, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_PacketsReceivedSec =
|
||||
rrddim_add(p->st_send_receive_packets, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_PacketsSentSec =
|
||||
rrddim_add(p->st_send_receive_packets, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
rrdlabels_add(p->st_send_receive_packets->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_send_receive_packets->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
|
||||
p->st_send_receive_bytes = rrdset_create_localhost(
|
||||
"vm_net_interface_traffic",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV ".vm_net_interface_traffic",
|
||||
"VM interface traffic",
|
||||
"kilobits/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_WINDOWS_HYPERV_VM_NET_INTERFACE_TRAFFIC,
|
||||
update_every,
|
||||
RRDSET_TYPE_AREA);
|
||||
"vm_net_interface_traffic",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV ".vm_net_interface_traffic",
|
||||
"VM interface traffic",
|
||||
"kilobits/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_WINDOWS_HYPERV_VM_NET_INTERFACE_TRAFFIC,
|
||||
update_every,
|
||||
RRDSET_TYPE_AREA);
|
||||
|
||||
p->rd_BytesReceivedSec = rrddim_add(p->st_send_receive_bytes, "received", NULL, 8, 1000, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_BytesSentSec = rrddim_add(p->st_send_receive_bytes, "sent", NULL, -8, 1000, RRD_ALGORITHM_INCREMENTAL);
|
||||
rrdlabels_add(p->st_send_receive_bytes->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
p->rd_BytesReceivedSec =
|
||||
rrddim_add(p->st_send_receive_bytes, "received", NULL, 8, 1000, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_BytesSentSec =
|
||||
rrddim_add(p->st_send_receive_bytes, "sent", NULL, -8, 1000, RRD_ALGORITHM_INCREMENTAL);
|
||||
rrdlabels_add(
|
||||
p->st_send_receive_bytes->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
|
||||
p->st_IPsecoffloadBytes = rrdset_create_localhost(
|
||||
"vm_net_interface_ipsec_traffic",
|
||||
|
@ -1530,8 +1566,6 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
rrddim_add(p->st_MulticastPackets, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
rrdlabels_add(
|
||||
p->st_MulticastPackets->rrdlabels, "vm_net_interface", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
SETP_DIM_VALUE(st_dropped_packets, DroppedPacketsIncomingSec);
|
||||
|
@ -1552,8 +1586,8 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
SETP_DIM_VALUE(st_BroadcastPackets, BroadcastPacketsSentSec);
|
||||
SETP_DIM_VALUE(st_BroadcastPackets, BroadcastPacketsReceivedSec);
|
||||
|
||||
SETP_DIM_VALUE(st_MulticastPackets,MulticastPacketsSentSec);
|
||||
SETP_DIM_VALUE(st_MulticastPackets,MulticastPacketsReceivedSec);
|
||||
SETP_DIM_VALUE(st_MulticastPackets, MulticastPacketsSentSec);
|
||||
SETP_DIM_VALUE(st_MulticastPackets, MulticastPacketsReceivedSec);
|
||||
|
||||
rrdset_done(p->st_IPsecoffloadBytes);
|
||||
rrdset_done(p->st_DirectedPackets);
|
||||
|
@ -1566,7 +1600,6 @@ static bool do_hyperv_network_adapter(PERF_DATA_BLOCK *pDataBlock, int update_ev
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Hypervisor Virtual Processor
|
||||
struct hypervisor_processor {
|
||||
bool collected_metadata;
|
||||
|
@ -1591,7 +1624,6 @@ struct hypervisor_processor {
|
|||
collected_number TotalRunTime_total;
|
||||
};
|
||||
|
||||
|
||||
void initialize_hyperv_processor_keys(struct hypervisor_processor *p)
|
||||
{
|
||||
p->GuestRunTime.key = "% Guest Run Time";
|
||||
|
@ -1624,7 +1656,8 @@ static bool do_hyperv_processor(PERF_DATA_BLOCK *pDataBlock, int update_every, v
|
|||
if (!pi)
|
||||
break;
|
||||
|
||||
get_and_sanitize_instance_value(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
get_and_sanitize_instance_value(
|
||||
pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer));
|
||||
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
@ -1662,21 +1695,22 @@ static bool do_hyperv_processor(PERF_DATA_BLOCK *pDataBlock, int update_every, v
|
|||
|
||||
p->rd_TotalRunTime =
|
||||
rrddim_add(p->st_HypervisorProcessorTotal, "usage", NULL, 1, 1000000, RRD_ALGORITHM_INCREMENTAL);
|
||||
rrdlabels_add(p->st_HypervisorProcessorTotal->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_HypervisorProcessorTotal->rrdlabels, "vm_name", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
|
||||
p->st_HypervisorProcessor = rrdset_create_localhost(
|
||||
"vm_cpu_usage_by_run_context",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV ".vm_cpu_usage_by_run_context",
|
||||
"VM CPU usage by run context",
|
||||
"percentage",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_WINDOWS_HYPERV_VM_CPU_USAGE_BY_RUN_CONTEXT,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
"vm_cpu_usage_by_run_context",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
HYPERV,
|
||||
HYPERV ".vm_cpu_usage_by_run_context",
|
||||
"VM CPU usage by run context",
|
||||
"percentage",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_WINDOWS_HYPERV_VM_CPU_USAGE_BY_RUN_CONTEXT,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
p->rd_GuestRunTime =
|
||||
rrddim_add(p->st_HypervisorProcessor, "guest", NULL, 1, 1000000, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
@ -1696,13 +1730,18 @@ static bool do_hyperv_processor(PERF_DATA_BLOCK *pDataBlock, int update_every, v
|
|||
|
||||
{
|
||||
struct hypervisor_processor *p;
|
||||
dfe_start_read(item->instance, p) {
|
||||
rrddim_set_by_pointer(p->st_HypervisorProcessor, p->rd_HypervisorRunTime, (collected_number) p->HypervisorRunTime_total);
|
||||
rrddim_set_by_pointer(p->st_HypervisorProcessor, p->rd_GuestRunTime, (collected_number) p->GuestRunTime_total);
|
||||
rrddim_set_by_pointer(p->st_HypervisorProcessor, p->rd_RemoteRunTime, (collected_number) p->RemoteRunTime_total);
|
||||
dfe_start_read(item->instance, p)
|
||||
{
|
||||
rrddim_set_by_pointer(
|
||||
p->st_HypervisorProcessor, p->rd_HypervisorRunTime, (collected_number)p->HypervisorRunTime_total);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_HypervisorProcessor, p->rd_GuestRunTime, (collected_number)p->GuestRunTime_total);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_HypervisorProcessor, p->rd_RemoteRunTime, (collected_number)p->RemoteRunTime_total);
|
||||
rrdset_done(p->st_HypervisorProcessor);
|
||||
|
||||
rrddim_set_by_pointer(p->st_HypervisorProcessorTotal, p->rd_TotalRunTime, (collected_number) p->TotalRunTime_total);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_HypervisorProcessorTotal, p->rd_TotalRunTime, (collected_number)p->TotalRunTime_total);
|
||||
rrdset_done(p->st_HypervisorProcessorTotal);
|
||||
|
||||
p->GuestRunTime_total = 0;
|
||||
|
@ -1761,7 +1800,8 @@ hyperv_perf_item hyperv_perf_list[] = {
|
|||
|
||||
{.registry_name = NULL, .function_collect = NULL}};
|
||||
|
||||
int do_PerflibHyperV(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibHyperV(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if (unlikely(!initialized)) {
|
||||
|
|
|
@ -31,10 +31,11 @@ struct system_pool {
|
|||
COUNTER_DATA nonPagedData;
|
||||
};
|
||||
|
||||
struct swap localSwap = { 0 };
|
||||
struct system_pool localPool = { 0 };
|
||||
struct swap localSwap = {0};
|
||||
struct system_pool localPool = {0};
|
||||
|
||||
void initialize_swap_keys(struct swap *p) {
|
||||
void initialize_swap_keys(struct swap *p)
|
||||
{
|
||||
// SWAP Operations
|
||||
p->pageReadsTotal.key = "Page Reads/sec";
|
||||
p->pageWritesTotal.key = "Page Writes/s";
|
||||
|
@ -44,12 +45,14 @@ void initialize_swap_keys(struct swap *p) {
|
|||
p->pageOutputTotal.key = "Pages Output/s";
|
||||
}
|
||||
|
||||
void initialize_pool_keys(struct system_pool *p) {
|
||||
void initialize_pool_keys(struct system_pool *p)
|
||||
{
|
||||
p->pagedData.key = "Pool Paged Bytes";
|
||||
p->nonPagedData.key = "Pool Nonpaged Bytes";
|
||||
}
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
initialize_swap_keys(&localSwap);
|
||||
initialize_pool_keys(&localPool);
|
||||
}
|
||||
|
@ -63,64 +66,58 @@ static void do_memory_swap(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE *pObjec
|
|||
|
||||
if (!localSwap.operations) {
|
||||
localSwap.operations = rrdset_create_localhost(
|
||||
"mem"
|
||||
, "swap_operations", NULL
|
||||
, "swap"
|
||||
, "mem.swap_iops"
|
||||
"mem",
|
||||
"swap_operations",
|
||||
NULL,
|
||||
"swap",
|
||||
"mem.swap_iops"
|
||||
|
||||
, "Swap Operations"
|
||||
, "operations/s"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibMemory"
|
||||
, NETDATA_CHART_PRIO_MEM_SWAPIO
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
,
|
||||
"Swap Operations",
|
||||
"operations/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibMemory",
|
||||
NETDATA_CHART_PRIO_MEM_SWAPIO,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
localSwap.rd_op_read = rrddim_add(localSwap.operations, "read", NULL,
|
||||
1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_op_write = rrddim_add(localSwap.operations, "write", NULL,
|
||||
1, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_op_read = rrddim_add(localSwap.operations, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_op_write = rrddim_add(localSwap.operations, "write", NULL, 1, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(localSwap.operations,
|
||||
localSwap.rd_op_read,
|
||||
(collected_number)localSwap.pageReadsTotal.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
localSwap.operations, localSwap.rd_op_read, (collected_number)localSwap.pageReadsTotal.current.Data);
|
||||
|
||||
rrddim_set_by_pointer(localSwap.operations,
|
||||
localSwap.rd_op_write,
|
||||
(collected_number)localSwap.pageWritesTotal.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
localSwap.operations, localSwap.rd_op_write, (collected_number)localSwap.pageWritesTotal.current.Data);
|
||||
rrdset_done(localSwap.operations);
|
||||
|
||||
if (!localSwap.pages) {
|
||||
localSwap.pages = rrdset_create_localhost(
|
||||
"mem"
|
||||
, "swap_pages", NULL
|
||||
, "swap"
|
||||
, "mem.swap_pages_io"
|
||||
"mem",
|
||||
"swap_pages",
|
||||
NULL,
|
||||
"swap",
|
||||
"mem.swap_pages_io"
|
||||
|
||||
, "Swap Pages"
|
||||
, "pages/s"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibMemory"
|
||||
, NETDATA_CHART_PRIO_MEM_SWAP_PAGES
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
,
|
||||
"Swap Pages",
|
||||
"pages/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibMemory",
|
||||
NETDATA_CHART_PRIO_MEM_SWAP_PAGES,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
localSwap.rd_page_read = rrddim_add(localSwap.pages, "read", NULL,
|
||||
1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_page_write = rrddim_add(localSwap.pages, "write", NULL,
|
||||
1, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_page_read = rrddim_add(localSwap.pages, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
localSwap.rd_page_write = rrddim_add(localSwap.pages, "write", NULL, 1, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(localSwap.pages,
|
||||
localSwap.rd_page_read,
|
||||
(collected_number)localSwap.pageInputTotal.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
localSwap.pages, localSwap.rd_page_read, (collected_number)localSwap.pageInputTotal.current.Data);
|
||||
|
||||
rrddim_set_by_pointer(localSwap.pages,
|
||||
localSwap.rd_page_write,
|
||||
(collected_number)localSwap.pageOutputTotal.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
localSwap.pages, localSwap.rd_page_write, (collected_number)localSwap.pageOutputTotal.current.Data);
|
||||
rrdset_done(localSwap.pages);
|
||||
}
|
||||
|
||||
|
@ -131,45 +128,41 @@ static void do_memory_system_pool(PERF_DATA_BLOCK *pDataBlock, PERF_OBJECT_TYPE
|
|||
|
||||
if (!localPool.pool) {
|
||||
localPool.pool = rrdset_create_localhost(
|
||||
"mem"
|
||||
, "system_pool", NULL
|
||||
, "mem"
|
||||
, "mem.system_pool_size"
|
||||
"mem",
|
||||
"system_pool",
|
||||
NULL,
|
||||
"mem",
|
||||
"mem.system_pool_size"
|
||||
|
||||
, "System Memory Pool"
|
||||
, "bytes"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibMemory"
|
||||
, NETDATA_CHART_PRIO_MEM_SYSTEM_POOL
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
,
|
||||
"System Memory Pool",
|
||||
"bytes",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibMemory",
|
||||
NETDATA_CHART_PRIO_MEM_SYSTEM_POOL,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
localPool.rd_paged = rrddim_add(localPool.pool, "paged", NULL,
|
||||
1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
localPool.rd_nonpaged = rrddim_add(localPool.pool, "pool-paged", NULL,
|
||||
1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
localPool.rd_paged = rrddim_add(localPool.pool, "paged", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
localPool.rd_nonpaged = rrddim_add(localPool.pool, "pool-paged", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(localPool.pool,
|
||||
localPool.rd_paged,
|
||||
(collected_number)localPool.pagedData.current.Data);
|
||||
rrddim_set_by_pointer(localPool.pool, localPool.rd_paged, (collected_number)localPool.pagedData.current.Data);
|
||||
|
||||
rrddim_set_by_pointer(localPool.pool,
|
||||
localPool.rd_nonpaged,
|
||||
(collected_number)localPool.nonPagedData.current.Data);
|
||||
rrddim_set_by_pointer(localPool.pool, localPool.rd_nonpaged, (collected_number)localPool.nonPagedData.current.Data);
|
||||
rrdset_done(localPool.pool);
|
||||
}
|
||||
|
||||
static bool do_memory(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_memory(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Memory");
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
static COUNTER_DATA pagesPerSec = { .key = "Pages/sec" };
|
||||
static COUNTER_DATA pageFaultsPerSec = { .key = "Page Faults/sec" };
|
||||
static COUNTER_DATA pagesPerSec = {.key = "Pages/sec"};
|
||||
static COUNTER_DATA pageFaultsPerSec = {.key = "Page Faults/sec"};
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &pageFaultsPerSec) &&
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &pageFaultsPerSec) &&
|
||||
perflibGetObjectCounter(pDataBlock, pObjectType, &pagesPerSec)) {
|
||||
ULONGLONG total = pageFaultsPerSec.current.Data;
|
||||
ULONGLONG major = pagesPerSec.current.Data;
|
||||
|
@ -177,16 +170,16 @@ static bool do_memory(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
common_mem_pgfaults(minor, major, update_every);
|
||||
}
|
||||
|
||||
static COUNTER_DATA availableBytes = { .key = "Available Bytes" };
|
||||
static COUNTER_DATA availableKBytes = { .key = "Available KBytes" };
|
||||
static COUNTER_DATA availableMBytes = { .key = "Available MBytes" };
|
||||
static COUNTER_DATA availableBytes = {.key = "Available Bytes"};
|
||||
static COUNTER_DATA availableKBytes = {.key = "Available KBytes"};
|
||||
static COUNTER_DATA availableMBytes = {.key = "Available MBytes"};
|
||||
ULONGLONG available_bytes = 0;
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &availableBytes))
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &availableBytes))
|
||||
available_bytes = availableBytes.current.Data;
|
||||
else if(perflibGetObjectCounter(pDataBlock, pObjectType, &availableKBytes))
|
||||
else if (perflibGetObjectCounter(pDataBlock, pObjectType, &availableKBytes))
|
||||
available_bytes = availableKBytes.current.Data * 1024;
|
||||
else if(perflibGetObjectCounter(pDataBlock, pObjectType, &availableMBytes))
|
||||
else if (perflibGetObjectCounter(pDataBlock, pObjectType, &availableMBytes))
|
||||
available_bytes = availableMBytes.current.Data * 1024 * 1024;
|
||||
|
||||
common_mem_available(available_bytes, update_every);
|
||||
|
@ -198,20 +191,22 @@ static bool do_memory(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibMemory(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibMemory(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("Memory");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
do_memory(pDataBlock, update_every);
|
||||
|
||||
|
|
|
@ -168,7 +168,8 @@ struct mssql_db_instance {
|
|||
|
||||
static DICTIONARY *mssql_instances = NULL;
|
||||
|
||||
static void initialize_mssql_objects(struct mssql_instance *p, const char *instance) {
|
||||
static void initialize_mssql_objects(struct mssql_instance *p, const char *instance)
|
||||
{
|
||||
char prefix[NETDATA_MAX_INSTANCE_NAME];
|
||||
if (!strcmp(instance, "MSSQLSERVER")) {
|
||||
strncpyz(prefix, "SQLServer:", sizeof(prefix) - 1);
|
||||
|
@ -208,7 +209,8 @@ static void initialize_mssql_objects(struct mssql_instance *p, const char *insta
|
|||
p->instanceID = strdup(instance);
|
||||
}
|
||||
|
||||
static inline void initialize_mssql_keys(struct mssql_instance *p) {
|
||||
static inline void initialize_mssql_keys(struct mssql_instance *p)
|
||||
{
|
||||
// General Statistics (https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-general-statistics-object)
|
||||
p->MSSQLUserConnections.key = "User Connections";
|
||||
p->MSSQLBlockedProcesses.key = "Processes blocked";
|
||||
|
@ -240,14 +242,16 @@ static inline void initialize_mssql_keys(struct mssql_instance *p) {
|
|||
p->MSSQLTotalServerMemory.key = "Total Server Memory (KB)";
|
||||
}
|
||||
|
||||
void dict_mssql_insert_locks_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_mssql_insert_locks_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
// https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-locks-object
|
||||
struct mssql_lock_instance *ptr = value;
|
||||
ptr->deadLocks.key = "Number of Deadlocks/sec";
|
||||
ptr->lockWait.key = "Lock Waits/sec";
|
||||
}
|
||||
|
||||
void dict_mssql_insert_databases_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_mssql_insert_databases_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct mssql_db_instance *ptr = value;
|
||||
|
||||
// https://learn.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object
|
||||
|
@ -260,7 +264,8 @@ void dict_mssql_insert_databases_cb(const DICTIONARY_ITEM *item __maybe_unused,
|
|||
ptr->MSSQLDatabaseWriteTransactions.key = "Write Transactions/sec";
|
||||
}
|
||||
|
||||
void dict_mssql_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_mssql_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct mssql_instance *p = value;
|
||||
const char *instance = dictionary_acquired_item_name((DICTIONARY_ITEM *)item);
|
||||
|
||||
|
@ -280,7 +285,8 @@ void dict_mssql_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *valu
|
|||
initialize_mssql_keys(p);
|
||||
}
|
||||
|
||||
static int mssql_fill_dictionary() {
|
||||
static int mssql_fill_dictionary()
|
||||
{
|
||||
HKEY hKey;
|
||||
LSTATUS ret = RegOpenKeyExA(
|
||||
HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Microsoft SQL Server\\Instance Names\\SQL", 0, KEY_READ, &hKey);
|
||||
|
@ -325,7 +331,8 @@ endMSSQLFillDict:
|
|||
return (ret == ERROR_SUCCESS) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int initialize(void) {
|
||||
static int initialize(void)
|
||||
{
|
||||
mssql_instances = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct mssql_instance));
|
||||
|
||||
|
@ -338,7 +345,8 @@ static int initialize(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void do_mssql_general_stats(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_general_stats(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_GENERAL_STATS]);
|
||||
|
@ -402,7 +410,8 @@ static void do_mssql_general_stats(PERF_DATA_BLOCK *pDataBlock, struct mssql_ins
|
|||
}
|
||||
}
|
||||
|
||||
static void do_mssql_sql_statistics(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_sql_statistics(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_SQL_STATS]);
|
||||
|
@ -560,7 +569,8 @@ static void do_mssql_sql_statistics(PERF_DATA_BLOCK *pDataBlock, struct mssql_in
|
|||
}
|
||||
}
|
||||
|
||||
static void do_mssql_buffer_management(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_buffer_management(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType =
|
||||
|
@ -694,7 +704,8 @@ static void do_mssql_buffer_management(PERF_DATA_BLOCK *pDataBlock, struct mssql
|
|||
}
|
||||
}
|
||||
|
||||
static void do_mssql_access_methods(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_access_methods(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType =
|
||||
|
@ -735,7 +746,8 @@ static void do_mssql_access_methods(PERF_DATA_BLOCK *pDataBlock, struct mssql_in
|
|||
}
|
||||
}
|
||||
|
||||
static void do_mssql_errors(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_errors(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_SQL_ERRORS]);
|
||||
|
@ -771,7 +783,8 @@ static void do_mssql_errors(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *
|
|||
}
|
||||
}
|
||||
|
||||
int dict_mssql_locks_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
int dict_mssql_locks_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
struct mssql_lock_instance *mli = value;
|
||||
|
@ -842,7 +855,8 @@ int dict_mssql_locks_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void do_mssql_locks(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_locks(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_LOCKS]);
|
||||
if (!pObjectType)
|
||||
return;
|
||||
|
@ -879,7 +893,8 @@ static void do_mssql_locks(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p
|
|||
rrdset_done(p->st_deadLocks);
|
||||
}
|
||||
|
||||
static void mssql_database_backup_restore_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_database_backup_restore_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_backup_restore_operations) {
|
||||
|
@ -922,7 +937,8 @@ static void mssql_database_backup_restore_chart(struct mssql_db_instance *mli, c
|
|||
rrdset_done(mli->st_db_backup_restore_operations);
|
||||
}
|
||||
|
||||
static void mssql_database_log_flushes_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_database_log_flushes_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_log_flushes) {
|
||||
|
@ -960,7 +976,8 @@ static void mssql_database_log_flushes_chart(struct mssql_db_instance *mli, cons
|
|||
rrdset_done(mli->st_db_log_flushes);
|
||||
}
|
||||
|
||||
static void mssql_database_log_flushed_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_database_log_flushed_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_log_flushed) {
|
||||
|
@ -998,7 +1015,8 @@ static void mssql_database_log_flushed_chart(struct mssql_db_instance *mli, cons
|
|||
rrdset_done(mli->st_db_log_flushed);
|
||||
}
|
||||
|
||||
static void mssql_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_transactions) {
|
||||
|
@ -1037,7 +1055,8 @@ static void mssql_transactions_chart(struct mssql_db_instance *mli, const char *
|
|||
rrdset_done(mli->st_db_transactions);
|
||||
}
|
||||
|
||||
static void mssql_write_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_write_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_write_transactions) {
|
||||
|
@ -1077,7 +1096,8 @@ static void mssql_write_transactions_chart(struct mssql_db_instance *mli, const
|
|||
rrdset_done(mli->st_db_write_transactions);
|
||||
}
|
||||
|
||||
static void mssql_active_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static void mssql_active_transactions_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_active_transactions) {
|
||||
|
@ -1117,7 +1137,8 @@ static void mssql_active_transactions_chart(struct mssql_db_instance *mli, const
|
|||
rrdset_done(mli->st_db_active_transactions);
|
||||
}
|
||||
|
||||
static inline void mssql_data_file_size_chart(struct mssql_db_instance *mli, const char *db, int update_every) {
|
||||
static inline void mssql_data_file_size_chart(struct mssql_db_instance *mli, const char *db, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
if (!mli->st_db_data_file_size) {
|
||||
|
@ -1154,7 +1175,8 @@ static inline void mssql_data_file_size_chart(struct mssql_db_instance *mli, con
|
|||
rrdset_done(mli->st_db_data_file_size);
|
||||
}
|
||||
|
||||
int dict_mssql_databases_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
int dict_mssql_databases_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct mssql_db_instance *mli = value;
|
||||
const char *db = dictionary_acquired_item_name((DICTIONARY_ITEM *)item);
|
||||
|
||||
|
@ -1182,7 +1204,8 @@ int dict_mssql_databases_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, v
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void do_mssql_databases(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_databases(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_DATABASE]);
|
||||
if (!pObjectType)
|
||||
return;
|
||||
|
@ -1236,7 +1259,8 @@ static void do_mssql_databases(PERF_DATA_BLOCK *pDataBlock, struct mssql_instanc
|
|||
dictionary_sorted_walkthrough_read(p->databases, dict_mssql_databases_charts_cb, &update_every);
|
||||
}
|
||||
|
||||
static void do_mssql_memory_mgr(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every) {
|
||||
static void do_mssql_memory_mgr(PERF_DATA_BLOCK *pDataBlock, struct mssql_instance *p, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->objectName[NETDATA_MSSQL_MEMORY]);
|
||||
|
@ -1367,7 +1391,8 @@ static void do_mssql_memory_mgr(PERF_DATA_BLOCK *pDataBlock, struct mssql_instan
|
|||
}
|
||||
}
|
||||
|
||||
int dict_mssql_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
int dict_mssql_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct mssql_instance *p = value;
|
||||
int *update_every = data;
|
||||
|
||||
|
@ -1400,7 +1425,8 @@ int dict_mssql_charts_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value
|
|||
return 1;
|
||||
}
|
||||
|
||||
int do_PerflibMSSQL(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibMSSQL(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if (unlikely(!initialized)) {
|
||||
|
|
|
@ -115,146 +115,156 @@ struct network_protocol {
|
|||
} networks[] = {
|
||||
{
|
||||
.protocol = "IPv4",
|
||||
.packets = {
|
||||
.received = { .key = "Datagrams Received/sec" },
|
||||
.sent = { .key = "Datagrams Sent/sec" },
|
||||
.delivered = { .key = "Datagrams Received Delivered/sec" },
|
||||
.forwarded = { .key = "Datagrams Forwarded/sec" },
|
||||
.type = "ipv4",
|
||||
.id = "packets",
|
||||
.family = "packets",
|
||||
.context = "ipv4.packets",
|
||||
.title = "IPv4 Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Datagrams Received/sec"},
|
||||
.sent = {.key = "Datagrams Sent/sec"},
|
||||
.delivered = {.key = "Datagrams Received Delivered/sec"},
|
||||
.forwarded = {.key = "Datagrams Forwarded/sec"},
|
||||
.type = "ipv4",
|
||||
.id = "packets",
|
||||
.family = "packets",
|
||||
.context = "ipv4.packets",
|
||||
.title = "IPv4 Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "IPv6",
|
||||
.packets = {
|
||||
.received = { .key = "Datagrams Received/sec" },
|
||||
.sent = { .key = "Datagrams Sent/sec" },
|
||||
.delivered = { .key = "Datagrams Received Delivered/sec" },
|
||||
.forwarded = { .key = "Datagrams Forwarded/sec" },
|
||||
.type = "ipv6",
|
||||
.id = "packets",
|
||||
.family = "packets",
|
||||
.context = "ip6.packets",
|
||||
.title = "IPv6 Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Datagrams Received/sec"},
|
||||
.sent = {.key = "Datagrams Sent/sec"},
|
||||
.delivered = {.key = "Datagrams Received Delivered/sec"},
|
||||
.forwarded = {.key = "Datagrams Forwarded/sec"},
|
||||
.type = "ipv6",
|
||||
.id = "packets",
|
||||
.family = "packets",
|
||||
.context = "ip6.packets",
|
||||
.title = "IPv6 Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "TCPv4",
|
||||
.packets = {
|
||||
.received = { .key = "Segments Received/sec" },
|
||||
.sent = { .key = "Segments Sent/sec" },
|
||||
.type = "ipv4",
|
||||
.id = "tcppackets",
|
||||
.family = "tcp",
|
||||
.context = "ipv4.tcppackets",
|
||||
.title = "IPv4 TCP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_TCP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Segments Received/sec"},
|
||||
.sent = {.key = "Segments Sent/sec"},
|
||||
.type = "ipv4",
|
||||
.id = "tcppackets",
|
||||
.family = "tcp",
|
||||
.context = "ipv4.tcppackets",
|
||||
.title = "IPv4 TCP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_TCP_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "TCPv6",
|
||||
.packets = {
|
||||
.received = { .key = "Segments Received/sec" },
|
||||
.sent = { .key = "Segments Sent/sec" },
|
||||
.type = "ipv6",
|
||||
.id = "tcppackets",
|
||||
.family = "tcp6",
|
||||
.context = "ipv6.tcppackets",
|
||||
.title = "IPv6 TCP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_TCP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Segments Received/sec"},
|
||||
.sent = {.key = "Segments Sent/sec"},
|
||||
.type = "ipv6",
|
||||
.id = "tcppackets",
|
||||
.family = "tcp6",
|
||||
.context = "ipv6.tcppackets",
|
||||
.title = "IPv6 TCP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_TCP_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "UDPv4",
|
||||
.packets = {
|
||||
.received = { .key = "Datagrams Received/sec" },
|
||||
.sent = { .key = "Datagrams Sent/sec" },
|
||||
.type = "ipv4",
|
||||
.id = "udppackets",
|
||||
.family = "udp",
|
||||
.context = "ipv4.udppackets",
|
||||
.title = "IPv4 UDP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_UDP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Datagrams Received/sec"},
|
||||
.sent = {.key = "Datagrams Sent/sec"},
|
||||
.type = "ipv4",
|
||||
.id = "udppackets",
|
||||
.family = "udp",
|
||||
.context = "ipv4.udppackets",
|
||||
.title = "IPv4 UDP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_UDP_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "UDPv6",
|
||||
.packets = {
|
||||
.received = { .key = "Datagrams Received/sec" },
|
||||
.sent = { .key = "Datagrams Sent/sec" },
|
||||
.type = "ipv6",
|
||||
.id = "udppackets",
|
||||
.family = "udp6",
|
||||
.context = "ipv6.udppackets",
|
||||
.title = "IPv6 UDP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_UDP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Datagrams Received/sec"},
|
||||
.sent = {.key = "Datagrams Sent/sec"},
|
||||
.type = "ipv6",
|
||||
.id = "udppackets",
|
||||
.family = "udp6",
|
||||
.context = "ipv6.udppackets",
|
||||
.title = "IPv6 UDP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_UDP_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "ICMP",
|
||||
.packets = {
|
||||
.received = { .key = "Messages Received/sec" },
|
||||
.sent = { .key = "Messages Sent/sec" },
|
||||
.type = "ipv4",
|
||||
.id = "icmp",
|
||||
.family = "icmp",
|
||||
.context = "ipv4.icmp",
|
||||
.title = "IPv4 ICMP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_ICMP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Messages Received/sec"},
|
||||
.sent = {.key = "Messages Sent/sec"},
|
||||
.type = "ipv4",
|
||||
.id = "icmp",
|
||||
.family = "icmp",
|
||||
.context = "ipv4.icmp",
|
||||
.title = "IPv4 ICMP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_ICMP_PACKETS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "ICMPv6",
|
||||
.packets = {
|
||||
.received = { .key = "Messages Received/sec" },
|
||||
.sent = { .key = "Messages Sent/sec" },
|
||||
.type = "ipv6",
|
||||
.id = "icmp",
|
||||
.family = "icmp6",
|
||||
.context = "ipv6.icmp",
|
||||
.title = "IPv6 ICMP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_ICMP_PACKETS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.received = {.key = "Messages Received/sec"},
|
||||
.sent = {.key = "Messages Sent/sec"},
|
||||
.type = "ipv6",
|
||||
.id = "icmp",
|
||||
.family = "icmp6",
|
||||
.context = "ipv6.icmp",
|
||||
.title = "IPv6 ICMP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_ICMP_PACKETS,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
.protocol = "IPv4",
|
||||
.packets = {
|
||||
.InDiscards = { .key = "Datagrams Received Discarded" },
|
||||
.OutDiscards = { .key = "Datagrams Outbound Discarded" },
|
||||
.OutNoRoutes = { .key = "Datagrams Outbound No Route" },
|
||||
.InAddrErrors = { .key = "Datagrams Received Address Errors" },
|
||||
.InHdrErrors = { .key = "Datagrams Received Header Errors" },
|
||||
.InUnknownProtos = { .key = "Datagrams Received Unknown Protocol" },
|
||||
.type = "ipv4",
|
||||
.id = "errors",
|
||||
.family = "errors",
|
||||
.context = "ipv4.errors",
|
||||
.title = "IPv4 errors",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_ERRORS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.InDiscards = {.key = "Datagrams Received Discarded"},
|
||||
.OutDiscards = {.key = "Datagrams Outbound Discarded"},
|
||||
.OutNoRoutes = {.key = "Datagrams Outbound No Route"},
|
||||
.InAddrErrors = {.key = "Datagrams Received Address Errors"},
|
||||
.InHdrErrors = {.key = "Datagrams Received Header Errors"},
|
||||
.InUnknownProtos = {.key = "Datagrams Received Unknown Protocol"},
|
||||
.type = "ipv4",
|
||||
.id = "errors",
|
||||
.family = "errors",
|
||||
.context = "ipv4.errors",
|
||||
.title = "IPv4 errors",
|
||||
.priority = NETDATA_CHART_PRIO_IPV4_ERRORS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "IPv6",
|
||||
.packets = {
|
||||
.InDiscards = { .key = "Datagrams Received Discarded" },
|
||||
.OutDiscards = { .key = "Datagrams Outbound Discarded" },
|
||||
.OutNoRoutes = { .key = "Datagrams Outbound No Route" },
|
||||
.InAddrErrors = { .key = "Datagrams Received Address Errors" },
|
||||
.InHdrErrors = { .key = "Datagrams Received Header Errors" },
|
||||
.InUnknownProtos = { .key = "Datagrams Received Unknown Protocol" },
|
||||
.type = "ipv6",
|
||||
.id = "errors",
|
||||
.family = "errors",
|
||||
.context = "ipv6.errors",
|
||||
.title = "IPv6 errors",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_ERRORS,
|
||||
},
|
||||
.packets =
|
||||
{
|
||||
.InDiscards = {.key = "Datagrams Received Discarded"},
|
||||
.OutDiscards = {.key = "Datagrams Outbound Discarded"},
|
||||
.OutNoRoutes = {.key = "Datagrams Outbound No Route"},
|
||||
.InAddrErrors = {.key = "Datagrams Received Address Errors"},
|
||||
.InHdrErrors = {.key = "Datagrams Received Header Errors"},
|
||||
.InUnknownProtos = {.key = "Datagrams Received Unknown Protocol"},
|
||||
.type = "ipv6",
|
||||
.id = "errors",
|
||||
.family = "errors",
|
||||
.context = "ipv6.errors",
|
||||
.title = "IPv6 errors",
|
||||
.priority = NETDATA_CHART_PRIO_IPV6_ERRORS,
|
||||
},
|
||||
},
|
||||
{
|
||||
.protocol = "ICMP",
|
||||
|
@ -326,8 +336,7 @@ struct network_protocol {
|
|||
// terminator
|
||||
{
|
||||
.protocol = NULL,
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
struct network_protocol tcp46 = {
|
||||
.packets = {
|
||||
|
@ -337,28 +346,27 @@ struct network_protocol tcp46 = {
|
|||
.context = "ip.tcppackets",
|
||||
.title = "TCP Packets",
|
||||
.priority = NETDATA_CHART_PRIO_IP_TCP_PACKETS,
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
static void protocol_packets_chart_update(struct network_protocol *p, int update_every) {
|
||||
if(!p->packets.st) {
|
||||
static void protocol_packets_chart_update(struct network_protocol *p, int update_every)
|
||||
{
|
||||
if (!p->packets.st) {
|
||||
p->packets.st = rrdset_create_localhost(
|
||||
p->packets.type
|
||||
, p->packets.id
|
||||
, NULL
|
||||
, p->packets.family
|
||||
, NULL
|
||||
, p->packets.title
|
||||
, "packets/s"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibNetwork"
|
||||
, p->packets.priority
|
||||
, update_every
|
||||
, RRDSET_TYPE_AREA
|
||||
);
|
||||
p->packets.type,
|
||||
p->packets.id,
|
||||
NULL,
|
||||
p->packets.family,
|
||||
NULL,
|
||||
p->packets.title,
|
||||
"packets/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
p->packets.priority,
|
||||
update_every,
|
||||
RRDSET_TYPE_AREA);
|
||||
|
||||
RRDSET *st = p->packets.st;
|
||||
|
||||
|
||||
ADD_RRD_DIM_IF_KEY(received, "received", NULL, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
ADD_RRD_DIM_IF_KEY(sent, "sent", NULL, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
ADD_RRD_DIM_IF_KEY(forwarded, "forwarded", NULL, -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
@ -392,7 +400,6 @@ static void protocol_packets_chart_update(struct network_protocol *p, int update
|
|||
ADD_RRD_DIM_IF_KEY(OutTimestamps, "OutType13", "OutTimestamps", -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
ADD_RRD_DIM_IF_KEY(InTimestampReps, "InType14", "InTimestampReps", 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
ADD_RRD_DIM_IF_KEY(OutTimestampReps, "OutType14", "OutTimestampReps", -1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
}
|
||||
|
||||
SET_DIM_IF_KEY_AND_UPDATED(p, received);
|
||||
|
@ -433,11 +440,14 @@ static void protocol_packets_chart_update(struct network_protocol *p, int update
|
|||
rrdset_done(p->packets.st);
|
||||
}
|
||||
|
||||
static bool do_network_protocol(PERF_DATA_BLOCK *pDataBlock, int update_every, struct network_protocol *p) {
|
||||
if(!p || !p->protocol) return false;
|
||||
static bool do_network_protocol(PERF_DATA_BLOCK *pDataBlock, int update_every, struct network_protocol *p)
|
||||
{
|
||||
if (!p || !p->protocol)
|
||||
return false;
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, p->protocol);
|
||||
if(!pObjectType) return false;
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
size_t packets = 0;
|
||||
ADD_PACKET_IF_KEY(p, packets, pDataBlock, pObjectType, received);
|
||||
|
@ -476,7 +486,7 @@ static bool do_network_protocol(PERF_DATA_BLOCK *pDataBlock, int update_every, s
|
|||
ADD_PACKET_IF_KEY(p, packets, pDataBlock, pObjectType, InTimestampReps);
|
||||
ADD_PACKET_IF_KEY(p, packets, pDataBlock, pObjectType, OutTimestampReps);
|
||||
|
||||
if(packets)
|
||||
if (packets)
|
||||
protocol_packets_chart_update(p, update_every);
|
||||
|
||||
return true;
|
||||
|
@ -567,7 +577,8 @@ struct network_interface {
|
|||
|
||||
static DICTIONARY *physical_interfaces = NULL, *virtual_interfaces = NULL;
|
||||
|
||||
static void network_interface_init(struct network_interface *d) {
|
||||
static void network_interface_init(struct network_interface *d)
|
||||
{
|
||||
d->packets.received.key = "Packets Received/sec";
|
||||
d->packets.sent.key = "Packets Sent/sec";
|
||||
d->traffic.received.key = "Bytes Received/sec";
|
||||
|
@ -585,7 +596,8 @@ static void network_interface_init(struct network_interface *d) {
|
|||
d->rsc.average_packet_size.key = "TCP RSC Average Packet Size";
|
||||
}
|
||||
|
||||
static void network_interface_cleanup(struct network_interface *d) {
|
||||
static void network_interface_cleanup(struct network_interface *d)
|
||||
{
|
||||
rrdvar_chart_variable_release(d->traffic.st, d->traffic.chart_var_speed);
|
||||
rrdset_is_obsolete___safe_from_collector_thread(d->packets.st);
|
||||
rrdset_is_obsolete___safe_from_collector_thread(d->traffic.st);
|
||||
|
@ -600,67 +612,74 @@ static void network_interface_cleanup(struct network_interface *d) {
|
|||
rrdset_is_obsolete___safe_from_collector_thread(d->rsc.st_average_packet_size);
|
||||
}
|
||||
|
||||
void dict_interface_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_interface_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct network_interface *ni = value;
|
||||
network_interface_init(ni);
|
||||
}
|
||||
|
||||
static void initialize(void) {
|
||||
physical_interfaces = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE |
|
||||
DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct network_interface));
|
||||
static void initialize(void)
|
||||
{
|
||||
physical_interfaces = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct network_interface));
|
||||
|
||||
virtual_interfaces = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE |
|
||||
DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct network_interface));
|
||||
virtual_interfaces = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct network_interface));
|
||||
|
||||
dictionary_register_insert_callback(physical_interfaces, dict_interface_insert_cb, NULL);
|
||||
dictionary_register_insert_callback(virtual_interfaces, dict_interface_insert_cb, NULL);
|
||||
}
|
||||
|
||||
static void add_interface_labels(RRDSET *st, const char *name, bool physical) {
|
||||
static void add_interface_labels(RRDSET *st, const char *name, bool physical)
|
||||
{
|
||||
rrdlabels_add(st->rrdlabels, "device", name, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(st->rrdlabels, "interface_type", physical ? "real" : "virtual", RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
static bool is_physical_interface(const char *name) {
|
||||
static bool is_physical_interface(const char *name)
|
||||
{
|
||||
void *d = dictionary_get(physical_interfaces, name);
|
||||
return d ? true : false;
|
||||
}
|
||||
|
||||
static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every, bool physical, usec_t now_ut) {
|
||||
static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every, bool physical, usec_t now_ut)
|
||||
{
|
||||
DICTIONARY *dict = physical ? physical_interfaces : virtual_interfaces;
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, physical ? "Network Interface" : "Network Adapter");
|
||||
if(!pObjectType) return false;
|
||||
PERF_OBJECT_TYPE *pObjectType =
|
||||
perflibFindObjectTypeByName(pDataBlock, physical ? "Network Interface" : "Network Adapter");
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
uint64_t total_received = 0, total_sent = 0;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for(LONG i = 0; i < pObjectType->NumInstances ; i++) {
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if(!pi) break;
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
if(!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
if (!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
strncpyz(windows_shared_buffer, "[unknown]", sizeof(windows_shared_buffer) - 1);
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
if(!physical && is_physical_interface(windows_shared_buffer))
|
||||
if (!physical && is_physical_interface(windows_shared_buffer))
|
||||
// this virtual interface is already reported as physical interface
|
||||
continue;
|
||||
|
||||
struct network_interface *d = dictionary_set(dict, windows_shared_buffer, NULL, sizeof(*d));
|
||||
d->last_collected = now_ut;
|
||||
|
||||
if(!d->collected_metadata) {
|
||||
if (!d->collected_metadata) {
|
||||
// TODO - get metadata about the network interface
|
||||
d->collected_metadata = true;
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->traffic.received) &&
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->traffic.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->traffic.sent)) {
|
||||
|
||||
if(d->traffic.received.current.Data == 0 && d->traffic.sent.current.Data == 0)
|
||||
if (d->traffic.received.current.Data == 0 && d->traffic.sent.current.Data == 0)
|
||||
// this interface has not received or sent any traffic yet
|
||||
continue;
|
||||
|
||||
|
@ -681,8 +700,10 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
|
||||
add_interface_labels(d->traffic.st, windows_shared_buffer, physical);
|
||||
|
||||
d->traffic.rd_received = rrddim_add(d->traffic.st, "received", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->traffic.rd_sent = rrddim_add(d->traffic.st, "sent", NULL, -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->traffic.rd_received =
|
||||
rrddim_add(d->traffic.st, "received", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->traffic.rd_sent =
|
||||
rrddim_add(d->traffic.st, "sent", NULL, -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
d->traffic.chart_var_speed = rrdvar_chart_variable_add_and_acquire(d->traffic.st, "nic_speed_max");
|
||||
rrdvar_chart_variable_set(d->traffic.st, d->traffic.chart_var_speed, NAN);
|
||||
|
@ -691,14 +712,14 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
total_received += d->traffic.received.current.Data;
|
||||
total_sent += d->traffic.sent.current.Data;
|
||||
|
||||
rrddim_set_by_pointer(d->traffic.st, d->traffic.rd_received, (collected_number)d->traffic.received.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->traffic.st, d->traffic.rd_received, (collected_number)d->traffic.received.current.Data);
|
||||
rrddim_set_by_pointer(d->traffic.st, d->traffic.rd_sent, (collected_number)d->traffic.sent.current.Data);
|
||||
rrdset_done(d->traffic.st);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->packets.received) &&
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->packets.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->packets.sent)) {
|
||||
|
||||
if (unlikely(!d->packets.st)) {
|
||||
d->packets.st = rrdset_create_localhost(
|
||||
"net_packets",
|
||||
|
@ -720,57 +741,58 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
d->packets.rd_sent = rrddim_add(d->packets.st, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->packets.st, d->packets.rd_received, (collected_number)d->packets.received.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->packets.st, d->packets.rd_received, (collected_number)d->packets.received.current.Data);
|
||||
rrddim_set_by_pointer(d->packets.st, d->packets.rd_sent, (collected_number)d->packets.sent.current.Data);
|
||||
rrdset_done(d->packets.st);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->speed.current_bandwidth)) {
|
||||
if(unlikely(!d->speed.st)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->speed.current_bandwidth)) {
|
||||
if (unlikely(!d->speed.st)) {
|
||||
d->speed.st = rrdset_create_localhost(
|
||||
"net_speed"
|
||||
, windows_shared_buffer
|
||||
, NULL
|
||||
, windows_shared_buffer
|
||||
, "net.speed"
|
||||
, "Interface Speed"
|
||||
, "kilobits/s"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibNetwork"
|
||||
, NETDATA_CHART_PRIO_FIRST_NET_IFACE + 10
|
||||
, update_every
|
||||
, RRDSET_TYPE_LINE
|
||||
);
|
||||
"net_speed",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.speed",
|
||||
"Interface Speed",
|
||||
"kilobits/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 10,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->speed.st, windows_shared_buffer, physical);
|
||||
|
||||
d->speed.rd = rrddim_add(d->speed.st, "speed", NULL, 1, BITS_IN_A_KILOBIT, RRD_ALGORITHM_ABSOLUTE);
|
||||
d->speed.rd = rrddim_add(d->speed.st, "speed", NULL, 1, BITS_IN_A_KILOBIT, RRD_ALGORITHM_ABSOLUTE);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->speed.st, d->speed.rd, (collected_number)d->speed.current_bandwidth.current.Data);
|
||||
rrdset_done(d->speed.st);
|
||||
|
||||
rrdvar_chart_variable_set(d->traffic.st, d->traffic.chart_var_speed,
|
||||
(NETDATA_DOUBLE)d->speed.current_bandwidth.current.Data / BITS_IN_A_KILOBIT);
|
||||
rrdvar_chart_variable_set(
|
||||
d->traffic.st,
|
||||
d->traffic.chart_var_speed,
|
||||
(NETDATA_DOUBLE)d->speed.current_bandwidth.current.Data / BITS_IN_A_KILOBIT);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->errors.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->errors.outbound)) {
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->errors.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->errors.outbound)) {
|
||||
if (unlikely(!d->errors.st)) {
|
||||
d->errors.st = rrdset_create_localhost(
|
||||
"net_errors",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.errors",
|
||||
"Interface Errors",
|
||||
"errors/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 3,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_errors",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.errors",
|
||||
"Interface Errors",
|
||||
"errors/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 3,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->errors.st, windows_shared_buffer, physical);
|
||||
|
||||
|
@ -778,55 +800,59 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
d->errors.rd_outbound = rrddim_add(d->errors.st, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->errors.st, d->errors.rd_received, (collected_number)d->errors.received.current.Data);
|
||||
rrddim_set_by_pointer(d->errors.st, d->errors.rd_outbound, (collected_number)d->errors.outbound.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->errors.st, d->errors.rd_received, (collected_number)d->errors.received.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->errors.st, d->errors.rd_outbound, (collected_number)d->errors.outbound.current.Data);
|
||||
rrdset_done(d->errors.st);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->discards.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->discards.outbound)) {
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->discards.received) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->discards.outbound)) {
|
||||
if (unlikely(!d->discards.st)) {
|
||||
d->discards.st = rrdset_create_localhost(
|
||||
"net_drops",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.drops",
|
||||
"Interface Drops",
|
||||
"drops/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 4,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_drops",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.drops",
|
||||
"Interface Drops",
|
||||
"drops/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 4,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->discards.st, windows_shared_buffer, physical);
|
||||
|
||||
d->discards.rd_received = rrddim_add(d->discards.st, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->discards.rd_outbound = rrddim_add(d->discards.st, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->discards.rd_outbound =
|
||||
rrddim_add(d->discards.st, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->discards.st, d->discards.rd_received, (collected_number)d->discards.received.current.Data);
|
||||
rrddim_set_by_pointer(d->discards.st, d->discards.rd_outbound, (collected_number)d->discards.outbound.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->discards.st, d->discards.rd_received, (collected_number)d->discards.received.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->discards.st, d->discards.rd_outbound, (collected_number)d->discards.outbound.current.Data);
|
||||
rrdset_done(d->discards.st);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->queue.length)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->queue.length)) {
|
||||
if (unlikely(!d->queue.st)) {
|
||||
d->queue.st = rrdset_create_localhost(
|
||||
"net_queue_length",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.queue_length",
|
||||
"Interface Output Queue Length",
|
||||
"packets",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 5,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_queue_length",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.queue_length",
|
||||
"Interface Output Queue Length",
|
||||
"packets",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 5,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->queue.st, windows_shared_buffer, physical);
|
||||
|
||||
|
@ -837,46 +863,48 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
rrdset_done(d->queue.st);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.connections)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.connections)) {
|
||||
if (unlikely(!d->rsc.st_connections)) {
|
||||
d->rsc.st_connections = rrdset_create_localhost(
|
||||
"net_rsc_connections",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_connections",
|
||||
"Active TCP Connections Offloaded by RSC",
|
||||
"connections",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 6,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_rsc_connections",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_connections",
|
||||
"Active TCP Connections Offloaded by RSC",
|
||||
"connections",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 6,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->rsc.st_connections, windows_shared_buffer, physical);
|
||||
|
||||
d->rsc.rd_connections = rrddim_add(d->rsc.st_connections, "connections", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
d->rsc.rd_connections =
|
||||
rrddim_add(d->rsc.st_connections, "connections", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->rsc.st_connections, d->rsc.rd_connections, (collected_number)d->rsc.connections.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->rsc.st_connections, d->rsc.rd_connections, (collected_number)d->rsc.connections.current.Data);
|
||||
rrdset_done(d->rsc.st_connections);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.packets)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.packets)) {
|
||||
if (unlikely(!d->rsc.st_packets)) {
|
||||
d->rsc.st_packets = rrdset_create_localhost(
|
||||
"net_rsc_packets",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_packets",
|
||||
"TCP RSC Coalesced Packets",
|
||||
"packets/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 7,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_rsc_packets",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_packets",
|
||||
"TCP RSC Coalesced Packets",
|
||||
"packets/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 7,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->rsc.st_packets, windows_shared_buffer, physical);
|
||||
|
||||
|
@ -887,71 +915,77 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
rrdset_done(d->rsc.st_packets);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.exceptions)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.exceptions)) {
|
||||
if (unlikely(!d->rsc.st_exceptions)) {
|
||||
d->rsc.st_exceptions = rrdset_create_localhost(
|
||||
"net_rsc_exceptions",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_exceptions",
|
||||
"TCP RSC Exceptions",
|
||||
"exceptions/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 8,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_rsc_exceptions",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_exceptions",
|
||||
"TCP RSC Exceptions",
|
||||
"exceptions/s",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 8,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->rsc.st_exceptions, windows_shared_buffer, physical);
|
||||
|
||||
d->rsc.rd_exceptions = rrddim_add(d->rsc.st_exceptions, "exceptions", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
d->rsc.rd_exceptions =
|
||||
rrddim_add(d->rsc.st_exceptions, "exceptions", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->rsc.st_exceptions, d->rsc.rd_exceptions, (collected_number)d->rsc.exceptions.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->rsc.st_exceptions, d->rsc.rd_exceptions, (collected_number)d->rsc.exceptions.current.Data);
|
||||
rrdset_done(d->rsc.st_exceptions);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.average_packet_size)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->rsc.average_packet_size)) {
|
||||
if (unlikely(!d->rsc.st_average_packet_size)) {
|
||||
d->rsc.st_average_packet_size = rrdset_create_localhost(
|
||||
"net_rsc_average_packet_size",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_average_packet_size",
|
||||
"TCP RSC Average Packet Size",
|
||||
"bytes",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 9,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_rsc_average_packet_size",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.rsc_average_packet_size",
|
||||
"TCP RSC Average Packet Size",
|
||||
"bytes",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 9,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->rsc.st_average_packet_size, windows_shared_buffer, physical);
|
||||
|
||||
d->rsc.rd_average_packet_size = rrddim_add(d->rsc.st_average_packet_size, "average", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
d->rsc.rd_average_packet_size =
|
||||
rrddim_add(d->rsc.st_average_packet_size, "average", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(d->rsc.st_average_packet_size, d->rsc.rd_average_packet_size, (collected_number)d->rsc.average_packet_size.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->rsc.st_average_packet_size,
|
||||
d->rsc.rd_average_packet_size,
|
||||
(collected_number)d->rsc.average_packet_size.current.Data);
|
||||
rrdset_done(d->rsc.st_average_packet_size);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->chimney.connections)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->chimney.connections)) {
|
||||
if (unlikely(!d->chimney.st)) {
|
||||
d->chimney.st = rrdset_create_localhost(
|
||||
"net_chimney_connections",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.chimney_connections",
|
||||
"Active TCP Connections Offloaded with Chimney",
|
||||
"connections",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 10,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
"net_chimney_connections",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"net.chimney_connections",
|
||||
"Active TCP Connections Offloaded with Chimney",
|
||||
"connections",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibNetwork",
|
||||
NETDATA_CHART_PRIO_FIRST_NET_IFACE + 10,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
add_interface_labels(d->chimney.st, windows_shared_buffer, physical);
|
||||
|
||||
|
@ -963,7 +997,7 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
}
|
||||
}
|
||||
|
||||
if(physical) {
|
||||
if (physical) {
|
||||
static RRDSET *st = NULL;
|
||||
static RRDDIM *rd_received = NULL, *rd_sent = NULL;
|
||||
|
||||
|
@ -994,8 +1028,9 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
// cleanup
|
||||
{
|
||||
struct network_interface *d;
|
||||
dfe_start_write(dict, d) {
|
||||
if(d->last_collected < now_ut) {
|
||||
dfe_start_write(dict, d)
|
||||
{
|
||||
if (d->last_collected < now_ut) {
|
||||
network_interface_cleanup(d);
|
||||
dictionary_del(dict, d_dfe.name);
|
||||
}
|
||||
|
@ -1007,36 +1042,38 @@ static bool do_network_interface(PERF_DATA_BLOCK *pDataBlock, int update_every,
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibNetwork(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibNetwork(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("Network Interface");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
usec_t now_ut = now_monotonic_usec();
|
||||
do_network_interface(pDataBlock, update_every, true, now_ut);
|
||||
do_network_interface(pDataBlock, update_every, false, now_ut);
|
||||
|
||||
struct network_protocol *tcp4 = NULL, *tcp6 = NULL;
|
||||
for(size_t i = 0; networks[i].protocol ;i++) {
|
||||
for (size_t i = 0; networks[i].protocol; i++) {
|
||||
do_network_protocol(pDataBlock, update_every, &networks[i]);
|
||||
|
||||
if(!tcp4 && strcmp(networks[i].protocol, "TCPv4") == 0)
|
||||
if (!tcp4 && strcmp(networks[i].protocol, "TCPv4") == 0)
|
||||
tcp4 = &networks[i];
|
||||
if(!tcp6 && strcmp(networks[i].protocol, "TCPv6") == 0)
|
||||
if (!tcp6 && strcmp(networks[i].protocol, "TCPv6") == 0)
|
||||
tcp6 = &networks[i];
|
||||
}
|
||||
|
||||
if(tcp4 && tcp6) {
|
||||
if (tcp4 && tcp6) {
|
||||
tcp46.packets.received = tcp4->packets.received;
|
||||
tcp46.packets.sent = tcp4->packets.sent;
|
||||
tcp46.packets.received.current.Data += tcp6->packets.received.current.Data;
|
||||
|
|
|
@ -7,18 +7,20 @@
|
|||
#define _COMMON_PLUGIN_MODULE_NAME "PerflibObjects"
|
||||
#include "../common-contexts/common-contexts.h"
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static bool do_objects(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_objects(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Objects");
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
static COUNTER_DATA semaphores = { .key = "Semaphores" };
|
||||
static COUNTER_DATA semaphores = {.key = "Semaphores"};
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &semaphores)) {
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &semaphores)) {
|
||||
ULONGLONG sem = semaphores.current.Data;
|
||||
common_semaphore_ipc(sem, WINDOWS_MAX_KERNEL_OBJECT, _COMMON_PLUGIN_MODULE_NAME, update_every);
|
||||
}
|
||||
|
@ -26,20 +28,22 @@ static bool do_objects(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibObjects(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibObjects(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("Objects");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
do_objects(pDataBlock, update_every);
|
||||
|
||||
|
|
|
@ -7,50 +7,54 @@
|
|||
#define _COMMON_PLUGIN_MODULE_NAME "PerflibProcesses"
|
||||
#include "../common-contexts/common-contexts.h"
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static bool do_processes(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_processes(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "System");
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
static COUNTER_DATA processesRunning = { .key = "Processes" };
|
||||
static COUNTER_DATA contextSwitchPerSec = { .key = "Context Switches/sec" };
|
||||
static COUNTER_DATA threads = { .key = "Threads" };
|
||||
static COUNTER_DATA processesRunning = {.key = "Processes"};
|
||||
static COUNTER_DATA contextSwitchPerSec = {.key = "Context Switches/sec"};
|
||||
static COUNTER_DATA threads = {.key = "Threads"};
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &processesRunning)) {
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &processesRunning)) {
|
||||
ULONGLONG running = processesRunning.current.Data;
|
||||
common_system_processes(running, update_every);
|
||||
}
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &contextSwitchPerSec)) {
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &contextSwitchPerSec)) {
|
||||
ULONGLONG contexts = contextSwitchPerSec.current.Data;
|
||||
common_system_context_switch(contexts, update_every);
|
||||
}
|
||||
|
||||
if(perflibGetObjectCounter(pDataBlock, pObjectType, &threads)) {
|
||||
if (perflibGetObjectCounter(pDataBlock, pObjectType, &threads)) {
|
||||
ULONGLONG totalThreads = threads.current.Data;
|
||||
common_system_threads(totalThreads, update_every);
|
||||
common_system_threads(totalThreads, update_every);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibProcesses(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibProcesses(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("System");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
do_processes(pDataBlock, update_every);
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@ struct processor {
|
|||
RRDDIM *rd_dpc;
|
||||
RRDDIM *rd_idle;
|
||||
|
||||
// RRDSET *st2;
|
||||
// RRDDIM *rd2_busy;
|
||||
// RRDSET *st2;
|
||||
// RRDDIM *rd2_busy;
|
||||
|
||||
COUNTER_DATA percentProcessorTime;
|
||||
COUNTER_DATA percentUserTime;
|
||||
|
@ -30,9 +30,10 @@ struct processor {
|
|||
COUNTER_DATA interruptsPerSec;
|
||||
};
|
||||
|
||||
struct processor total = { 0 };
|
||||
struct processor total = {0};
|
||||
|
||||
void initialize_processor_keys(struct processor *p) {
|
||||
void initialize_processor_keys(struct processor *p)
|
||||
{
|
||||
p->percentProcessorTime.key = "% Processor Time";
|
||||
p->percentUserTime.key = "% User Time";
|
||||
p->percentPrivilegedTime.key = "% Privileged Time";
|
||||
|
@ -42,57 +43,61 @@ void initialize_processor_keys(struct processor *p) {
|
|||
p->interruptsPerSec.key = "Interrupts/sec";
|
||||
}
|
||||
|
||||
void dict_processor_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_processor_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct processor *p = value;
|
||||
initialize_processor_keys(p);
|
||||
}
|
||||
|
||||
static DICTIONARY *processors = NULL;
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
initialize_processor_keys(&total);
|
||||
|
||||
processors = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE |
|
||||
DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct processor));
|
||||
processors = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct processor));
|
||||
|
||||
dictionary_register_insert_callback(processors, dict_processor_insert_cb, NULL);
|
||||
}
|
||||
|
||||
static bool do_processors(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_processors(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Processor");
|
||||
if(!pObjectType) return false;
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
static const RRDVAR_ACQUIRED *cpus_var = NULL;
|
||||
int cores_found = 0;
|
||||
uint64_t totalIPC = 0;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for(LONG i = 0; i < pObjectType->NumInstances ; i++) {
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if(!pi) break;
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
if(!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
if (!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
strncpyz(windows_shared_buffer, "[unknown]", sizeof(windows_shared_buffer) - 1);
|
||||
|
||||
bool is_total = false;
|
||||
struct processor *p;
|
||||
int cpu = -1;
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0) {
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0) {
|
||||
p = &total;
|
||||
is_total = true;
|
||||
cpu = -1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
p = dictionary_set(processors, windows_shared_buffer, NULL, sizeof(*p));
|
||||
is_total = false;
|
||||
cpu = str2i(windows_shared_buffer);
|
||||
snprintfz(windows_shared_buffer, sizeof(windows_shared_buffer), "cpu%d", cpu);
|
||||
|
||||
if(cpu + 1 > cores_found)
|
||||
if (cpu + 1 > cores_found)
|
||||
cores_found = cpu + 1;
|
||||
}
|
||||
|
||||
if(!is_total && !p->collected_metadata) {
|
||||
if (!is_total && !p->collected_metadata) {
|
||||
// TODO collect processor metadata
|
||||
p->collected_metadata = true;
|
||||
}
|
||||
|
@ -106,29 +111,29 @@ static bool do_processors(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &p->interruptsPerSec);
|
||||
|
||||
if(!p->st) {
|
||||
if (!p->st) {
|
||||
p->st = rrdset_create_localhost(
|
||||
is_total ? "system" : "cpu"
|
||||
, is_total ? "cpu" : windows_shared_buffer, NULL
|
||||
, is_total ? "cpu" : "utilization"
|
||||
, is_total ? "system.cpu" : "cpu.cpu"
|
||||
, is_total ? "Total CPU Utilization" : "Core Utilization"
|
||||
, "percentage"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibProcessor"
|
||||
, is_total ? NETDATA_CHART_PRIO_SYSTEM_CPU : NETDATA_CHART_PRIO_CPU_PER_CORE
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
is_total ? "system" : "cpu",
|
||||
is_total ? "cpu" : windows_shared_buffer,
|
||||
NULL,
|
||||
is_total ? "cpu" : "utilization",
|
||||
is_total ? "system.cpu" : "cpu.cpu",
|
||||
is_total ? "Total CPU Utilization" : "Core Utilization",
|
||||
"percentage",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibProcessor",
|
||||
is_total ? NETDATA_CHART_PRIO_SYSTEM_CPU : NETDATA_CHART_PRIO_CPU_PER_CORE,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
p->rd_irq = rrddim_add(p->st, "interrupts", "irq", 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_user = rrddim_add(p->st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_system = rrddim_add(p->st, "privileged", "system", 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_dpc = rrddim_add(p->st, "dpc", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_idle = rrddim_add(p->st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_irq = rrddim_add(p->st, "interrupts", "irq", 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_user = rrddim_add(p->st, "user", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_system = rrddim_add(p->st, "privileged", "system", 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_dpc = rrddim_add(p->st, "dpc", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
p->rd_idle = rrddim_add(p->st, "idle", NULL, 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL);
|
||||
rrddim_hide(p->st, "idle");
|
||||
|
||||
if(!is_total)
|
||||
if (!is_total)
|
||||
rrdlabels_add(p->st->rrdlabels, "cpu", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
else
|
||||
cpus_var = rrdvar_host_variable_add_and_acquire(localhost, "active_processors");
|
||||
|
@ -149,34 +154,34 @@ static bool do_processors(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
rrddim_set_by_pointer(p->st, p->rd_idle, (collected_number)idle);
|
||||
rrdset_done(p->st);
|
||||
|
||||
// if(!p->st2) {
|
||||
// p->st2 = rrdset_create_localhost(
|
||||
// is_total ? "system" : "cpu2"
|
||||
// , is_total ? "cpu3" : buffer
|
||||
// , NULL
|
||||
// , is_total ? "utilization" : buffer
|
||||
// , is_total ? "system.cpu3" : "cpu2.cpu"
|
||||
// , is_total ? "Total CPU Utilization" : "Core Utilization"
|
||||
// , "percentage"
|
||||
// , PLUGIN_WINDOWS_NAME
|
||||
// , "PerflibProcessor"
|
||||
// , is_total ? NETDATA_CHART_PRIO_SYSTEM_CPU : NETDATA_CHART_PRIO_CPU_PER_CORE
|
||||
// , update_every
|
||||
// , RRDSET_TYPE_STACKED
|
||||
// );
|
||||
//
|
||||
// p->rd2_busy = perflib_rrddim_add(p->st2, "busy", NULL, 1, 1, &p->percentProcessorTime);
|
||||
// rrddim_hide(p->st2, "idle");
|
||||
//
|
||||
// if(!is_total)
|
||||
// rrdlabels_add(p->st->rrdlabels, "cpu", buffer, RRDLABEL_SRC_AUTO);
|
||||
// }
|
||||
//
|
||||
// perflib_rrddim_set_by_pointer(p->st2, p->rd2_busy, &p->percentProcessorTime);
|
||||
// rrdset_done(p->st2);
|
||||
// if(!p->st2) {
|
||||
// p->st2 = rrdset_create_localhost(
|
||||
// is_total ? "system" : "cpu2"
|
||||
// , is_total ? "cpu3" : buffer
|
||||
// , NULL
|
||||
// , is_total ? "utilization" : buffer
|
||||
// , is_total ? "system.cpu3" : "cpu2.cpu"
|
||||
// , is_total ? "Total CPU Utilization" : "Core Utilization"
|
||||
// , "percentage"
|
||||
// , PLUGIN_WINDOWS_NAME
|
||||
// , "PerflibProcessor"
|
||||
// , is_total ? NETDATA_CHART_PRIO_SYSTEM_CPU : NETDATA_CHART_PRIO_CPU_PER_CORE
|
||||
// , update_every
|
||||
// , RRDSET_TYPE_STACKED
|
||||
// );
|
||||
//
|
||||
// p->rd2_busy = perflib_rrddim_add(p->st2, "busy", NULL, 1, 1, &p->percentProcessorTime);
|
||||
// rrddim_hide(p->st2, "idle");
|
||||
//
|
||||
// if(!is_total)
|
||||
// rrdlabels_add(p->st->rrdlabels, "cpu", buffer, RRDLABEL_SRC_AUTO);
|
||||
// }
|
||||
//
|
||||
// perflib_rrddim_set_by_pointer(p->st2, p->rd2_busy, &p->percentProcessorTime);
|
||||
// rrdset_done(p->st2);
|
||||
}
|
||||
|
||||
if(cpus_var)
|
||||
if (cpus_var)
|
||||
rrdvar_host_variable_set(localhost, cpus_var, cores_found);
|
||||
|
||||
common_interrupts(totalIPC, update_every, NULL);
|
||||
|
@ -184,20 +189,22 @@ static bool do_processors(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibProcessor(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibProcessor(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("Processor");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
do_processors(pDataBlock, update_every);
|
||||
|
||||
|
|
|
@ -4,7 +4,14 @@
|
|||
|
||||
#define COLLECTED_NUMBER_PRECISION 10000
|
||||
|
||||
RRDDIM *perflib_rrddim_add(RRDSET *st, const char *id, const char *name, collected_number multiplier, collected_number divider, COUNTER_DATA *cd) {
|
||||
RRDDIM *perflib_rrddim_add(
|
||||
RRDSET *st,
|
||||
const char *id,
|
||||
const char *name,
|
||||
collected_number multiplier,
|
||||
collected_number divider,
|
||||
COUNTER_DATA *cd)
|
||||
{
|
||||
RRD_ALGORITHM algorithm = RRD_ALGORITHM_ABSOLUTE;
|
||||
|
||||
switch (cd->current.CounterType) {
|
||||
|
@ -22,7 +29,7 @@ RRDDIM *perflib_rrddim_add(RRDSET *st, const char *id, const char *name, collect
|
|||
case PERF_COUNTER_100NS_QUEUELEN_TYPE:
|
||||
case PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE:
|
||||
case PERF_COUNTER_LARGE_QUEUELEN_TYPE:
|
||||
case PERF_AVERAGE_BULK: // normally not displayed
|
||||
case PERF_AVERAGE_BULK: // normally not displayed
|
||||
// (N1 - N0) / (D1 - D0)
|
||||
algorithm = RRD_ALGORITHM_INCREMENTAL;
|
||||
break;
|
||||
|
@ -115,16 +122,17 @@ RRDDIM *perflib_rrddim_add(RRDSET *st, const char *id, const char *name, collect
|
|||
return rrddim_add(st, id, name, multiplier, divider, algorithm);
|
||||
}
|
||||
|
||||
#define VALID_DELTA(cd) \
|
||||
#define VALID_DELTA(cd) \
|
||||
((cd)->previous.Time > 0 && (cd)->current.Data >= (cd)->previous.Data && (cd)->current.Time > (cd)->previous.Time)
|
||||
|
||||
collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_DATA *cd) {
|
||||
collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_DATA *cd)
|
||||
{
|
||||
ULONGLONG numerator = 0;
|
||||
LONGLONG denominator = 0;
|
||||
double doubleValue = 0.0;
|
||||
collected_number value;
|
||||
|
||||
switch(cd->current.CounterType) {
|
||||
switch (cd->current.CounterType) {
|
||||
case PERF_COUNTER_COUNTER:
|
||||
case PERF_SAMPLE_COUNTER:
|
||||
case PERF_COUNTER_BULK_COUNT:
|
||||
|
@ -136,7 +144,7 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
case PERF_COUNTER_100NS_QUEUELEN_TYPE:
|
||||
case PERF_COUNTER_OBJ_TIME_QUEUELEN_TYPE:
|
||||
case PERF_COUNTER_LARGE_QUEUELEN_TYPE:
|
||||
case PERF_AVERAGE_BULK: // normally not displayed
|
||||
case PERF_AVERAGE_BULK: // normally not displayed
|
||||
// (N1 - N0) / (D1 - D0)
|
||||
value = (collected_number)cd->current.Data;
|
||||
break;
|
||||
|
@ -155,7 +163,8 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
case PERF_COUNTER_TIMER_INV:
|
||||
case PERF_100NSEC_TIMER_INV:
|
||||
// 100 * (1 - ((N1 - N0) / (D1 - D0)))
|
||||
if(!VALID_DELTA(cd)) return 0;
|
||||
if (!VALID_DELTA(cd))
|
||||
return 0;
|
||||
numerator = cd->current.Data - cd->previous.Data;
|
||||
denominator = cd->current.Time - cd->previous.Time;
|
||||
doubleValue = 100.0 * (1.0 - ((double)numerator / (double)denominator));
|
||||
|
@ -165,7 +174,8 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
|
||||
case PERF_COUNTER_MULTI_TIMER:
|
||||
// 100 * ((N1 - N0) / ((D1 - D0) / TB)) / B1
|
||||
if(!VALID_DELTA(cd)) return 0;
|
||||
if (!VALID_DELTA(cd))
|
||||
return 0;
|
||||
numerator = cd->current.Data - cd->previous.Data;
|
||||
denominator = cd->current.Time - cd->previous.Time;
|
||||
denominator /= cd->current.Frequency;
|
||||
|
@ -176,7 +186,8 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
|
||||
case PERF_100NSEC_MULTI_TIMER:
|
||||
// 100 * ((N1 - N0) / (D1 - D0)) / B1
|
||||
if(!VALID_DELTA(cd)) return 0;
|
||||
if (!VALID_DELTA(cd))
|
||||
return 0;
|
||||
numerator = cd->current.Data - cd->previous.Data;
|
||||
denominator = cd->current.Time - cd->previous.Time;
|
||||
doubleValue = 100.0 * ((double)numerator / (double)denominator) / (double)cd->current.MultiCounterData;
|
||||
|
@ -187,7 +198,8 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
case PERF_COUNTER_MULTI_TIMER_INV:
|
||||
case PERF_100NSEC_MULTI_TIMER_INV:
|
||||
// 100 * (B1 - ((N1 - N0) / (D1 - D0)))
|
||||
if(!VALID_DELTA(cd)) return 0;
|
||||
if (!VALID_DELTA(cd))
|
||||
return 0;
|
||||
numerator = cd->current.Data - cd->previous.Data;
|
||||
denominator = cd->current.Time - cd->previous.Time;
|
||||
doubleValue = 100.0 * ((double)cd->current.MultiCounterData - ((double)numerator / (double)denominator));
|
||||
|
@ -209,14 +221,16 @@ collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_D
|
|||
|
||||
case PERF_COUNTER_DELTA:
|
||||
case PERF_COUNTER_LARGE_DELTA:
|
||||
if(!VALID_DELTA(cd)) return 0;
|
||||
if (!VALID_DELTA(cd))
|
||||
return 0;
|
||||
value = (collected_number)(cd->current.Data - cd->previous.Data);
|
||||
break;
|
||||
|
||||
case PERF_RAW_FRACTION:
|
||||
case PERF_LARGE_RAW_FRACTION:
|
||||
// 100 * N / B
|
||||
if(!cd->current.Time) return 0;
|
||||
if (!cd->current.Time)
|
||||
return 0;
|
||||
doubleValue = 100.0 * (double)cd->current.Data / (double)cd->current.Time;
|
||||
// printf("Display value is (fraction): %f%%\n", doubleValue);
|
||||
value = (collected_number)(doubleValue * COLLECTED_NUMBER_PRECISION);
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
|
||||
#include "database/rrd.h"
|
||||
|
||||
RRDDIM *perflib_rrddim_add(RRDSET *st, const char *id, const char *name, collected_number multiplier, collected_number divider, COUNTER_DATA *cd);
|
||||
RRDDIM *perflib_rrddim_add(
|
||||
RRDSET *st,
|
||||
const char *id,
|
||||
const char *name,
|
||||
collected_number multiplier,
|
||||
collected_number divider,
|
||||
COUNTER_DATA *cd);
|
||||
collected_number perflib_rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, COUNTER_DATA *cd);
|
||||
|
||||
#endif //NETDATA_PERFLIB_RRD_H
|
||||
|
|
|
@ -85,18 +85,22 @@ struct physical_disk system_physical_total = {
|
|||
.collected_metadata = true,
|
||||
};
|
||||
|
||||
static void dict_logical_disk_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
static void
|
||||
dict_logical_disk_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct logical_disk *d = value;
|
||||
|
||||
d->percentDiskFree.key = "% Free Space";
|
||||
// d->freeMegabytes.key = "Free Megabytes";
|
||||
}
|
||||
|
||||
static void logical_disk_cleanup(struct logical_disk *d) {
|
||||
static void logical_disk_cleanup(struct logical_disk *d)
|
||||
{
|
||||
rrdset_is_obsolete___safe_from_collector_thread(d->st_disk_space);
|
||||
}
|
||||
|
||||
static void physical_disk_initialize(struct physical_disk *d) {
|
||||
static void physical_disk_initialize(struct physical_disk *d)
|
||||
{
|
||||
d->percentIdleTime.key = "% Idle Time";
|
||||
d->percentDiskTime.key = "% Disk Time";
|
||||
d->percentDiskReadTime.key = "% Disk Read Time";
|
||||
|
@ -120,7 +124,8 @@ static void physical_disk_initialize(struct physical_disk *d) {
|
|||
d->splitIoPerSec.key = "Split IO/Sec";
|
||||
}
|
||||
|
||||
static void physical_disk_cleanup(struct physical_disk *d) {
|
||||
static void physical_disk_cleanup(struct physical_disk *d)
|
||||
{
|
||||
string_freez(d->device);
|
||||
string_freez(d->mount_point);
|
||||
string_freez(d->manufacturer);
|
||||
|
@ -141,31 +146,35 @@ static void physical_disk_cleanup(struct physical_disk *d) {
|
|||
rrdset_is_obsolete___safe_from_collector_thread(d->st_split);
|
||||
}
|
||||
|
||||
void dict_physical_disk_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_physical_disk_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct physical_disk *pd = value;
|
||||
physical_disk_initialize(pd);
|
||||
}
|
||||
|
||||
static DICTIONARY *logicalDisks = NULL, *physicalDisks = NULL;
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
physical_disk_initialize(&system_physical_total);
|
||||
|
||||
logicalDisks = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE |
|
||||
DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct logical_disk));
|
||||
logicalDisks = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct logical_disk));
|
||||
|
||||
dictionary_register_insert_callback(logicalDisks, dict_logical_disk_insert_cb, NULL);
|
||||
|
||||
physicalDisks = dictionary_create_advanced(DICT_OPTION_DONT_OVERWRITE_VALUE |
|
||||
DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct physical_disk));
|
||||
physicalDisks = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct physical_disk));
|
||||
|
||||
dictionary_register_insert_callback(physicalDisks, dict_physical_disk_insert_cb, NULL);
|
||||
}
|
||||
|
||||
static STRING *getFileSystemType(struct logical_disk *d, const char* diskName) {
|
||||
if (!diskName || !*diskName) return NULL;
|
||||
static STRING *getFileSystemType(struct logical_disk *d, const char *diskName)
|
||||
{
|
||||
if (!diskName || !*diskName)
|
||||
return NULL;
|
||||
|
||||
char fileSystemNameBuffer[128] = {0}; // Buffer for file system name
|
||||
char pathBuffer[256] = {0}; // Path buffer to accommodate different formats
|
||||
char fileSystemNameBuffer[128] = {0}; // Buffer for file system name
|
||||
char pathBuffer[256] = {0}; // Path buffer to accommodate different formats
|
||||
DWORD serialNumber = 0;
|
||||
DWORD maxComponentLength = 0;
|
||||
DWORD fileSystemFlags = 0;
|
||||
|
@ -173,75 +182,86 @@ static STRING *getFileSystemType(struct logical_disk *d, const char* diskName) {
|
|||
|
||||
// Check if the input is likely a drive letter (e.g., "C:")
|
||||
if (isalpha((uint8_t)diskName[0]) && diskName[1] == ':' && diskName[2] == '\0')
|
||||
snprintf(pathBuffer, sizeof(pathBuffer), "%s\\", diskName); // Format as "C:\"
|
||||
snprintf(pathBuffer, sizeof(pathBuffer), "%s\\", diskName); // Format as "C:\"
|
||||
else
|
||||
// Assume it's a Volume GUID path or a device path
|
||||
snprintf(pathBuffer, sizeof(pathBuffer), "\\\\.\\%s\\", diskName); // Format as "\\.\HarddiskVolume1\"
|
||||
snprintf(pathBuffer, sizeof(pathBuffer), "\\\\.\\%s\\", diskName); // Format as "\\.\HarddiskVolume1\"
|
||||
|
||||
d->DriveType = GetDriveTypeA(pathBuffer);
|
||||
|
||||
// Attempt to get the volume information
|
||||
success = GetVolumeInformationA(
|
||||
pathBuffer, // Path to the disk
|
||||
NULL, // We don't need the volume name
|
||||
0, // Size of volume name buffer is 0
|
||||
&serialNumber, // Volume serial number
|
||||
&maxComponentLength, // Maximum component length
|
||||
&fileSystemFlags, // File system flags
|
||||
fileSystemNameBuffer, // File system name buffer
|
||||
pathBuffer, // Path to the disk
|
||||
NULL, // We don't need the volume name
|
||||
0, // Size of volume name buffer is 0
|
||||
&serialNumber, // Volume serial number
|
||||
&maxComponentLength, // Maximum component length
|
||||
&fileSystemFlags, // File system flags
|
||||
fileSystemNameBuffer, // File system name buffer
|
||||
sizeof(fileSystemNameBuffer) // Size of file system name buffer
|
||||
);
|
||||
|
||||
if(success) {
|
||||
if (success) {
|
||||
d->readonly = fileSystemFlags & FILE_READ_ONLY_VOLUME;
|
||||
d->SerialNumber = serialNumber;
|
||||
|
||||
if (fileSystemNameBuffer[0]) {
|
||||
char *s = fileSystemNameBuffer;
|
||||
while (*s) {
|
||||
*s = tolower((uint8_t) *s);
|
||||
*s = tolower((uint8_t)*s);
|
||||
s++;
|
||||
}
|
||||
return string_strdupz(fileSystemNameBuffer); // Duplicate the file system name
|
||||
return string_strdupz(fileSystemNameBuffer); // Duplicate the file system name
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *drive_type_to_str(UINT type) {
|
||||
switch(type) {
|
||||
static const char *drive_type_to_str(UINT type)
|
||||
{
|
||||
switch (type) {
|
||||
default:
|
||||
case 0: return "unknown";
|
||||
case 1: return "norootdir";
|
||||
case 2: return "removable";
|
||||
case 3: return "fixed";
|
||||
case 4: return "remote";
|
||||
case 5: return "cdrom";
|
||||
case 6: return "ramdisk";
|
||||
case 0:
|
||||
return "unknown";
|
||||
case 1:
|
||||
return "norootdir";
|
||||
case 2:
|
||||
return "removable";
|
||||
case 3:
|
||||
return "fixed";
|
||||
case 4:
|
||||
return "remote";
|
||||
case 5:
|
||||
return "cdrom";
|
||||
case 6:
|
||||
return "ramdisk";
|
||||
}
|
||||
}
|
||||
|
||||
static bool do_logical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_t now_ut) {
|
||||
static bool do_logical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_t now_ut)
|
||||
{
|
||||
DICTIONARY *dict = logicalDisks;
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "LogicalDisk");
|
||||
if(!pObjectType) return false;
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for(LONG i = 0; i < pObjectType->NumInstances ; i++) {
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
pi = perflibForEachInstance(pDataBlock, pObjectType, pi);
|
||||
if(!pi) break;
|
||||
if (!pi)
|
||||
break;
|
||||
|
||||
if(!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
if (!getInstanceName(pDataBlock, pObjectType, pi, windows_shared_buffer, sizeof(windows_shared_buffer)))
|
||||
strncpyz(windows_shared_buffer, "[unknown]", sizeof(windows_shared_buffer) - 1);
|
||||
|
||||
if(strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0)
|
||||
continue;
|
||||
|
||||
struct logical_disk *d = dictionary_set(dict, windows_shared_buffer, NULL, sizeof(*d));
|
||||
d->last_collected = now_ut;
|
||||
|
||||
if(!d->collected_metadata) {
|
||||
if (!d->collected_metadata) {
|
||||
d->filesystem = getFileSystemType(d, windows_shared_buffer);
|
||||
d->collected_metadata = true;
|
||||
}
|
||||
|
@ -249,25 +269,29 @@ static bool do_logical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_
|
|||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->percentDiskFree);
|
||||
// perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->freeMegabytes);
|
||||
|
||||
if(!d->st_disk_space) {
|
||||
if (!d->st_disk_space) {
|
||||
d->st_disk_space = rrdset_create_localhost(
|
||||
"disk_space"
|
||||
, windows_shared_buffer
|
||||
, NULL
|
||||
, windows_shared_buffer
|
||||
, "disk.space"
|
||||
, "Disk Space Usage"
|
||||
, "GiB"
|
||||
, PLUGIN_WINDOWS_NAME
|
||||
, "PerflibStorage"
|
||||
, NETDATA_CHART_PRIO_DISKSPACE_SPACE
|
||||
, update_every
|
||||
, RRDSET_TYPE_STACKED
|
||||
);
|
||||
"disk_space",
|
||||
windows_shared_buffer,
|
||||
NULL,
|
||||
windows_shared_buffer,
|
||||
"disk.space",
|
||||
"Disk Space Usage",
|
||||
"GiB",
|
||||
PLUGIN_WINDOWS_NAME,
|
||||
"PerflibStorage",
|
||||
NETDATA_CHART_PRIO_DISKSPACE_SPACE,
|
||||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
rrdlabels_add(d->st_disk_space->rrdlabels, "mount_point", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(d->st_disk_space->rrdlabels, "drive_type", drive_type_to_str(d->DriveType), RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(d->st_disk_space->rrdlabels, "filesystem", d->filesystem ? string2str(d->filesystem) : "unknown", RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
d->st_disk_space->rrdlabels, "drive_type", drive_type_to_str(d->DriveType), RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
d->st_disk_space->rrdlabels,
|
||||
"filesystem",
|
||||
d->filesystem ? string2str(d->filesystem) : "unknown",
|
||||
RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(d->st_disk_space->rrdlabels, "rw_mode", d->readonly ? "ro" : "rw", RRDLABEL_SRC_AUTO);
|
||||
|
||||
{
|
||||
|
@ -281,16 +305,21 @@ static bool do_logical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_
|
|||
}
|
||||
|
||||
// percentDiskFree has the free space in Data and the size of the disk in Time, in MiB.
|
||||
rrddim_set_by_pointer(d->st_disk_space, d->rd_disk_space_free, (collected_number)d->percentDiskFree.current.Data);
|
||||
rrddim_set_by_pointer(d->st_disk_space, d->rd_disk_space_used, (collected_number)(d->percentDiskFree.current.Time - d->percentDiskFree.current.Data));
|
||||
rrddim_set_by_pointer(
|
||||
d->st_disk_space, d->rd_disk_space_free, (collected_number)d->percentDiskFree.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
d->st_disk_space,
|
||||
d->rd_disk_space_used,
|
||||
(collected_number)(d->percentDiskFree.current.Time - d->percentDiskFree.current.Data));
|
||||
rrdset_done(d->st_disk_space);
|
||||
}
|
||||
|
||||
// cleanup
|
||||
{
|
||||
struct logical_disk *d;
|
||||
dfe_start_write(dict, d) {
|
||||
if(d->last_collected < now_ut) {
|
||||
dfe_start_write(dict, d)
|
||||
{
|
||||
if (d->last_collected < now_ut) {
|
||||
logical_disk_cleanup(d);
|
||||
dictionary_del(dict, d_dfe.name);
|
||||
}
|
||||
|
@ -302,38 +331,44 @@ static bool do_logical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_
|
|||
return true;
|
||||
}
|
||||
|
||||
static void physical_disk_labels(RRDSET *st, void *data) {
|
||||
static void physical_disk_labels(RRDSET *st, void *data)
|
||||
{
|
||||
struct physical_disk *d = data;
|
||||
|
||||
if(d->device)
|
||||
if (d->device)
|
||||
rrdlabels_add(st->rrdlabels, "device", string2str(d->device), RRDLABEL_SRC_AUTO);
|
||||
|
||||
if (d->mount_point)
|
||||
rrdlabels_add(st->rrdlabels, "mount_point", string2str(d->mount_point), RRDLABEL_SRC_AUTO);
|
||||
|
||||
// if (d->manufacturer)
|
||||
// rrdlabels_add(st->rrdlabels, "manufacturer", string2str(d->manufacturer), RRDLABEL_SRC_AUTO);
|
||||
// if (d->manufacturer)
|
||||
// rrdlabels_add(st->rrdlabels, "manufacturer", string2str(d->manufacturer), RRDLABEL_SRC_AUTO);
|
||||
|
||||
if (d->model)
|
||||
rrdlabels_add(st->rrdlabels, "model", string2str(d->model), RRDLABEL_SRC_AUTO);
|
||||
|
||||
// if (d->media_type)
|
||||
// rrdlabels_add(st->rrdlabels, "media_type", string2str(d->media_type), RRDLABEL_SRC_AUTO);
|
||||
// if (d->media_type)
|
||||
// rrdlabels_add(st->rrdlabels, "media_type", string2str(d->media_type), RRDLABEL_SRC_AUTO);
|
||||
|
||||
// if (d->name)
|
||||
// rrdlabels_add(st->rrdlabels, "name", string2str(d->name), RRDLABEL_SRC_AUTO);
|
||||
// if (d->name)
|
||||
// rrdlabels_add(st->rrdlabels, "name", string2str(d->name), RRDLABEL_SRC_AUTO);
|
||||
|
||||
if (d->device_id)
|
||||
rrdlabels_add(st->rrdlabels, "device_id", string2str(d->device_id), RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
static bool str_is_numeric(const char *s) {
|
||||
while(*s) if(!isdigit((uint8_t)*s++)) return false;
|
||||
static bool str_is_numeric(const char *s)
|
||||
{
|
||||
while (*s)
|
||||
if (!isdigit((uint8_t)*s++))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline double perflib_average_timer_ms(COUNTER_DATA *d) {
|
||||
if(!d->updated) return 0.0;
|
||||
static inline double perflib_average_timer_ms(COUNTER_DATA *d)
|
||||
{
|
||||
if (!d->updated)
|
||||
return 0.0;
|
||||
|
||||
ULONGLONG data1 = d->current.Data;
|
||||
ULONGLONG data0 = d->previous.Data;
|
||||
|
@ -341,35 +376,39 @@ static inline double perflib_average_timer_ms(COUNTER_DATA *d) {
|
|||
LONGLONG time0 = d->previous.Time;
|
||||
LONGLONG freq1 = d->current.Frequency;
|
||||
|
||||
if(data1 >= data0 && time1 > time0 && time0 && freq1)
|
||||
if (data1 >= data0 && time1 > time0 && time0 && freq1)
|
||||
return ((double)(data1 - data0) / (double)(freq1 / MSEC_PER_SEC)) / (double)(time1 - time0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline uint64_t perflib_average_bulk(COUNTER_DATA *d) {
|
||||
if(!d->updated) return 0;
|
||||
static inline uint64_t perflib_average_bulk(COUNTER_DATA *d)
|
||||
{
|
||||
if (!d->updated)
|
||||
return 0;
|
||||
|
||||
ULONGLONG data1 = d->current.Data;
|
||||
ULONGLONG data0 = d->previous.Data;
|
||||
LONGLONG time1 = d->current.Time;
|
||||
LONGLONG time0 = d->previous.Time;
|
||||
|
||||
if(data1 >= data0 && time1 > time0 && time0)
|
||||
if (data1 >= data0 && time1 > time0 && time0)
|
||||
return (data1 - data0) / (time1 - time0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline uint64_t perflib_idle_time_percent(COUNTER_DATA *d) {
|
||||
if(!d->updated) return 0.0;
|
||||
static inline uint64_t perflib_idle_time_percent(COUNTER_DATA *d)
|
||||
{
|
||||
if (!d->updated)
|
||||
return 0.0;
|
||||
|
||||
ULONGLONG data1 = d->current.Data;
|
||||
ULONGLONG data0 = d->previous.Data;
|
||||
LONGLONG time1 = d->current.Time;
|
||||
LONGLONG time0 = d->previous.Time;
|
||||
|
||||
if(data1 >= data0 && time1 > time0 && time0) {
|
||||
if (data1 >= data0 && time1 > time0 && time0) {
|
||||
uint64_t pcent = 100 * (data1 - data0) / (time1 - time0);
|
||||
return pcent > 100 ? 100 : pcent;
|
||||
}
|
||||
|
@ -380,11 +419,13 @@ static inline uint64_t perflib_idle_time_percent(COUNTER_DATA *d) {
|
|||
#define MAX_WMI_DRIVES 100
|
||||
static DiskDriveInfoWMI infos[MAX_WMI_DRIVES];
|
||||
|
||||
static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_t now_ut) {
|
||||
static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec_t now_ut)
|
||||
{
|
||||
DICTIONARY *dict = physicalDisks;
|
||||
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "PhysicalDisk");
|
||||
if(!pObjectType) return false;
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
||||
PERF_INSTANCE_DEFINITION *pi = NULL;
|
||||
for (LONG i = 0; i < pObjectType->NumInstances; i++) {
|
||||
|
@ -397,22 +438,22 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
|
||||
int device_index = -1;
|
||||
char *device = windows_shared_buffer;
|
||||
char mount_point[128]; mount_point[0] = '\0';
|
||||
char mount_point[128];
|
||||
mount_point[0] = '\0';
|
||||
|
||||
struct physical_disk *d;
|
||||
bool is_system;
|
||||
if (strcasecmp(windows_shared_buffer, "_Total") == 0) {
|
||||
d = &system_physical_total;
|
||||
is_system = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
char *space;
|
||||
if((space = strchr(windows_shared_buffer, ' '))) {
|
||||
if ((space = strchr(windows_shared_buffer, ' '))) {
|
||||
*space++ = '\0';
|
||||
strncpyz(mount_point, space, sizeof(mount_point) - 1);
|
||||
}
|
||||
|
||||
if(str_is_numeric(windows_shared_buffer)) {
|
||||
if (str_is_numeric(windows_shared_buffer)) {
|
||||
device_index = str2ull(device, NULL);
|
||||
snprintfz(windows_shared_buffer, sizeof(windows_shared_buffer), "Disk %d", device_index);
|
||||
device = windows_shared_buffer;
|
||||
|
@ -424,10 +465,10 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
d->last_collected = now_ut;
|
||||
|
||||
if (!d->collected_metadata) {
|
||||
if(!is_system && device_index != -1) {
|
||||
if (!is_system && device_index != -1) {
|
||||
size_t infoCount = GetDiskDriveInfo(infos, _countof(infos));
|
||||
for(size_t k = 0; k < infoCount ; k++) {
|
||||
if(infos[k].Index != device_index)
|
||||
for (size_t k = 0; k < infoCount; k++) {
|
||||
if (infos[k].Index != device_index)
|
||||
continue;
|
||||
|
||||
d->manufacturer = string_strdupz(infos[k].Manufacturer);
|
||||
|
@ -447,11 +488,9 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->diskReadBytesPerSec) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->diskWriteBytesPerSec)) {
|
||||
if(is_system)
|
||||
if (is_system)
|
||||
common_system_io(
|
||||
d->diskReadBytesPerSec.current.Data,
|
||||
d->diskWriteBytesPerSec.current.Data,
|
||||
update_every);
|
||||
d->diskReadBytesPerSec.current.Data, d->diskWriteBytesPerSec.current.Data, update_every);
|
||||
else
|
||||
common_disk_io(
|
||||
&d->disk_io,
|
||||
|
@ -464,124 +503,120 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
d);
|
||||
}
|
||||
|
||||
if(is_system) continue;
|
||||
if (is_system)
|
||||
continue;
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->diskReadsPerSec) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->diskWritesPerSec)) {
|
||||
|
||||
common_disk_ops(
|
||||
&d->disk_ops,
|
||||
device,
|
||||
NULL,
|
||||
d->diskReadsPerSec.current.Data,
|
||||
d->diskWritesPerSec.current.Data,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_ops,
|
||||
device,
|
||||
NULL,
|
||||
d->diskReadsPerSec.current.Data,
|
||||
d->diskWritesPerSec.current.Data,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->percentIdleTime)) {
|
||||
common_disk_util(
|
||||
&d->disk_util,
|
||||
device,
|
||||
NULL,
|
||||
100 - perflib_idle_time_percent(&d->percentIdleTime),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_util,
|
||||
device,
|
||||
NULL,
|
||||
100 - perflib_idle_time_percent(&d->percentIdleTime),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->percentDiskTime)) {
|
||||
common_disk_busy(
|
||||
&d->disk_busy,
|
||||
device,
|
||||
NULL,
|
||||
d->percentDiskTime.current.Data / NS100_PER_MS,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_busy,
|
||||
device,
|
||||
NULL,
|
||||
d->percentDiskTime.current.Data / NS100_PER_MS,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->percentDiskReadTime) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->percentDiskWriteTime)) {
|
||||
|
||||
common_disk_iotime(
|
||||
&d->disk_iotime,
|
||||
device,
|
||||
NULL,
|
||||
d->percentDiskReadTime.current.Data / NS100_PER_MS,
|
||||
d->percentDiskWriteTime.current.Data / NS100_PER_MS,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_iotime,
|
||||
device,
|
||||
NULL,
|
||||
d->percentDiskReadTime.current.Data / NS100_PER_MS,
|
||||
d->percentDiskWriteTime.current.Data / NS100_PER_MS,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->currentDiskQueueLength)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->currentDiskQueueLength)) {
|
||||
common_disk_qops(
|
||||
&d->disk_qops,
|
||||
device,
|
||||
NULL,
|
||||
d->currentDiskQueueLength.current.Data,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_qops,
|
||||
device,
|
||||
NULL,
|
||||
d->currentDiskQueueLength.current.Data,
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->averageDiskSecondsPerRead) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->averageDiskSecondsPerWrite)) {
|
||||
|
||||
common_disk_await(
|
||||
&d->disk_await,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerRead),
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerWrite),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_await,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerRead),
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerWrite),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->averageDiskSecondsPerTransfer)) {
|
||||
common_disk_svctm(
|
||||
&d->disk_svctm,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerTransfer),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_svctm,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_timer_ms(&d->averageDiskSecondsPerTransfer),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->averageDiskBytesPerRead) &&
|
||||
perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->averageDiskBytesPerWrite)) {
|
||||
|
||||
common_disk_avgsz(
|
||||
&d->disk_avgsz,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_bulk(&d->averageDiskBytesPerRead),
|
||||
perflib_average_bulk(&d->averageDiskBytesPerWrite),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
&d->disk_avgsz,
|
||||
device,
|
||||
NULL,
|
||||
perflib_average_bulk(&d->averageDiskBytesPerRead),
|
||||
perflib_average_bulk(&d->averageDiskBytesPerWrite),
|
||||
update_every,
|
||||
physical_disk_labels,
|
||||
d);
|
||||
}
|
||||
|
||||
if(perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->splitIoPerSec)) {
|
||||
if (perflibGetInstanceCounter(pDataBlock, pObjectType, pi, &d->splitIoPerSec)) {
|
||||
if (!d->st_split) {
|
||||
d->st_split = rrdset_create_localhost(
|
||||
"disk_split",
|
||||
device,
|
||||
NULL,
|
||||
"iops",
|
||||
"disk.split",
|
||||
"Split I/O Operations",
|
||||
"operations/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_DISK_SPLIT,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE
|
||||
);
|
||||
"disk_split",
|
||||
device,
|
||||
NULL,
|
||||
"iops",
|
||||
"disk.split",
|
||||
"Split I/O Operations",
|
||||
"operations/s",
|
||||
_COMMON_PLUGIN_NAME,
|
||||
_COMMON_PLUGIN_MODULE_NAME,
|
||||
NETDATA_CHART_PRIO_DISK_SPLIT,
|
||||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
d->rd_split = rrddim_add(d->st_split, "discards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
|
@ -596,8 +631,9 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
// cleanup
|
||||
{
|
||||
struct physical_disk *d;
|
||||
dfe_start_write(dict, d) {
|
||||
if(d->last_collected < now_ut) {
|
||||
dfe_start_write(dict, d)
|
||||
{
|
||||
if (d->last_collected < now_ut) {
|
||||
physical_disk_cleanup(d);
|
||||
dictionary_del(dict, d_dfe.name);
|
||||
}
|
||||
|
@ -609,20 +645,22 @@ static bool do_physical_disk(PERF_DATA_BLOCK *pDataBlock, int update_every, usec
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibStorage(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibStorage(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if(unlikely(!initialized)) {
|
||||
if (unlikely(!initialized)) {
|
||||
initialize();
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
DWORD id = RegistryFindIDByName("LogicalDisk");
|
||||
if(id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
if (id == PERFLIB_REGISTRY_NAME_NOT_FOUND)
|
||||
return -1;
|
||||
|
||||
PERF_DATA_BLOCK *pDataBlock = perflibGetPerformanceData(id);
|
||||
if(!pDataBlock) return -1;
|
||||
if (!pDataBlock)
|
||||
return -1;
|
||||
|
||||
usec_t now_ut = now_monotonic_usec();
|
||||
do_logical_disk(pDataBlock, update_every, now_ut);
|
||||
|
|
|
@ -10,25 +10,29 @@ struct thermal_zone {
|
|||
COUNTER_DATA thermalZoneTemperature;
|
||||
};
|
||||
|
||||
static inline void initialize_thermal_zone_keys(struct thermal_zone *p) {
|
||||
static inline void initialize_thermal_zone_keys(struct thermal_zone *p)
|
||||
{
|
||||
p->thermalZoneTemperature.key = "Temperature";
|
||||
}
|
||||
|
||||
void dict_thermal_zone_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_thermal_zone_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct thermal_zone *p = value;
|
||||
initialize_thermal_zone_keys(p);
|
||||
}
|
||||
|
||||
static DICTIONARY *thermal_zones = NULL;
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
thermal_zones = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct thermal_zone));
|
||||
|
||||
dictionary_register_insert_callback(thermal_zones, dict_thermal_zone_insert_cb, NULL);
|
||||
}
|
||||
|
||||
static bool do_thermal_zones(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_thermal_zones(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Thermal Zone Information");
|
||||
if (!pObjectType)
|
||||
return false;
|
||||
|
@ -81,7 +85,8 @@ static bool do_thermal_zones(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibThermalZone(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibThermalZone(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if (unlikely(!initialized)) {
|
||||
|
|
|
@ -93,7 +93,8 @@ struct web_service {
|
|||
COUNTER_DATA IISRequestsOther;
|
||||
};
|
||||
|
||||
static inline void initialize_web_service_keys(struct web_service *p) {
|
||||
static inline void initialize_web_service_keys(struct web_service *p)
|
||||
{
|
||||
p->IISCurrentAnonymousUser.key = "Current Anonymous Users";
|
||||
p->IISCurrentNonAnonymousUsers.key = "Current NonAnonymous Users";
|
||||
p->IISCurrentConnections.key = "Current Connections";
|
||||
|
@ -128,21 +129,24 @@ static inline void initialize_web_service_keys(struct web_service *p) {
|
|||
p->IISRequestsOther.key = "Other Request Methods/sec";
|
||||
}
|
||||
|
||||
void dict_web_service_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused) {
|
||||
void dict_web_service_insert_cb(const DICTIONARY_ITEM *item __maybe_unused, void *value, void *data __maybe_unused)
|
||||
{
|
||||
struct web_service *p = value;
|
||||
initialize_web_service_keys(p);
|
||||
}
|
||||
|
||||
static DICTIONARY *web_services = NULL;
|
||||
|
||||
static void initialize(void) {
|
||||
static void initialize(void)
|
||||
{
|
||||
web_services = dictionary_create_advanced(
|
||||
DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct web_service));
|
||||
|
||||
dictionary_register_insert_callback(web_services, dict_web_service_insert_cb, NULL);
|
||||
}
|
||||
|
||||
static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
||||
static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every)
|
||||
{
|
||||
char id[RRD_ID_LENGTH_MAX + 1];
|
||||
PERF_OBJECT_TYPE *pObjectType = perflibFindObjectTypeByName(pDataBlock, "Web Service");
|
||||
if (!pObjectType)
|
||||
|
@ -215,7 +219,8 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_files_received = rrddim_add(p->st_file_transfer, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_files_received =
|
||||
rrddim_add(p->st_file_transfer, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_files_sent = rrddim_add(p->st_file_transfer, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
rrdlabels_add(p->st_file_transfer->rrdlabels, "website", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
@ -246,7 +251,8 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
p->rd_curr_connections = rrddim_add(p->st_curr_connections, "active", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
p->rd_curr_connections =
|
||||
rrddim_add(p->st_curr_connections, "active", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
rrdlabels_add(p->st_curr_connections->rrdlabels, "website", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
|
@ -555,24 +561,41 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
update_every,
|
||||
RRDSET_TYPE_STACKED);
|
||||
|
||||
p->rd_request_options_rate = rrddim_add(p->st_request_by_type_rate, "options", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_get_rate = rrddim_add(p->st_request_by_type_rate, "get", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_post_rate = rrddim_add(p->st_request_by_type_rate, "post", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_head_rate = rrddim_add(p->st_request_by_type_rate, "head", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_put_rate = rrddim_add(p->st_request_by_type_rate, "put", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_delete_rate = rrddim_add(p->st_request_by_type_rate, "delete", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_trace_rate = rrddim_add(p->st_request_by_type_rate, "trace", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_move_rate = rrddim_add(p->st_request_by_type_rate, "move", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_copy_rate = rrddim_add(p->st_request_by_type_rate, "copy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_mkcol_rate = rrddim_add(p->st_request_by_type_rate, "mkcol", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_propfind_rate = rrddim_add(p->st_request_by_type_rate, "propfind", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_proppatch_rate = rrddim_add(p->st_request_by_type_rate, "proppatch", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_search_rate = rrddim_add(p->st_request_by_type_rate, "search", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_lock_rate = rrddim_add(p->st_request_by_type_rate, "lock", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_unlock_rate = rrddim_add(p->st_request_by_type_rate, "unlock", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_other_rate = rrddim_add(p->st_request_by_type_rate, "other", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_options_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "options", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_get_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "get", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_post_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "post", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_head_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "head", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_put_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "put", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_delete_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "delete", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_trace_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "trace", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_move_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "move", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_copy_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "copy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_mkcol_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "mkcol", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_propfind_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "propfind", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_proppatch_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "proppatch", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_search_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "search", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_lock_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "lock", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_unlock_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "unlock", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
p->rd_request_other_rate =
|
||||
rrddim_add(p->st_request_by_type_rate, "other", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
|
||||
|
||||
rrdlabels_add(p->st_request_by_type_rate->rrdlabels, "website", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
rrdlabels_add(
|
||||
p->st_request_by_type_rate->rrdlabels, "website", windows_shared_buffer, RRDLABEL_SRC_AUTO);
|
||||
}
|
||||
|
||||
rrddim_set_by_pointer(
|
||||
|
@ -580,21 +603,13 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
p->rd_request_options_rate,
|
||||
(collected_number)p->IISRequestsOptions.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_get_rate,
|
||||
(collected_number)p->IISRequestsGet.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_get_rate, (collected_number)p->IISRequestsGet.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_post_rate,
|
||||
(collected_number)p->IISRequestsPost.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_post_rate, (collected_number)p->IISRequestsPost.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_head_rate,
|
||||
(collected_number)p->IISRequestsHead.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_head_rate, (collected_number)p->IISRequestsHead.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_put_rate,
|
||||
(collected_number)p->IISRequestsPut.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_put_rate, (collected_number)p->IISRequestsPut.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_delete_rate,
|
||||
|
@ -604,13 +619,9 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
p->rd_request_trace_rate,
|
||||
(collected_number)p->IISRequestsTrace.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_move_rate,
|
||||
(collected_number)p->IISRequestsMove.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_move_rate, (collected_number)p->IISRequestsMove.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_copy_rate,
|
||||
(collected_number)p->IISRequestsCopy.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_copy_rate, (collected_number)p->IISRequestsCopy.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_mkcol_rate,
|
||||
|
@ -628,9 +639,7 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
p->rd_request_search_rate,
|
||||
(collected_number)p->IISRequestsSearch.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_lock_rate,
|
||||
(collected_number)p->IISRequestsLock.current.Data);
|
||||
p->st_request_by_type_rate, p->rd_request_lock_rate, (collected_number)p->IISRequestsLock.current.Data);
|
||||
rrddim_set_by_pointer(
|
||||
p->st_request_by_type_rate,
|
||||
p->rd_request_unlock_rate,
|
||||
|
@ -647,7 +656,8 @@ static bool do_web_services(PERF_DATA_BLOCK *pDataBlock, int update_every) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int do_PerflibWebService(int update_every, usec_t dt __maybe_unused) {
|
||||
int do_PerflibWebService(int update_every, usec_t dt __maybe_unused)
|
||||
{
|
||||
static bool initialized = false;
|
||||
|
||||
if (unlikely(!initialized)) {
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
#include "libnetdata/libnetdata.h"
|
||||
|
||||
static inline ULONGLONG FileTimeToULL(FILETIME ft) {
|
||||
static inline ULONGLONG FileTimeToULL(FILETIME ft)
|
||||
{
|
||||
ULARGE_INTEGER ul;
|
||||
ul.LowPart = ft.dwLowDateTime;
|
||||
ul.HighPart = ft.dwHighDateTime;
|
||||
|
|
Loading…
Add table
Reference in a new issue