Good Practices: virtual metrics – part 2

We previously discussed the theoretical part of the virtual metric.
Let’s start now some practical exercises!
In this new article, you will find examples of configuration step by step so that you can incorporate on your platform supervision.
To help you to familiarize yourself little by little with virtual metrics, we present use cases from simple to more difficult.

Unit Conversion

In this example, we will convert units of two metrics from octet/s to bit/s.
To configure virtual metric, go to the “Views”> “Graphs”> “Metrics” and add the following metric menu:

virtual-metric-convert-traffic-invirtual metric convert traffic_in

virtual-metric-convert-traffic-out

virtual metric convert traffic_out

You can check the result by looking at the graph of the service.

Sum metrics

In this example, we will be adding metrics “traffic_in” and “traffic_out” of the plugin check_centreon_snmp_traffic. The goal is to display a metric that we call “traffic_total” on the graph.
To configure virtual metric, we must go to the menu “Views”> “Graphs”> “Metrics” and add the following metric:

virtual-metric-traffic-total-config

You should not forget to select the host and the service concerned.
Once the configuration is validated, you will have the next page in the menu virtual metric.

virtual-metrics-traffic-total

See the result on the graph.

Centreon-Server-Traffic-eth0

We see that the new metric appears on our graph.

To change the behavior of graphics depending on the status of the service

In this example, we will change the color of the graph according to the status of the service. It is (almost) possible to do the same thing when your plugins return an outpout complies with developments Nagios plugins but this is not always the case. Here is a nice alternative to that.

To configure virtual metric, it must go to “Views”> “Graphs”> “Metrics” and add the following metric:

virtual-metric-cpu-cool-1

virtual metric cpu cool-1

virtual-metric-cpu-cool

virtual metric cpu cool

virtual-metric-cpu-notcool-1

virtual metric cpu notcool-1

virtual-metric-cpu-notcool

virtual metric cpu notcool

You should not forget once again to select the host and the service concerned.
Once the configuration is validated, you will have the next page in the menu of virtual metric.

recap-config-virtual-metrics-cpu

Before seeing the results on the graph, it will create the cool curves cool1, notcool and nocool1 by attributing their respective colors. The metric cool and cool1 will be green and notcool metric and nocool1 will be red.
To customize these curves, I refer you to the article dedicated to this topic.

See the result on the graph:

Centreon-Server-cpu(4)

Prediction of linear data

In this example, we will make the prediction of linear data (disk space used, number of users, number of processes, etc.). We will use new functions (LSLSLOPE, LSLINT, COUNT, POP). We will use the metric nbconn (number of connections) in the following example.
To configure virtual metric, you must go to the “Views”> “Graphs”> “Metrics” and add the following metric:

virtual-metrics-connected-users-intercept

virtual metrics connected users – intercept

virtual-metrics-connected-users-slope

virtual metrics connected users – slope

virtual-metrics-connected-users-trendline

virtual metrics connected users – rendline

Check the result:

Centreon-Server-connected-user-port-3306

Prediction of nonlinear data

In this example, we will make the prediction of nonlinear data (CPU usage, load average, etc.). We will use new features (PREDICT, PREDICTSIGMA, TREND).
Unlike the previous examples, we will need at least 7 days of history to be an interesting result. We use the metric load15 (load average 15 minutes) in the following example.

To configure virtual metric, you must go to the “Views”> “Graphs”> “Mertics” and add the following metric:

virtual-metrics-load-predictionvirtual metrics load prediction

virtual-metrics-load-sigmavirtual metrics load sigma

virtual-metrics-load-smoothvirtual metrics load smooth

Details :
CDEF:predict_value = 86400, -7, 900, x, PREDICT
This means that the prediction is calculated based on a 7-day (24h/24 and 7/7) with a calculation of an average interval of 15 minutes.
Note :
86400 = 60 seconds x 60 minutes x 24 hours
900 = 60 seconds x 15 minutes

You should not forget to select the host and the service concerned.
Once the configuration is validated, you will have the next page in the menu of virtual metrics.

virtual-metrics-load-average

See the result on the graph:
Centreon-Server-Load(6)

Conclusion

We tried to vary the functions used and the use cases in order to give you some ideas and that allow you to implement virtual metrics on your platform supervision.

If you have any questions or suggestions, do not hesitate to comment on this article!

Incoming search terms:

  • centreon Metrics

3 thoughts on “Good Practices: virtual metrics – part 2

  1. hi, im having a problem when i try to make a load prediction (nonlinear data),
    i have an error:
    Wrong RPN syntax (RRDtool said: invalid rpn expression in: 86400,-7,900,v0,PREDICT)
    the configuration is the same as in the photo
    Any ideas?
    Thanks
    Javier

  2. Hi, im having problems when i try to create nonlinear data prediction graph with Load, i have an error: Wrong RPN syntax (RRDtool said: invalid rpn expression in: 86400,-7,900,value,PREDICT)
    Any Ideas?

    • you should update your rrdtools version from 1.3.* to 1.4.*,the latest version of rrdtool is 1.4.8,download from http://oss.oetiker.ch/rrdtool/,and build it in your linux OS。
      then remove your old version rrdtool,and install the new one,and do not forget make a soft link to your newly install path。

Leave a Reply