Page 1 of 1

need to exclude weekends from a report

Posted: Tue Nov 09, 2021 10:58 am
by gkrupitsky
Hi,
I created a custom report, that reports on the service state, I am using "last month" as my report period. I need to exclude weekends from the report. The report must show the service state for the last month, excluding the SAT & SUN for the last month.

Re: need to exclude weekends from a report

Posted: Wed Nov 10, 2021 10:45 am
by benjaminsmith
Hi,

Thanks for reaching out to us.

Unfortunately, that is not an option in the reports right now, but I would be happy to get a feature request submitted on this.

The best workaround would be to use the Custom Period option to create multiple reports for the month and exclude those dates.

Regards,
Benjamin

Re: need to exclude weekends from a report

Posted: Wed Nov 10, 2021 10:52 am
by gkrupitsky
Thanks for the reply, that would work, but than its not auto generated and can't be scheduled.

Surprised there is no script or bash to create a report and schedule via cron

Re: need to exclude weekends from a report

Posted: Wed Nov 10, 2021 6:03 pm
by benjaminsmith
Hi,

You can schedule any report by clicking the Schedule This Report icon in the upper right menu. These scheduled reports are saved as a cron job.

It's possible to generate a report from the command line using the API. First, you need to find out how the report is called (what parameters in the URL string) by using the browsers' developer tools. Then you can authenticate using the API and run a curl command on the URL to download the report.

The process is as follows:

Get Auth Token - http://X.X.X.X/nagiosxi/help/auth-token-reference.php

curl -k -L -XPOST 'http://X.X.X.X/nagiosxi/api/v1/authenticate?pretty=1' -d 'username=nagiosadmin&password=mypassword'

Go to the report you want to run under Reports:
- Hit F12 to bring up dev tools
- Click the Network Tab
- Click the Trash icon on top left of dev tools to clear it out (easier to read)
- Click Download and choose whatever type you want (note the type)
- Right-click the request and choose Copy > URL

Use that URL in this:
- Change XXXXXXXXXXX to the token
- Change FILE.type to the filename of the type that is expected

curl -k -L 'FULL_URL_WITH_PARAMS&token=XXXXXXXXXXX' > /tmp/FILE.type

Re: need to exclude weekends from a report

Posted: Fri Nov 12, 2021 9:05 am
by gkrupitsky
Thanks benjaminsmith, i will try that.

Re: need to exclude weekends from a report

Posted: Fri Nov 12, 2021 12:03 pm
by benjaminsmith
Hi @gkrupitsky,

Sounds good.

We'll keep this open and let me know if you have any questions.