summaryrefslogtreecommitdiffstats
path: root/collectors/proc.plugin
diff options
context:
space:
mode:
authorvkalintiris <vasilis@netdata.cloud>2023-08-03 13:13:36 +0300
committerGitHub <noreply@github.com>2023-08-03 13:13:36 +0300
commit0e230a260ec7d8b4d6dc5c7165da6ab103d096b3 (patch)
treeb46528e5ace00358c342ea3d571d85bda5c546ed /collectors/proc.plugin
parent72549b3a2247f763180925d7c84b0eee8086fa14 (diff)
Revert "Refactor RRD code. (#15423)" (#15723)
This reverts commit 440bd51e08fdfa2a4daa191fb68643456028a753. dbengine was still being used for non-zero tiers even on non-dbengine modes.
Diffstat (limited to 'collectors/proc.plugin')
-rw-r--r--collectors/proc.plugin/ipc.c12
-rw-r--r--collectors/proc.plugin/plugin_proc.c4
-rw-r--r--collectors/proc.plugin/proc_mdstat.c1
-rw-r--r--collectors/proc.plugin/proc_net_dev.c4
-rw-r--r--collectors/proc.plugin/proc_net_netstat.c4
-rw-r--r--collectors/proc.plugin/proc_net_sockstat.c16
-rw-r--r--collectors/proc.plugin/proc_net_softnet_stat.c1
-rw-r--r--collectors/proc.plugin/proc_net_stat_conntrack.c4
-rw-r--r--collectors/proc.plugin/proc_net_wireless.c2
-rw-r--r--collectors/proc.plugin/proc_stat.c4
-rw-r--r--collectors/proc.plugin/sys_devices_pci_aer.c2
11 files changed, 25 insertions, 29 deletions
diff --git a/collectors/proc.plugin/ipc.c b/collectors/proc.plugin/ipc.c
index dd0a8733a3..b166deba68 100644
--- a/collectors/proc.plugin/ipc.c
+++ b/collectors/proc.plugin/ipc.c
@@ -327,7 +327,7 @@ int do_ipc(int update_every, usec_t dt) {
, PLUGIN_PROC_NAME
, "ipc"
, NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES
- , rrdb.localhost->update_every
+ , localhost->rrd_update_every
, RRDSET_TYPE_AREA
);
rd_semaphores = rrddim_add(st_semaphores, "semaphores", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
@@ -345,15 +345,15 @@ int do_ipc(int update_every, usec_t dt) {
, PLUGIN_PROC_NAME
, "ipc"
, NETDATA_CHART_PRIO_SYSTEM_IPC_SEM_ARRAYS
- , rrdb.localhost->update_every
+ , localhost->rrd_update_every
, RRDSET_TYPE_AREA
);
rd_arrays = rrddim_add(st_arrays, "arrays", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
}
// variables
- semaphores_max = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "ipc_semaphores_max");
- arrays_max = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "ipc_semaphores_arrays_max");
+ semaphores_max = rrdvar_custom_host_variable_add_and_acquire(localhost, "ipc_semaphores_max");
+ arrays_max = rrdvar_custom_host_variable_add_and_acquire(localhost, "ipc_semaphores_arrays_max");
}
struct stat stbuf;
@@ -373,8 +373,8 @@ int do_ipc(int update_every, usec_t dt) {
collector_error("Unable to fetch semaphore limits.");
}
else {
- if(semaphores_max) rrdvar_custom_host_variable_set(rrdb.localhost, semaphores_max, limits.semmns);
- if(arrays_max) rrdvar_custom_host_variable_set(rrdb.localhost, arrays_max, limits.semmni);
+ if(semaphores_max) rrdvar_custom_host_variable_set(localhost, semaphores_max, limits.semmns);
+ if(arrays_max) rrdvar_custom_host_variable_set(localhost, arrays_max, limits.semmni);
st_arrays->red = limits.semmni;
st_semaphores->red = limits.semmns;
diff --git a/collectors/proc.plugin/plugin_proc.c b/collectors/proc.plugin/plugin_proc.c
index 019733cbca..74e3129370 100644
--- a/collectors/proc.plugin/plugin_proc.c
+++ b/collectors/proc.plugin/plugin_proc.c
@@ -161,7 +161,7 @@ void *proc_main(void *ptr)
worker_register_job_name(i, proc_modules[i].dim);
}
- usec_t step = rrdb.localhost->update_every * USEC_PER_SEC;
+ usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
heartbeat_t hb;
heartbeat_init(&hb);
@@ -185,7 +185,7 @@ void *proc_main(void *ptr)
netdata_log_debug(D_PROCNETDEV_LOOP, "PROC calling %s.", pm->name);
worker_is_busy(i);
- pm->enabled = !pm->func(rrdb.localhost->update_every, hb_dt);
+ pm->enabled = !pm->func(localhost->rrd_update_every, hb_dt);
}
}
diff --git a/collectors/proc.plugin/proc_mdstat.c b/collectors/proc.plugin/proc_mdstat.c
index cfebf37abc..c3d1793cbe 100644
--- a/collectors/proc.plugin/proc_mdstat.c
+++ b/collectors/proc.plugin/proc_mdstat.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "plugin_proc.h"
-#include "collectors/utils.h"
#define PLUGIN_PROC_MODULE_MDSTAT_NAME "/proc/mdstat"
diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c
index 00a957fda8..16881d1709 100644
--- a/collectors/proc.plugin/proc_net_dev.c
+++ b/collectors/proc.plugin/proc_net_dev.c
@@ -1518,7 +1518,7 @@ void *netdev_main(void *ptr)
netdata_thread_cleanup_push(netdev_main_cleanup, ptr);
- usec_t step = rrdb.localhost->update_every * USEC_PER_SEC;
+ usec_t step = localhost->rrd_update_every * USEC_PER_SEC;
heartbeat_t hb;
heartbeat_init(&hb);
@@ -1530,7 +1530,7 @@ void *netdev_main(void *ptr)
break;
worker_is_busy(0);
- if(do_proc_net_dev(rrdb.localhost->update_every, hb_dt))
+ if(do_proc_net_dev(localhost->rrd_update_every, hb_dt))
break;
}
diff --git a/collectors/proc.plugin/proc_net_netstat.c b/collectors/proc.plugin/proc_net_netstat.c
index 250f8b3777..ce3068c0e5 100644
--- a/collectors/proc.plugin/proc_net_netstat.c
+++ b/collectors/proc.plugin/proc_net_netstat.c
@@ -1647,7 +1647,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
arl_expect(arl_udplite, "InCsumErrors", &snmp_root.udplite_InCsumErrors);
arl_expect(arl_udplite, "IgnoredMulti", &snmp_root.udplite_IgnoredMulti);
- tcp_max_connections_var = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "tcp_max_connections");
+ tcp_max_connections_var = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_max_connections");
}
size_t lines, l, words;
@@ -2741,7 +2741,7 @@ int do_proc_net_netstat(int update_every, usec_t dt) {
// snmp Tcp charts
// this is smart enough to update it, only when it is changed
- rrdvar_custom_host_variable_set(rrdb.localhost, tcp_max_connections_var, snmp_root.tcp_MaxConn);
+ rrdvar_custom_host_variable_set(localhost, tcp_max_connections_var, snmp_root.tcp_MaxConn);
// see http://net-snmp.sourceforge.net/docs/mibs/tcp.html
if(do_tcp_sockets == CONFIG_BOOLEAN_YES || (do_tcp_sockets == CONFIG_BOOLEAN_AUTO &&
diff --git a/collectors/proc.plugin/proc_net_sockstat.c b/collectors/proc.plugin/proc_net_sockstat.c
index d18ae1e547..e94b891ca8 100644
--- a/collectors/proc.plugin/proc_net_sockstat.c
+++ b/collectors/proc.plugin/proc_net_sockstat.c
@@ -32,9 +32,9 @@ static int read_tcp_mem(void) {
*tcp_mem_high_threshold = NULL;
if(unlikely(!tcp_mem_low_threshold)) {
- tcp_mem_low_threshold = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "tcp_mem_low");
- tcp_mem_pressure_threshold = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "tcp_mem_pressure");
- tcp_mem_high_threshold = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "tcp_mem_high");
+ tcp_mem_low_threshold = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_mem_low");
+ tcp_mem_pressure_threshold = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_mem_pressure");
+ tcp_mem_high_threshold = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_mem_high");
}
if(unlikely(!filename)) {
@@ -60,9 +60,9 @@ static int read_tcp_mem(void) {
// fprintf(stderr, "TCP MEM low = %llu, pressure = %llu, high = %llu\n", low, pressure, high);
- rrdvar_custom_host_variable_set(rrdb.localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024.0);
- rrdvar_custom_host_variable_set(rrdb.localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024.0);
- rrdvar_custom_host_variable_set(rrdb.localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024.0);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_low_threshold, low * sysconf(_SC_PAGESIZE) / 1024.0);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_pressure_threshold, pressure * sysconf(_SC_PAGESIZE) / 1024.0);
+ rrdvar_custom_host_variable_set(localhost, tcp_mem_high_threshold, high * sysconf(_SC_PAGESIZE) / 1024.0);
return 0;
}
@@ -81,9 +81,9 @@ static kernel_uint_t read_tcp_max_orphans(void) {
if(read_single_number_file(filename, &tcp_max_orphans) == 0) {
if(unlikely(!tcp_max_orphans_var))
- tcp_max_orphans_var = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "tcp_max_orphans");
+ tcp_max_orphans_var = rrdvar_custom_host_variable_add_and_acquire(localhost, "tcp_max_orphans");
- rrdvar_custom_host_variable_set(rrdb.localhost, tcp_max_orphans_var, tcp_max_orphans);
+ rrdvar_custom_host_variable_set(localhost, tcp_max_orphans_var, tcp_max_orphans);
return tcp_max_orphans;
}
diff --git a/collectors/proc.plugin/proc_net_softnet_stat.c b/collectors/proc.plugin/proc_net_softnet_stat.c
index cb027f9167..dfd372b2a9 100644
--- a/collectors/proc.plugin/proc_net_softnet_stat.c
+++ b/collectors/proc.plugin/proc_net_softnet_stat.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
#include "plugin_proc.h"
-#include "collectors/utils.h"
#define PLUGIN_PROC_MODULE_NET_SOFTNET_NAME "/proc/net/softnet_stat"
diff --git a/collectors/proc.plugin/proc_net_stat_conntrack.c b/collectors/proc.plugin/proc_net_stat_conntrack.c
index 8e98c5bdf8..e8fbdbb66b 100644
--- a/collectors/proc.plugin/proc_net_stat_conntrack.c
+++ b/collectors/proc.plugin/proc_net_stat_conntrack.c
@@ -50,7 +50,7 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
if(!do_sockets && !read_full)
return 1;
- rrdvar_max = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "netfilter_conntrack_max");
+ rrdvar_max = rrdvar_custom_host_variable_add_and_acquire(localhost, "netfilter_conntrack_max");
}
if(likely(read_full)) {
@@ -125,7 +125,7 @@ int do_proc_net_stat_conntrack(int update_every, usec_t dt) {
unsigned long long max;
if(likely(!read_single_number_file(nf_conntrack_max_filename, &max)))
- rrdvar_custom_host_variable_set(rrdb.localhost, rrdvar_max, max);
+ rrdvar_custom_host_variable_set(localhost, rrdvar_max, max);
}
// --------------------------------------------------------------------
diff --git a/collectors/proc.plugin/proc_net_wireless.c b/collectors/proc.plugin/proc_net_wireless.c
index 31969e1ce5..08ab2eada1 100644
--- a/collectors/proc.plugin/proc_net_wireless.c
+++ b/collectors/proc.plugin/proc_net_wireless.c
@@ -1,5 +1,3 @@
-// SPDX-License-Identifier: GPL-3.0-or-later
-
#include <stdbool.h>
#include "plugin_proc.h"
diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c
index 20a18d221a..a4f76796b6 100644
--- a/collectors/proc.plugin/proc_stat.c
+++ b/collectors/proc.plugin/proc_stat.c
@@ -719,7 +719,7 @@ int do_proc_stat(int update_every, usec_t dt) {
}
if(unlikely(core == 0 && cpus_var == NULL))
- cpus_var = rrdvar_custom_host_variable_add_and_acquire(rrdb.localhost, "active_processors");
+ cpus_var = rrdvar_custom_host_variable_add_and_acquire(localhost, "active_processors");
}
rrddim_set_by_pointer(cpu_chart->st, cpu_chart->rd_user, user);
@@ -1064,7 +1064,7 @@ int do_proc_stat(int update_every, usec_t dt) {
}
if(cpus_var)
- rrdvar_custom_host_variable_set(rrdb.localhost, cpus_var, cores_found);
+ rrdvar_custom_host_variable_set(localhost, cpus_var, cores_found);
return 0;
}
diff --git a/collectors/proc.plugin/sys_devices_pci_aer.c b/collectors/proc.plugin/sys_devices_pci_aer.c
index 7f3a23f40a..134426238a 100644
--- a/collectors/proc.plugin/sys_devices_pci_aer.c
+++ b/collectors/proc.plugin/sys_devices_pci_aer.c
@@ -196,7 +196,7 @@ int do_proc_sys_devices_pci_aer(int update_every, usec_t dt __maybe_unused) {
int do_pci_slots = CONFIG_BOOLEAN_NO;
char buffer[100 + 1] = "";
- rrdlabels_get_value_strcpyz(rrdb.localhost->rrdlabels, buffer, 100, "_virtualization");
+ rrdlabels_get_value_strcpyz(localhost->rrdlabels, buffer, 100, "_virtualization");
if(strcmp(buffer, "none") != 0) {
// no need to run on virtualized environments
do_root_ports = CONFIG_BOOLEAN_NO;