You may want some times to schedule the creation of a formal PDF report that contains information for specific Nagios services. A good solution to this is to publish reports using PNP4Nagios features for saving graphs in PDF or other formats. Some information for this process can be found in the Data export and Timeranges PNP4Nagios pages. Using this approach you may create a report that contains graphs for a specific (single) service only.
A simple example of using wget linux command is the following:
wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'
In the -O you may specify the report that should be created and after that in single quotes you define the URL that will create the PDF or any other type of report:
[root@myserver ~]# wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'
--2014-07-02 09:16:18-- http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 217720 (213K) [application/pdf]
Saving to: βcpu.pdfβ
100%[==================================================================================================>] 217,720 --.-K/s in 0.002s
2014-07-02 09:16:20 (118 MB/s) - βcpu.pdfβ
A simple example of using wget linux command is the following:
wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'
In the -O you may specify the report that should be created and after that in single quotes you define the URL that will create the PDF or any other type of report:
[root@myserver ~]# wget --user=nagiosuser --password=nagiospsswd -O cpu.pdf 'http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load'
--2014-07-02 09:16:18-- http://localhost/pnp4nagios/pdf?host=myhost&srv=CPU_Load
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Connecting to localhost|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 217720 (213K) [application/pdf]
Saving to: βcpu.pdfβ
100%[==================================================================================================>] 217,720 --.-K/s in 0.002s
2014-07-02 09:16:20 (118 MB/s) - βcpu.pdfβ
If there are more complex requirements for reports that contain combinations of graphs, the user has the possibility to configure the pages PNP4Nagios feature. Using this option, you may create some custom template pages that combine several services (or metrics) from several hosts in one report. After the implementation of the servers_load.cfg file you may use wget to create the related report from the command line:
wget --user=nagiosuser --password=nagiospsswd -O serversload.pdf 'http://localhost/pnp4nagios/pdf/page/servers_load?view=2'
You may use wget commands in a shell script to run under linux cron (crontab) to drop the generated reports in a folder or send them to specific recipients using email. Several people have used this approach and another in the past.
Moreover, the PNP4Nagios basket feature combines several services (or metrics) in one report. In this way, users have the option from the related PNP4Nagios web page to create, on demand, more complex reports using a link (e.g. PDF link). The possibility to create PNP4Nagios basket reports using wget is under investigation..
wget --user=nagiosuser --password=nagiospsswd -O serversload.pdf 'http://localhost/pnp4nagios/pdf/page/servers_load?view=2'
You may use wget commands in a shell script to run under linux cron (crontab) to drop the generated reports in a folder or send them to specific recipients using email. Several people have used this approach and another in the past.
Moreover, the PNP4Nagios basket feature combines several services (or metrics) in one report. In this way, users have the option from the related PNP4Nagios web page to create, on demand, more complex reports using a link (e.g. PDF link). The possibility to create PNP4Nagios basket reports using wget is under investigation..
No comments:
Post a Comment