Overview
Collecting system metrics (e.g., CPU, memory, disk I/O, etc.) inside JVM usually shows incorrect result.
To obtain more precise monitoring result, control plane manager provides a way to collect system metrics from third-party monitoring server such as CollectD, ganglia, etc.
In this tutorial, we will show how to integrate third-party monitoring agent with ONOS to obtain system metrics.
Usage
Each monitoring agent typically provides a way to report the collected metric to other system through various interfaces.
As an example, we provide a CollectD plugin which is in charging of reporting all metric values to ONOS through REST API.
Inside ONOS we defined a set of REST API to receive the reported metrics from third-party monitoring agent.
The detailed REST API that is used for collecting system metrics is enumerated at the end of this document.
Prerequisites
Before you start, you will need followings:
- Ubuntu 14.04 64-bit
- 2GB or more RAM
- 2 or more processors
CollectD Installation
Install CollectD using apt-get.
$ sudo apt-get update $ sudo apt-get install collectd collectd-utils
Download CollectD plugin for reporting system metrics to ONOS.
$ sudo apt-get git $ git clone https://github.com/gunine/write_onos
Configure CollectD plugin by copying collectd.conf and modules directory under /etc/collectd/.
$ sudo cp collectd.conf /etc/collectd $ sudo cp -R modules /etc/collectd
You can try following commands to automatically start CollectD at OS boot time.
$ sudo chkconfig --level 2345 collectd on
Finally, run CollectD service.
$ sudo /etc/init.d/collectd start
ONOS Installation and CPMan Activation
Install and run ONOS instance. The detailed procedures can be refer from here.
After ONOS has been initialized, we can activate CPMan application using following command.
onos > app activate org.onosproject.cpman
REST API for Collecting and Query System Metrics
Collector
POST /collector/cpu_metrics | Collects CPU metrics. |
POST /collector/network_metrics | Collects network I/O metrics include in/out-bound packets/bytes statistics. |
POST /collector/disk_metrics | Collects disk I/O metrics include read and write bytes. |
POST /collector/system_info | Collects system information. |
POST /collector/memory_metrics | Collects memory metrics. |
Control Metrics
GET /controlmetrics/memory_metrics | List control message metrics of all devices. |
GET /controlmetrics/messages | List control message metrics of a given device. |
GET /controlmetrics/messages/{deviceId} | List network metrics of all network resources. |
GET /controlmetrics/cpu_metrics | List CPU metrics. |
GET /controlmetrics/disk_metrics | List disk metrics of all disk resources. |