-->

DEVOPSZONES

  • Recent blogs

    How To Create Nagios Availability Report and Send them through Cron:

    How To Create Nagios Availability Report and Send them through Cron

    What is Nagios?


    Nagios, now known as Nagios Core, is a free and open source computer-software application that monitors systems, networks and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications and services.


    1. Download the html pages from nagios as per your requirement. Here i'm fetching availability report for 1 month.
    wget -v --user testuser --password 'testpassword' --no-check-certificate -O ./`date +%Y%m%d%H%M`-report-links.html "http://nagiosserver.com/nagios/cgi-bin/avail.cgi?show_log_entries=&servicegroup=Links&timeperiod=lastmonth&smon=4&sday=1&syear=2016&shour=0&smin=0&ssec=0&emon=4&eday=18&eyear=2016&ehour=24&emin=0&esec=0&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=0&initialassumedservicestate=0&backtrack=4"

    2. Now convert it to PDF.
    /var/Nagios_Availability/wkhtmltox/bin/wkhtmltopdf `date +%Y%m%d`*-report-links.html `date +%Y%m%d%H%M`-report-links.pdf

    3. Now Send as attachment.
    echo Last Month Availability Report from Nagios |/bin/mailx -a `date +%Y%m%d`*-links.pdf -s "Last Month Availability Report From Nagios" manas.tri@gmail.com

    4. Now schedule the automatic report sending.
    24 10 1 * * /var/Nagios_Availability/Nagios_Availability_Reports.sh

    No comments