|
|
| Author |
Message |
knobdy Cacti User
Joined: 28 Sep 2005 Posts: 495
|
Posted: Tue Nov 14, 2006 12:47 pm Post subject: Nagios script request - nagiostats |
|
|
| I see that nagios has an executable called nagiostats that will dump data into mrtg format - is it possible that this will provide nagios statistics we could graph in Cacti?
|
|
| Back to top |
|
 |
nebj00la Cacti User
Joined: 17 Feb 2006 Posts: 56 Location: Massachusetts, USA
|
Posted: Fri Dec 07, 2007 1:25 pm Post subject: Re: Nagios script request - nagiostats |
|
|
| knobdy wrote: | | I see that nagios has an executable called nagiostats that will dump data into mrtg format - is it possible that this will provide nagios statistics we could graph in Cacti? |
I would also like to see this supported.
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Wed Jul 30, 2008 11:16 am Post subject: |
|
|
| I'm taking a stab at writing a wrapper script and creating some templates to handle this. I'll post my results if it turns out well.
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Thu Jul 31, 2008 1:36 pm Post subject: |
|
|
Okay, here's what I've come up with. First, my Nagios and Cacti instances both sit on the same box, so the wrapper script that returns data from nagiostats is run locally. If your Nagios instance sits elsewhere, you'll have to retool this a bit.
To use, first place the attached script in your cacti scripts directory. Second, alter the following section of the script to fit your Nagios configuration:
| Code: | # nagios binary and configuration locations
my %nagiostat = ( 'bin' => '/usr/local/nagios/bin/nagiostats',
'cfg' => '/usr/local/nagios/etc/nagios.cfg'); |
Third, import the graph templates you wish to use. Finally, create new graphs on localhost and assign the just imported templates.
This is my first attempt at exporting, so please be gentle if this blows up . Don't hesitate with comments, questions, or suggestions.[/code]
| Description: |
| Host check latency and execution times. |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_host_latency_and_execution_time.xml |
| Filesize: |
11.42 KB |
| Downloaded: |
108 Time(s) |
| Description: |
| External command buffer usage. |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_external_command_buffers.xml |
| Filesize: |
11.34 KB |
| Downloaded: |
72 Time(s) |
| Description: |
| Average checks that have been cached, per 5 min |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_cached_checks_5_min.xml |
| Filesize: |
11.39 KB |
| Downloaded: |
77 Time(s) |
| Description: |
| Average active service and host checks run per 5 minutes. |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_active_checks_5_min.xml |
| Filesize: |
11.32 KB |
| Downloaded: |
76 Time(s) |
| Description: |
| Wrapper for nagiostats written in Perl. Will return a subset of data based on the given command line argument. Please view the script for available options. |
|
 Download |
| Filename: |
nagiostats_parse.pl |
| Filesize: |
1.83 KB |
| Downloaded: |
97 Time(s) |
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Thu Jul 31, 2008 1:38 pm Post subject: |
|
|
few more..
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_hosts_summary.xml |
| Filesize: |
16.46 KB |
| Downloaded: |
79 Time(s) |
| Description: |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_services_summary.xml |
| Filesize: |
19.96 KB |
| Downloaded: |
77 Time(s) |
| Description: |
| Service check latency and execution times. |
|
 Download |
| Filename: |
cacti_graph_template_nagios_-_service_check_latency_and_execution_time.xml |
| Filesize: |
10.9 KB |
| Downloaded: |
79 Time(s) |
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Thu Jul 31, 2008 1:41 pm Post subject: |
|
|
and some examples..
| Description: |
|
| Filesize: |
30.38 KB |
| Viewed: |
1618 Time(s) |

|
| Description: |
|
| Filesize: |
36.92 KB |
| Viewed: |
1618 Time(s) |

|
|
|
| Back to top |
|
 |
