report in excel status host

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
nmarbue79
Posts: 31
Joined: Thu Jul 30, 2020 2:17 am

report in excel status host

Post 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
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: report in excel status host

Post 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
nmarbue79
Posts: 31
Joined: Thu Jul 30, 2020 2:17 am

Re: report in excel status host

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: report in excel status host

Post 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
You do not have the required permissions to view the files attached to this post.
nmarbue79
Posts: 31
Joined: Thu Jul 30, 2020 2:17 am

Re: report in excel status host

Post by nmarbue79 »

Thank you very much I try it and tell you
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: report in excel status host

Post by vtrac »

Great!! ..... We'll wait for your good news!! .... :-)

Best Regards,
Vinh
nmarbue79
Posts: 31
Joined: Thu Jul 30, 2020 2:17 am

Re: report in excel status host

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: report in excel status host

Post 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
nmarbue79
Posts: 31
Joined: Thu Jul 30, 2020 2:17 am

Re: report in excel status host

Post by nmarbue79 »

I try it and tell him
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: report in excel status host

Post by vtrac »

Great!! ... Please try it and let us know how it goes ... :-)

Regards,
Vinh
Locked