Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Nagios script request - nagiostats
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
knobdy
Cacti User


Joined: 28 Sep 2005
Posts: 495

PostPosted: Tue Nov 14, 2006 12:47 pm    Post subject: Nagios script request - nagiostats Reply with quote

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

PostPosted: Fri Dec 07, 2007 1:25 pm    Post subject: Re: Nagios script request - nagiostats Reply with quote

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

PostPosted: Wed Jul 30, 2008 11:16 am    Post subject: Reply with quote

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

PostPosted: Thu Jul 31, 2008 1:36 pm    Post subject: Reply with 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:

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]



cacti_graph_template_nagios_-_host_latency_and_execution_time.xml
 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)


cacti_graph_template_nagios_-_external_command_buffers.xml
 Description:
External command buffer usage.

Download
 Filename:  cacti_graph_template_nagios_-_external_command_buffers.xml
 Filesize:  11.34 KB
 Downloaded:  72 Time(s)


cacti_graph_template_nagios_-_cached_checks_5_min.xml
 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)


cacti_graph_template_nagios_-_active_checks_5_min.xml
 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)


nagiostats_parse.pl
 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

PostPosted: Thu Jul 31, 2008 1:38 pm    Post subject: Reply with quote

few more..


cacti_graph_template_nagios_-_hosts_summary.xml
 Description:
Host status summary.

Download
 Filename:  cacti_graph_template_nagios_-_hosts_summary.xml
 Filesize:  16.46 KB
 Downloaded:  79 Time(s)


cacti_graph_template_nagios_-_services_summary.xml
 Description:
Service status summary.

Download
 Filename:  cacti_graph_template_nagios_-_services_summary.xml
 Filesize:  19.96 KB
 Downloaded:  77 Time(s)


cacti_graph_template_nagios_-_service_check_latency_and_execution_time.xml
 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

PostPosted: Thu Jul 31, 2008 1:41 pm    Post subject: Reply with quote

and some examples..


services_summary.png
 Description:
 Filesize:  30.38 KB
 Viewed:  1618 Time(s)

services_summary.png



service_latency.png
 Description:
 Filesize:  36.92 KB
 Viewed:  1618 Time(s)

service_latency.png


Back to top
sterpstra



Joined: 27 May 2008
Posts: 33
Location: So Cal

PostPosted: Thu Sep 18, 2008 5:52 pm    Post subject: Reply with quote

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

PostPosted: Mon Sep 22, 2008 1:22 pm    Post subject: Reply with quote

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

PostPosted: Mon Sep 22, 2008 1:24 pm    Post subject: Reply with quote

Unfortunately, no...
Back to top
crazyfrog



Joined: 28 Mar 2008
Posts: 9

PostPosted: Wed Sep 24, 2008 10:49 pm    Post subject: Reply with quote

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

PostPosted: Thu Sep 25, 2008 1:09 pm    Post subject: Reply with quote

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

PostPosted: Thu Sep 25, 2008 1:25 pm    Post subject: Reply with quote

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

PostPosted: Thu Sep 25, 2008 1:39 pm    Post subject: Reply with quote

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

PostPosted: Thu Sep 25, 2008 3:06 pm    Post subject: Reply with quote

Tried that, no go... Same results either way.
Back to top
crazyfrog



Joined: 28 Mar 2008
Posts: 9

PostPosted: Thu Sep 25, 2008 3:19 pm    Post subject: Reply with quote

Maybe a userrights issue?

Cacti and Nagios running from different users.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group