Get availability information

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
morabanc
Posts: 199
Joined: Tue Jul 10, 2012 8:14 am

Get availability information

Post by morabanc »

Hello,

I'm trying to get availability information using report 'availability.php'
I'm proceeding into two steps, first one to login, and the second one for obtaining the information.
The answer it returns to me is "Your session has timed out'
What is wrong with the code?

$url = 'https://172.16.40.1/nagiosxi/login.php';

$outputfile = "bp_login.txt";
$cmd = "/usr/bin/wget --quiet=on --cookies=on --post-data 'username=xxxxxx&password=yyyyyyy&nsp=32c0390753bdbe9344d9bbb64646bc3e&action=/nagiosxi/login.php' \"$url\" -O $outputfile --save-cookies=./my-cookies.txt --keep-session-cookies=on --no-check-certificate";
exec($cmd);

$url = 'https://172.16.40.1/nagiosxi/reports/av ... vicegroup=';

$outputfile = "bp_disponibilitat.txt";
$cmd = "/usr/bin/wget --post-data='nsp_str=0d2273b2c10738606a4c92d5f9f4e0cb' --quiet=on --load-cookies=./my-cookies.txt --keep-session-cookies=on --save-cookies=./my-cookies.txt \"$url\" -O $outputfile --no-check-certificate";
exec($cmd);

Thanks for your help :)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Get availability information

Post by scottwilkerson »

My guess is you aren't giving a full path to the cookies file or the $outputfile, cookies=./my-cookies.txt won't exist....

I would go about this a bit differently.

If you go to Admin-> Manage Components -> Backend API

you can get the username & ticket for the user you are trying to login ad and it will auto log them in. then setup something like this replacing the username/ticket values

Code: Select all

$url = 'https://172.16.40.1/nagiosxi/reports/availability.php?host=Processos_negoci&service=&reportperiod=custom&startdate=2012-11-19&enddate=2012-11-20&reporttimesubmitbutton=Go&hostgroup=&servicegroup=&username=nagiosadmin&ticket=q6jjimi4';

$outputfile = "/tmp/bp_disponibilitat.txt";
$cmd = "/usr/bin/wget --quiet=on "$url" -O $outputfile --no-check-certificate";
exec($cmd);
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
morabanc
Posts: 199
Joined: Tue Jul 10, 2012 8:14 am

Re: Get availability information

Post by morabanc »

Thanks scottwilkerson

I install the component but doesn't appear in my list (admin -> manage components) :?
It's possible that appear in other name ?? I find for "backend" and "api" but I don't find.

The last question, where I should go to see this parameters (usernamen and ticket) after install ??

Thanks
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Get availability information

Post by scottwilkerson »

It should be listed under
"Backend API URL"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
morabanc
Posts: 199
Joined: Tue Jul 10, 2012 8:14 am

Re: Get availability information

Post by morabanc »

I find it !!!!

The problem was that I had to give permissions to directory backend API by the shell
If i have a problem I'll tell you


Thanks scottwilkerson
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Get availability information

Post by mguthrie »

If you're using 2012 Enterprise Edition you can also just schedule the report to be emailed on a regular basis from the web interface.
Locked