summaryrefslogtreecommitdiffstats
path: root/src/collectors/windows.plugin/GetSystemUptime.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-24 09:54:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-24 09:54:44 +0000
commit836b47cb7e99a977c5a23b059ca1d0b5065d310e (patch)
tree1604da8f482d02effa033c94a84be42bc0c848c3 /src/collectors/windows.plugin/GetSystemUptime.c
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.tar.xz
netdata-836b47cb7e99a977c5a23b059ca1d0b5065d310e.zip
Merging upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/collectors/windows.plugin/GetSystemUptime.c')
-rw-r--r--src/collectors/windows.plugin/GetSystemUptime.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/collectors/windows.plugin/GetSystemUptime.c b/src/collectors/windows.plugin/GetSystemUptime.c
new file mode 100644
index 000000000..9ed939ca0
--- /dev/null
+++ b/src/collectors/windows.plugin/GetSystemUptime.c
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "windows_plugin.h"
+#include "windows-internals.h"
+
+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
+ );
+
+ rd_uptime = rrddim_add(st, "uptime", NULL, 1, 1000, RRD_ALGORITHM_ABSOLUTE);
+ }
+
+ rrddim_set_by_pointer(st, rd_uptime, (collected_number)uptime);
+ rrdset_done(st);
+
+ return 0;
+}