Page 1 of 2

report in excel status host

Posted: Fri May 21, 2021 4:39 am
by nmarbue79
Hi,

my question in the following:


I want to make a list in Excel of the status of the hosts (down, up), both total and by group, also the status of the services, but the main thing for me is to know the hosts down in an Excel list, nagios can do it in pdf , but corporately they require me to be in pdf, is there a plugin or tool that can do this. Thank you so much

Re: report in excel status host

Posted: Fri May 21, 2021 4:03 pm
by vtrac
Hi,
How are you doing?

The Download button can be used to save the report as a PDF, JPG or CSV only.

Here's the KB article on Generating Reports with Nagios XI:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

I can file an internal feature request for adding this functionality, if you like but will have to wait for approval from development team.


Best Regards,
Vinh

Re: report in excel status host

Posted: Tue May 25, 2021 8:04 am
by nmarbue79
Those types of reports described in your manual are good for other things, really what I want to do is make a list in Excel and pdf with the same fields that come in the description of host status summary, I see that a scheduled report can be made and send a pdf, but we still do not have internal mail enabled, how could I export this list in Excel and pdf?

It is very important to me that you only have the fields that you see (host, status, duration, attempting, last check, status information) as it comes in the host status summary list.

Thank you so much

Re: report in excel status host

Posted: Tue May 25, 2021 2:42 pm
by vtrac
Hi,
How are you doing?

I asked one of my team member (Sean) to help create a script to generate the PDF file .... here's it is:

Code: Select all

#!/bin/bash

# Set options
DATE= `date '+%Y-%m-%d %H:%M:%S'`
hostname="x.x.x.x"
username="nagiosadmin"
password="XXXX"

# Get a single-use auth token from the XI API
token=$(curl -k -L -XPOST "https://$hostname/nagiosxi/api/v1/authenticate" -d "username=$username&password=$password" | grep -Po  '"auth_token":.*?[^\\]",' | awk -F '"' '{print $4}')

# Use auth token to acces a page (downloading a report as PDF)
/usr/bin/wkhtmltopdf -O Landscape --no-stop-slow-scripts --lowquality --no-outline --footer-spacing 3 --margin-bottom 15mm --footer-font-size 9 --footer-right 'Page [page] of [toPage]' --footer-left '$DATE' "https://$hostname/nagiosxi/includes/components/xicore/status.php?&show=hosts&token=$token" '/tmp/YOURREPORT.pdf'
I also attached the same file called "create_pdf.sh".

Please edit the file and change "x.x.x.x" to your Nagios XI IP address.
Also, please change "XXXX" to your "nagiosadmin" log password.

The output goes into "/tmp/YOURREPORT.pdf"


Best Regards,
Vinh

Re: report in excel status host

Posted: Fri Jun 04, 2021 5:52 am
by nmarbue79
Thank you very much I try it and tell you

Re: report in excel status host

Posted: Fri Jun 04, 2021 10:31 am
by vtrac
Great!! ..... We'll wait for your good news!! .... :-)

Best Regards,
Vinh

Re: report in excel status host

Posted: Mon Jun 07, 2021 7:46 am
by nmarbue79
This is the output, it gives an error in line 4, and the pdf file generated when I open it, the nagiosxi login page appears

./create_pdf.sh: line 4: 2021-06-07: command not found
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6990 100 6947 0 43 91 0 0:01:16 0:01:15 0:00:01 1628
Loading pages (1/6)
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

Re: report in excel status host

Posted: Mon Jun 07, 2021 11:04 am
by vtrac
Hi,
Hope you day is going well!! ... :-)

I looked inside the script and there is a space right after the "=", which is wrong.

Please change line 4 in the script from:

Code: Select all

DATE= `date '+%Y-%m-%d %H:%M:%S'`
To:

Code: Select all

DATE=`date '+%Y-%m-%d %H:%M:%S'`
Please also remember to add the correct values for those variables inside the script:

Code: Select all

hostname="x.x.x.x"
username="nagiosadmin"
password="XXXX"
Please try running the script again.


Best Regards,
Vinh

Re: report in excel status host

Posted: Mon Jun 14, 2021 6:53 am
by nmarbue79
I try it and tell him

Re: report in excel status host

Posted: Mon Jun 14, 2021 9:52 am
by vtrac
Great!! ... Please try it and let us know how it goes ... :-)

Regards,
Vinh