Noderig - Export OS stats as Sensision Metrics
Noderig collect OS metrics and expose them through a Sensision HTTP endpoint. Each collector is easily configurable, thanks to a simple level cursor
Noderig metrics:
- CPU
- Memory
- Load
- Disk
- Net
- External collectors
Status
Noderig is currently under development. Feel free to comment or contribute!
Building
Noderig is pretty easy to build.
- Clone the repository
- Install glide, follow instructions here https://glide.sh/
- Download dependencies
glide install
- Build and run
go run noderig.go
Usage
noderig [flags]
Flags:
--config string config file to use
-l --listen string listen address (default "127.0.0.1:9100")
-v --verbose verbose output
--period uint default collection period (default 1000)
--cpu uint8 cpu metrics level (default 1)
--disk uint8 disk metrics level (default 1)
--mem uint8 memory metrics level (default 1)
--net uint8 network metrics level (default 1)
--load uint8 load metrics level (default 1)
-c --collectors string external collectors directory (default "./collectors")
-k --keep-for uint keep collectors data for the given number of fetch (default 3)
Collectors
Noderig have some built-in collectors.
CPU
0 | | disabled metrics |
1 | os.cpu{} | combined percentage of cpu usage |
2 | os.cpu.iowait{} | combined percentage of cpu iowait |
os.cpu.user{} | combined percentage of cpu user |
os.cpu.systems{} | combined percentage of cpu systems |
3 | os.cpu.iowait{chore:n} | chore percentage of cpu iowait |
os.cpu.user{chore:n} | chore percentage of cpu user |
os.cpu.systems{chore:n} | chore percentage of cpu systems |
Memory
0 | | disabled metrics |
1 | os.mem{} | percentage of memory used |
os.swap{} | percentage of swap used |
2 | os.mem.used{} | used memory (bytes) |
os.mem.total{} | total memory (bytes) |
os.swap.used{} | used swap (bytes) |
os.swap.total{} | total swap (bytes) |
Load
0 | | disabled metrics |
1 | os.load1{} | load 1 |
2 | os.load5{} | load 5 |
os.load15{} | load 15 |
Disk
0 | | disabled metrics |
1 | os.disk.fs{disk:/sda1} | disk used percent |
2 | os.disk.fs.used{disk:/sda1} | disk used capacity (bytes) |
os.disk.fs.total{disk:/sda1} | disk total capacity (bytes) |
3 | os.disk.fs.bytes.read{disk:/sda1} | disk read rate (bytes/s) |
os.disk.fs.bytes.write{disk:/sda1} | disk write rate (bytes/s) |
4 | os.disk.fs.io.read{disk:/sda1} | disk io read rate (bytes/s) |
os.disk.fs.io.write{disk:/sda1} | disk io write rate (bytes/s) |
Net
0 | | disabled metrics |
1 | os.net.bytes{direction:in} | in bytes rate (bytes/s) |
os.net.bytes{direction:out} | out bytes rate (bytes/s) |
2 | os.net.bytes{direction:in, iface:eth0} | iface in bytes rate (bytes/s) |
os.net.bytes{direction:out, iface:eth0} | iface out bytes rate (bytes/s) |
3 | os.net.packets{direction:in, iface:eth0} | iface in packet rate (packet/s) |
os.net.packets{direction:out, iface:eth0} | iface out packet rate (packet/s) |
os.net.errs{direction:in, iface:eth0} | iface in err rate (err/s) |
os.net.errs{direction:out, iface:eth0} | iface out err rate (err/s) |
os.net.dropped{direction:in, iface:eth0} | iface in drop rate (drop/s) |
os.net.dropped{direction:out, iface:eth0} | iface out drop rate (drop/s) |
Configuration
Noderig can read a simple default config file.
Configuration is load and override in the following order:
- /etc/noderig/config.yaml
- ~/noderig/config.yaml
- ./config.yaml
- config filepath from command line
Definitions
Config is composed of three main parts and some config fields:
Collectors
Noderig have some built-in collectors. They could be configured by a log level.
You can also defined custom collectors, in an scollector way. (see: http://bosun.org/scollector/external-collectors)
cpu: 1 # CPU collector level (Optional, default: 1)
mem: 1 # Memory collector level (Optional, default: 1)
load: 1 # Load collector level (Optional, default: 1)
disk: 1 # Disk collector level (Optional, default: 1)
net: 1 # Network collector level (Optional, default: 1)
Parameters
Noderig can be customized through some parameters.
period: 1000 # Duration within all the sources should be scraped (Optional, default: 1000)
listen: none # Listen address, set to none to disable http endpoint (Optional, default: 127.0.0.1:9100)
collectors: /opt/noderig # Custom collectors directory (Optional, default: none)
Sample metrics
1484828198557102// os.cpu{} 2.5202020226869237
1484828198560976// os.mem{} 24.328345730457112
1484828198560976// os.swap{} 0
1484828198557435// os.load1{} 0.63
1484828198561366// os.net.bytes{direction:in} 858
1484828198561366// os.net.bytes{direction:out} 778
1484828197570759// os.disk.fs{disk:/dev/sda1} 4.967614357908193
Contributing
Instructions on how to contribute to Noderig are available on the Contributing page.
Get in touch