Page 1 of 1

Nagios reports CLI

Posted: Fri Feb 15, 2019 8:46 am
by jonasdlm
Hello,

Every year we have to generate reports for the management team. There are 5 hostgroups whe should generate a report from for each quarter, so 20 reports. Now we do this manuel through the webinterface, but every report takes about 1,5 hour to generate. So we would like to automate this proces.
I tried to figure this out trough the CLI. But when I tried ussing wget I always got 'Your session has timed out.' in the file. This is the command I tried:

Code: Select all

wget --user 'user' --password 'password' -O /tmp/report.csv 'https://nagiosserver/nagiosxi/reports/availability.php?reportperiod=custom&startdate=2018-01-01%2000%3A00%3A00&enddate=2018-12-31%2023%3A59%3A59&host=&service=&hostgroup=hg_ind_exchange&servicegroup=&advanced=1&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=xi_timeperiod_24x7&dont_count_downtime=on&dont_count_warning=on&mode=getreport&mode=csv&csvtype=combined'
We would like to trigger this command remotely and change variables (hostgroup, timeperiod, ...), but first I need to know how to generate reports trough the CLI.

Can you guys help me out?

Thanks in advance!

Greetings,
Jonas De la Marche

Re: Nagios reports CLI

Posted: Fri Feb 15, 2019 3:57 pm
by npolovenko
Hello, @jonasdlm. You need to enable backend token authentication by going to the Admin menu, then system settings in the left column and then clicking on the Backward Compatibility tab and checking the box that says "Allow Insecure Logins".

After that click on the username at the top right corner of the screen next to the Logout button.
Scroll down to the section "Insecure Login Settings" and check the box ->
Allow using the insecure login ticket to authenticate this user. Use by passing the username and ticket in the URL parameters.
Copy the Insecure login ticket and replace it in my command below as well as the XI IP address.
This command should generate a csv report in the /tmp/ folder.
/tmp/report.csv