Class: Aho::Metrics::Active

Inherits:
Aho::MetricsBuilder show all
Defined in:
lib/aho/metrics/active.rb

Instance Method Summary collapse

Methods inherited from Aho::MetricsBuilder

#run

Instance Method Details

#metricsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/aho/metrics/active.rb', line 8

def metrics
  {
    timestamp: run('date'),
    server_id: 'TODO',
    event_type: 'TODO',
    description: 'TODO',
    crashtime: 'TODO',
    uptime: run('uptime'),
    cpu_core: run('nproc'),
    ram_total: run("awk '/MemTotal/ {print $2}' /proc/meminfo"),
    disk_total: run("lsblk -b -o SIZE | awk 'NR>1 {total+=$1} END {print total}'"),
    cpu_seconds_total:,
    ram_used: run("free | awk '/^Mem/ {print $3}'"),
    disk_used: run("df --block-size=1 | awk 'NR>1 {used+=$3} END {print used}'"),
    network_load:
  }
end