Error getting Disk data of Win Servers using API rrdexport

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
aaronjpa
Posts: 4
Joined: Tue Feb 21, 2017 3:30 pm

Error getting Disk data of Win Servers using API rrdexport

Post by aaronjpa »

We are trying to get disk usage data of Windows Servers using the Backend API GET objects/rrdexport

http://[HOST]/nagiosxi/api/v1/objects/rrdexport?apikey=[APIKEY]&pretty=1&host_name=[HOSTNAME]&service_description=Drive C: Disk Usage

But we're always getting the following error:

{
"error": "No valid data returned."
}


We are using the Nagios's Wizard for Windows Servers (xiwizard_windowsserver_nsclient_service).

We are sure that the data is there, since we can see it in the Nagios XI's interface.

All others Windows Servers services data (ping, cpu, memory, etc) are being obtained correctly.

Also, disk usage data for Linux Servers (service_description=/ Disk Usage) is being obtained correctly.

We have already tried "service_description=Drive_C:_Disk_Usage", "service_description=Drive_C_Disk_Usage" and even rename the service to "DriveCDiskUsage" and try "service_description=DriveCDiskUsage", but nothing worked.

Can anyone help us achieve this?

Thanks in advance!

Here is our System Profile:

Code: Select all

Nagios XI Installation Profile

System:

Nagios XI Version : 5.3.3
[REMOVED] 2.6.32-573.el6.x86_64 x86_64
CentOS release 6.7 (Final)
Gnome is not installed
Apache Information

PHP Version: 5.3.3
Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Server Name: [REMOVED]
Server Address: 1.1.1.21
Server Port: 80
Date/Time

PHP Timezone: America/Sao_Paulo 
PHP Time: Wed, 22 Feb 2017 08:00:36 -0300
System Time: Wed, 22 Feb 2017 08:00:36 -0300
Nagios XI Data

License ends in: STTRNP

nagios (pid 37431) is running...
NPCD running (pid 1702).
ndo2db (pid 1716) is running...
CPU Load 15: 1.66 
Total Hosts: 425 
Total Services: 4219 
Function 'get_base_uri' returns: http://[REMOVED]/nagiosxi/
Function 'get_base_url' returns: http://[REMOVED]/nagiosxi/
Function 'get_backend_url(internal_call=false)' returns: http://[REMOVED]/nagiosxi/includes/components/profile/profile.php
Function 'get_backend_url(internal_call=true)' returns: http://localhost/nagiosxi/backend/
Ping Test localhost

Running:
/bin/ping -c 3 localhost 2>&1 
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.059 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.068 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.060 ms

--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.059/0.062/0.068/0.007 ms
Test wget To localhost

WGET From URL: http://localhost/nagiosxi/includes/components/ccm/ 
Running:
/usr/bin/wget http://localhost/nagiosxi/includes/components/ccm/ 
--2017-02-22 08:00:38-- http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://localhost/nagiosxi/login.php?redirect=/nagiosxi/includes/components/ccm/index.php%3f&noauth=1 [following]
--2017-02-22 08:00:38-- http://localhost/nagiosxi/login.php?redirect=/nagiosxi/includes/components/ccm/index.php%3f&noauth=1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: "/usr/local/nagiosxi/tmp/ccm_index.tmp"

0K .......... .......... ..... 1.02M=0.02s

2017-02-22 08:00:39 (1.02 MB/s) - "/usr/local/nagiosxi/tmp/ccm_index.tmp" saved [26004]

Network Settings

1: lo:  mtu 65536 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: eth2:  mtu 1500 qdisc mq state UP qlen 1000

    link/ether 00:15:5d:00:85:61 brd ff:ff:ff:ff:ff:ff

    inet 1.1.1.21/24 brd 1.1.1.255 scope global eth2

    inet6 fe80::215:5dff:fe00:8561/64 scope link 

       valid_lft forever preferred_lft forever


1.1.1.0/24 dev eth2  proto kernel  scope link  src 1.1.1.21 

169.254.0.0/16 dev eth2  scope link  metric 1002 

default via 1.1.1.1 dev eth2
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error getting Disk data of Win Servers using API rrdexpo

Post by tgriep »

If a host name or Service Description has a space in it, you will have to replace it with %20 so the curl command will treat it as a valid URL.
Try the example below and let us know if it works.
http://[HOST]/nagiosxi/api/v1/objects/rrdexport?apikey=[APIKEY]&pretty=1&host_name=[HOSTNAME]&service_description=Drive%20C:%20Disk%20Usage
Be sure to check out our Knowledgebase for helpful articles and solutions!
aaronjpa
Posts: 4
Joined: Tue Feb 21, 2017 3:30 pm

Re: Error getting Disk data of Win Servers using API rrdexpo

Post by aaronjpa »

tgriep wrote:If a host name or Service Description has a space in it, you will have to replace it with %20 so the curl command will treat it as a valid URL.
Try the example below and let us know if it works.
http://[HOST]/nagiosxi/api/v1/objects/rrdexport?apikey=[APIKEY]&pretty=1&host_name=[HOSTNAME]&service_description=Drive%20C:%20Disk%20Usage
Thank you for your answer!

I had already tried that. Sorry for not have mentioned.

I have also tried Drive%20C%3A%20Disk%20Usage (URL encode for the : too) and Drive+C%3A+Disk+Usage.

Looks like it's not a problem with the service name, since I tried renaming it to DriveCDiskUsage and it still didn't work.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Error getting Disk data of Win Servers using API rrdexpo

Post by tgriep »

f you can post the exact command you are using so I can view it?
If you are using curl, add the -v (Verbose) to the command and see if you get more details.
Also, one thing, make sure the user account that is tied to the the API key is an admin account that can view that host and service.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked