conkw documentation - ProcGrabber

This is the system grabber for Linux. It relies heavily on /proc and /sys filesystems.

Use cases

Configuration

{
  "implementation":"net.pieroxy.conkw.webapp.grabbers.procgrabber.ProcGrabber",
  "config": {
    "toExtract":"processes,uptime,bdio",
    "blockDevices":"sda",
    "mdstatFile":"/proc/mdstat"
  }
},

Possible extractions:

processes

Extracts the top 3 processes in terms of CPU and Memory usage. This data is extracted from the various /proc/<pid>/stat files for every process in the system.

For CPU usage, the percentage used is in regards to the total CPU used. So if during the last second there was only 7.3% total CPU used on the system, the prc_top1cpu can very well indicate 100%, meaning 100% of the 7.3% CPU was consumed by this process.

For memory usage:

cpufreq

Extracts the frequency in hz per logical processor.

It produces, from 0 to n-1 (where n is the value of nbcpu_threads extracted by the nbcpu extraction):

uptime

Extracts hostname and load average, as viewed in /proc/uptime and /proc/loadavg.

Metrics:

nbcpu

Extracts the number of cores and threads on the system, as viewed in /proc/cpuinfo. Note that these metrics are extracted at startup time and never updated throughout the lifetime of the conkw instance.

Metrics:

cpu

Extracts CPU activity over the last second, as viewed in /proc/stat.

Metrics (percentages between 0 and 100):

mem

Extracts metrics about memory usage of the system, as viewed in /proc/meminfo.

Metrics, in bytes:

bdio

Extracts the bytes read and written from and to block devices, as read in /sys/block/<device>/stat.

The list of devices monitored can come from three sources:

Metrics extracted for every device, here for /dev/sda:

Global metrics:

net

Extracts the network activity as parsed from /proc/net/netstat second IpExt line.

Metrics:

These two metrics have an auto maximum value computed:

battery

Extracts battery metrics from three files: /sys/class/power_supply/BAT0/charge_full, /sys/class/power_supply/BAT0/charge_now and /sys/class/power_supply/AC[0]/online.

The following metrics extracted and refreshed every 10 runs:

mdstat

Extracts data from /proc/mdstat regarding the status of mdadm arrays, every minute.

Overall metrics:

For each device:

hostname

This grabber exposes the content of /etc/hostname in the metric hostname.

Extracted once per hour, so expect the wrong value to stick around for a few minutes if you change it.