Getting metric data (Performance data) using REST Api calls

This forum was archived to /woltlab and is now in read-only mode.
  • Hello All,


    I am a newbie in monitoring space and i am trying use Icinga2 for my recent project.

    I am able to receive event data using the /v1/events end point.

    Now i also want to get the metric data ( performance data) of each and every service on each and every hosts.

    Through some googling i found that databases like InfluxDB , graphite, pnp are used as backend to store metrics from which we can always make a rest call to retrieve value.

    But i am trying to avoid installing an additional feature to Icinga2.


    I am want to get the metric data from the existing REST apis itself.


    What i tried so far:


    I tried reading the performance data which is returned as part of the Event REST call.


    curl -k -s -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/events?queue=michi&types=CheckResult&filter=check_result.performance_data'


    Result of this call returns also the performance data.


    But is there any other way or any other combination of existing APIs to get the complete set of metric data available in icinga2 for all hosts and services?


    I am just trying to avoid installing additional features for Icinga2.


    Please share your insights on this.


    Would appreciate any kind of response.

  • just a question, why do you try to avoid installing something like influxDB?


    I'm not that familiar with the REST API, so I would suggest using influxDB for the performance data, which makes it rather easy.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • just a question, why do you try to avoid installing something like influxDB?


    I'm not that familiar with the REST API, so I would suggest using influxDB for the performance data, which makes it rather easy.

    Thanks for the response.


    Installing influxDB would be my last preference as i want to want to try out other API alternatives.

    Could you also clarify my other doubts..


    No variants of Icinga2 comes along with influxDB? It should always be installed manually upon Icinga2, am i right?

    Graphite is an alternative to influxDB. It does come along with Icinga2, correct?


    I have also tried /objects/services Endpoint of Icinga2 which gives all the details of the services in Icinga2 in json format. It also includes the performance data of each of the services in hosts.


    Example: for Disk check


    Code
    1. "performance_data": [
    2.                         "/=8825MB;59519;66959;0;74399"
    3.                     ],

    performance data is received as part of the response to the call to /objects/services.



    Is this the same information regarding the Disk that would be available in Graphite/infuxDB also? Or any other additional information will be available?


    Basically what are the pros of using a dedicated InfluxDB/Graphite over parsing and reading the performance data which comes as part of /objects/services call?


    Thanks in advance

  • to answer your question, yes the performance data from the API are the same as infludDB etc uses.


    the other question, neither graphite nor influxdb come with icinga2. you have to install them both seperately.

    Icinga2 does have modules that can communicate with both, the setup is really easy.

    InfluxDB is just a much never version which uses less space as it has built in deduplication.


    The Pro with InfluxB/Grafana would be that you have a dedicated Database that is designed to store such data.

    specifically InfluxDB gives a really easy SQL syntax to query those data in a time format.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • To add: Icinga 2 and its REST API allow you to fetch the current runtime state only. You can of course subscribe to the API event streams and process each check result event for example. You still need to ensure to store those historical metrics "somewhere".


    Icinga does not have a time series database built-in, but focuses on integration with existing tools (which are explicitly built for that, and are mature and stable). Popular tools are RDDTool, Graphite and InfluxDB, but there also is the possibility to use OpenTSDB, or even forward metrics to Graylog or Elastic to correlate with other events such as alerts or syslog entries.


    Here's an overview for integrations with Icinga: https://www.icinga.com/products/integrations/