mirror of
https://github.com/netdata/netdata.git
synced 2021-06-06 23:03:21 +03:00
Add a chart with netdata uptime (#10997)
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
This commit is contained in:
@@ -181,6 +181,11 @@ void global_statistics_charts(void) {
|
||||
static collected_number compression_ratio = -1,
|
||||
average_response_time = -1;
|
||||
|
||||
static time_t netdata_start_time = 0;
|
||||
if (!netdata_start_time)
|
||||
netdata_start_time = now_boottime_sec();
|
||||
time_t netdata_uptime = now_boottime_sec() - netdata_start_time;
|
||||
|
||||
struct global_statistics gs;
|
||||
struct rusage me;
|
||||
|
||||
@@ -223,6 +228,35 @@ void global_statistics_charts(void) {
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
{
|
||||
static RRDSET *st_uptime = NULL;
|
||||
static RRDDIM *rd_uptime = NULL;
|
||||
|
||||
if (unlikely(!st_uptime)) {
|
||||
st_uptime = rrdset_create_localhost(
|
||||
"netdata",
|
||||
"uptime",
|
||||
NULL,
|
||||
"netdata",
|
||||
NULL,
|
||||
"Netdata uptime",
|
||||
"seconds",
|
||||
"netdata",
|
||||
"stats",
|
||||
130100,
|
||||
localhost->rrd_update_every,
|
||||
RRDSET_TYPE_LINE);
|
||||
|
||||
rd_uptime = rrddim_add(st_uptime, "uptime", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
|
||||
} else
|
||||
rrdset_next(st_uptime);
|
||||
|
||||
rrddim_set_by_pointer(st_uptime, rd_uptime, netdata_uptime);
|
||||
rrdset_done(st_uptime);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
|
||||
{
|
||||
static RRDSET *st_clients = NULL;
|
||||
static RRDDIM *rd_clients = NULL;
|
||||
|
||||
Reference in New Issue
Block a user