I am looking to get performance data of various alerts setup in my Nagios Core/XI. I think it is stored in RRDs. Are there ways I can get access to it?
1 Answers
If you're using Nagios XI you can get this data a few different ways.
If you're using XI 5 or later, then the easiest way that springs to mind is the API. Log in to your XI server as an administrator, navigate to 'Help' menu, then select 'Objects Reference' on the left hand side navigation and find 'GET objects/rrdexport' from the Objects Reference navigation box (or just scroll down to near the bottom).
An example curl might look like this:
curl -XGET "http://nagiosxi/nagiosxi/api/v1/objects/rrdexport?apikey=YOURAPIKEY&pretty=1&host_name=localhost"
Your response should look something like:
{
"meta": {
"start": "1453838100",
"step": "300",
"end": "1453838400",
"rows": "2",
"columns": "4",
"legend": {
"entry": [
"rta",
"pl",
"rtmax",
"rtmin"
]
}
},
"data": {
"row": [
{
"t": "1453838100",
"v": [
"6.0373333333e-03",
"0.0000000000e+00",
"1.7536000000e-02",
"3.0000000000e-03"
]
},
{
"t": "1453838400",
"v": [
"6.0000000000e-03",
"0.0000000000e+00",
"1.7037333333e-02",
"3.0000000000e-03"
]
}
]
}
}
BUT WAIT, THERE IS ANOTHER WAY
This way will work no matter what version you're on, and would actually work if you were processing performance data with NPCD on a Core system as well.
Log in to your server via ssh or console and get your butt over to the /usr/local/nagios/share/perfdata
directory. From here we're going to use the localhost object as an example..
$ cd /usr/local/nagios/share/perfdata/
$ ls
localhost
$ cd localhost/
$ ls
Current_Load.rrd Current_Users.xml HTTP.rrd PING.xml SSH.rrd Swap_Usage.xml
Current_Load.xml _HOST_.rrd HTTP.xml Root_Partition.rrd SSH.xml Total_Processes.rrd
Current_Users.rrd _HOST_.xml PING.rrd Root_Partition.xml Swap_Usage.rrd Total_Processes.xml
$ rrdtool dump _HOST_.rrd
Once you run the rrdtool dump
command, there is going to be an awful lot of output, so I keep that as an exercise for you, the reader ;)
If you're trying to automate something of some kind, then you should note that the xml files contain meta data for the rrd files and could potentially be useful to parse first.
Also, if you're anything like me, you love reading technical manuals. Here is a great one to read: RRDTool documentation
Hope this helped!

- 561
- 3
- 11
-
Thanks for your answer. rrdtool dump helped to gather each alarm perf data. I currently have Nagios XI 2012R2.9 installed, can Backend API help here since I would like to use this data as a service? – nikhilvora Jan 09 '17 at 06:16
-
Unfortunately, no. The RRD Export endpoint didn't become available until XI 5. You'll have to write your own via a combination of `rrdtool export` and serving that data to your http client. – Nagios Support Jan 09 '17 at 14:40
-
Thanks. I want to know for the curl -XGET "http://nagiosxi/nagiosxi/api/v1/objects/rrdexport?apikey=YOURAPIKEY&pretty=1&host_name=localhost" how do I get documentation of this API. I want to know all the parameters of the GET request. Difficult to find the API for this. – nikhilvora Jan 16 '17 at 11:29
-
If you're using 2012R2.9 like you say, then there is no api/v1 curl request I can give you that will work on your server. However, if you've updated to the latest version of XI (`wget https://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz`) then the API is actually pretty well documented inside of the application itself. – Nagios Support Jan 16 '17 at 16:24
-
In the hopes of helping your curiosity, here would be the proper curl -XGET command: `curl -XGET "http://nagiosxi/nagiosxi/api/v1/objects/rrdexport?apikey=YOURAPIKEYHERE&pretty=1&host_name=localhost"` – Nagios Support Jan 16 '17 at 16:26
-
Thanks. This looks like the one from the answer above. For a specific custom alarm can add something like &service=alarmName to the above GET call to obtain the historic alarm data. – nikhilvora Jan 17 '17 at 09:28
-
1Historic alarm data isn't available via the rrd export, for that, you'd need something like: `curl -XGET "http://nagiosxi/nagiosxi/api/v1/objects/logentries?apikey=YOURAPIKEYHERE&pretty=1"` but being able to search on those is rather limited. You're better to pull all of them, and then parse them once you have them. – Nagios Support Jan 18 '17 at 15:08
-
Thanks a lot for your kind help. – nikhilvora Jan 19 '17 at 05:59