Page 1 of 1

Error getting Disk data of Win Servers using API rrdexport

Posted: Wed Feb 22, 2017 7:24 am
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
p.s.: We are a paid customer. How can we post in the Customer Support forum?

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

Posted: Wed Feb 22, 2017 12:36 pm
by tgriep
When using the API and the CURL command, if the Host name or service description has a space in it, you will have to replace the space with %20 so the URL will be encoded correctly.
Try using this example for your API call and let us know if it works for you.

Code: Select all

"http://[HOST]/nagiosxi/api/v1/objects/rrdexport?apikey=[APIKEY]&pretty=1&host_name=[HOSTNAME]&service_description=Drive%20C:%20Disk%20Usage"
To get added to the Customer side of the forum, you would have to email the Sales Department at [email protected] with your Account number, username and email address you registered with and they will add you to that section of the forums.

Thanks

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

Posted: Thu Feb 23, 2017 9:05 am
by aaronjpa
tgriep wrote: To get added to the Customer side of the forum, you would have to email the Sales Department at [email protected] with your Account number, username and email address you registered with and they will add you to that section of the forums.

Thanks
I just posted it there.
Thanks!

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

Posted: Thu Feb 23, 2017 11:06 am
by dwhitfield
I am going to lock the thread so we have a single location for the issue.