Fetching perfdata via API fails with ‘DS does not exist’ error
Related to Copied
When running the API to retrieve perfdata values, you may encounter the error ‘DS does not exist’
Problem Copied
The following can be seen if the API endpoint is run on a web browser:
The same error will appear if the API request is done through the CLI.
Possible Cause(s) Copied
Root Cause 1: DS is not specified in the API endpoint Copied
Root Cause 2: RRD Storage Type setting for perfdata is set to SINGLE Copied
Possible Solution(s) Copied
Solution Root Cause 1: Double-check that the endpoint you are using has the DS specified Copied
The endpoint should look like this:
https://op5-host/api/beta/perfdata/fetch/?format=json&host=HOSTNAME&service=SERVICENAME&ds=rta
The ds= part corresponds to the label of the datasource from the corresponding object’s .XML definition. You can locate the .XML file in the following path: /opt/monitor/op5/pnp/perfdata/HOSTNAME
The .XML file will be labeled with the SERVICENAME. For example, for host GOMBURZA-loro and service PING, the path is then:
/opt/monitor/op5/pnp/perfdata/GOMBURZA-loro
You can then locate the correspnding .XML file by the service name:
## ls -l PING*
-rw-rw-r-- 1 monitor apache 3883 May 10 13:33 PING.xml
-rw-rw-r--. 1 monitor apache 384952 May 10 13:44 PING_pl.rrd
-rw-rw-r--. 1 monitor apache 384952 May 10 13:44 PING_rta.rrd
-rw-rw-r--. 1 monitor apache 384952 May 10 13:44 PING_rtmax.rrd
-rw-rw-r--. 1 monitor apache 384952 May 10 13:44 PING_rtmin.rrd
Inspecting PING.xml will give you the name/s of the available datasources:
# cat PING.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<NAGIOS>
<DATASOURCE>
<TEMPLATE>check_ping</TEMPLATE>
<RRDFILE>/opt/monitor/op5/pnp/perfdata/GOMBURZA-loro/PING_rta.rrd</RRDFILE>
<RRD_STORAGE_TYPE>MULTIPLE</RRD_STORAGE_TYPE>
<RRD_HEARTBEAT>8460</RRD_HEARTBEAT>
<IS_MULTI>0</IS_MULTI>
<DS>1</DS>
<NAME>rta</NAME> <<<<<<<<<<---------- This is the datasource nam
<LABEL>rta</LABEL>
Solution Root Cause 2: Change RRD Storage Type to use MULTIPLE instead of SINGLE Copied
Run the command below to check what the RRD_STORAGE_TYPE is.
grep RRD_STORAGE_TYPE /opt/monitor/etc/pnp/process_perfdata.cfg
To be able to use the api to fetch perfdata you need to have RRD_STORAGE_TYPE = MULTIPLE.
However, if you just change it you will lose all your graph history.
We have a tool for converting though. If this is something you want to do, follow the instructions below. It is recommended to make a backup first.
# yum clean all
# yum --enablerepo=op5-community install op5-support-modules\*
## mon sysconf rrd-storage-convert
Note that when the conversion is initiated, npcd service is stopped. rrdcached is flushed and stopped.
Related Articles Copied
- Any existing FAQ / external website