sterpstra
Joined: 27 May 2008 Posts: 33 Location: So Cal
|
Posted: Thu Sep 18, 2008 5:52 pm Post subject: |
|
|
| Quote: | Okay, here's what I've come up with. First, my Nagios and Cacti instances both sit on the same box, so the wrapper script that returns data from nagiostats is run locally. If your Nagios instance sits elsewhere, you'll have to retool this a bit.
To use, first place the attached script in your cacti scripts directory. Second, alter the following section of the script to fit your Nagios configuration:
|
I installed all of this but no go... CMD partial error in the Cacti logs... So I did the following:
- append the Data Input with /usr/bin/perl and still not working
- checked script runs OK via command line, script runs fine, results are expected.
Not sure where to go from this point....
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Mon Sep 22, 2008 1:22 pm Post subject: |
|
|
| sterpstra wrote: | | Quote: | Okay, here's what I've come up with. First, my Nagios and Cacti instances both sit on the same box, so the wrapper script that returns data from nagiostats is run locally. If your Nagios instance sits elsewhere, you'll have to retool this a bit.
To use, first place the attached script in your cacti scripts directory. Second, alter the following section of the script to fit your Nagios configuration:
|
I installed all of this but no go... CMD partial error in the Cacti logs... So I did the following:
- append the Data Input with /usr/bin/perl and still not working
- checked script runs OK via command line, script runs fine, results are expected.
Not sure where to go from this point.... |
Is there any more detail in the cacti log?
|
|
| Back to top |
|
 |
sterpstra
Joined: 27 May 2008 Posts: 33 Location: So Cal
|
Posted: Mon Sep 22, 2008 1:24 pm Post subject: |
|
|
| Unfortunately, no...
|
|
| Back to top |
|
 |
crazyfrog
Joined: 28 Mar 2008 Posts: 9
|
Posted: Wed Sep 24, 2008 10:49 pm Post subject: |
|
|
Got the same error. Script via command line works:
./nagiostats_parse.pl SVCCOUNT
NUMSERVICES:110 NUMSVCOK:103 NUMSVCWARN:3 NUMSVCUNKN:0 NUMSVCCRIT:4
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Thu Sep 25, 2008 1:09 pm Post subject: |
|
|
| I'm stumped on this one. I'm not sure what that error message indicates. Are you both on version 0.8.7b? Can you paste the errors in their entirety?
|
|
| Back to top |
|
 |
sterpstra
Joined: 27 May 2008 Posts: 33 Location: So Cal
|
Posted: Thu Sep 25, 2008 1:25 pm Post subject: |
|
|
I ran Cacti in Debug logging mode... Shows the full command with the same result, which is a "U" like it's processing the "Die" portion of the script. Run the script manually, no problems...
| Quote: |
09/25/2008 11:20:05 AM - CMDPHP: Poller[0] Host[1] DS[1654] WARNING: Result from CMD not valid. Partial Result:
|
|
|
| Back to top |
|
 |
crony
Joined: 30 Jul 2008 Posts: 8
|
Posted: Thu Sep 25, 2008 1:39 pm Post subject: |
|
|
| sterpstra wrote: | I ran Cacti in Debug logging mode... Shows the full command with the same result, which is a "U" like it's processing the "Die" portion of the script. Run the script manually, no problems...
| Quote: |
09/25/2008 11:20:05 AM - CMDPHP: Poller[0] Host[1] DS[1654] WARNING: Result from CMD not valid. Partial Result:
|
|
The source code contains:
| Code: | | cacti_log("Host[$host_id] DS[$data_source] WARNING: Result from CMD not valid. Partial Result: " . substr($output, 0, $strout), $print_data_to_stdout); |
which means it should be printing out the results from the poller in the error message. In this case it appears to be returning nothing. So either the script isn't being run, or the results are lost in translation somewhere. The script is definitely located in <path_cacti>/scripts with the executable bits set? If you prefaced the command with /usr/bin/perl that probably wouldn't matter, but it's a shot in the dark.
|
|
| Back to top |
|
 |
sterpstra
Joined: 27 May 2008 Posts: 33 Location: So Cal
|
Posted: Thu Sep 25, 2008 3:06 pm Post subject: |
|
|
| Tried that, no go... Same results either way.
|
|
| Back to top |
|
 |
crazyfrog
Joined: 28 Mar 2008 Posts: 9
|
Posted: Thu Sep 25, 2008 3:19 pm Post subject: |
|
|
Maybe a userrights issue?
Cacti and Nagios running from different users.
|
|
| Back to top |
|
 |
|