Nagios and Cacti Integration

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

conwayg2
Posts: 2
Joined: Wed May 25, 2005 10:11 am
Location: Birmingham UK

Nagios and Cacti Integration

Post by conwayg2 »

All,

I am currently implementing a central Nagios system to monitor approximately 60 linux/aix servers and then approximately 50+(possibly as many as 300) Windows servers with the Windows OS' running Windows 2000 and Windows 2003 Standard to Enterprise.

I have got Nagios carrying out all the monitoring but would like Cacti to use the performance data it is generating. Is there a way for Cacti to act on the performance data that is being logged to a file or for Nagios to use a named pipe to feed data directly into Cacti?

TIA.

Gavin
bloodrayne
Cacti User
Posts: 53
Joined: Mon Nov 29, 2004 11:43 am

Post by bloodrayne »

The only check in nagios that i know that exist for cacti is:

check_mrtg

but i can't explain you how it works...
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

You can't "feed" data into cacti. Cacti is designed to poll it.

That being said, you could have Nagios "feed" the data into files and cacti pick it up.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
conwayg2
Posts: 2
Joined: Wed May 25, 2005 10:11 am
Location: Birmingham UK

Post by conwayg2 »

rony wrote:You can't "feed" data into cacti. Cacti is designed to poll it.

That being said, you could have Nagios "feed" the data into files and cacti pick it up.
Rony,

Thanks for the prompt reply. As Nagios uses both a configurable and standard way of storing it's performance data

http://nagios.sourceforge.net/docs/2_0/ ... e_template

http://nagios.sourceforge.net/docs/2_0/ ... e_template

Are you aware of any existing Cacti script that is able to poll these performance files and then plot it accordingly.

Thanks,

Gavin
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I'm extremely familar with Nagios.. :)

No, I don't know of any such scripts. But I would suggest checking out the Scripts and Addons section of these forums.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
capboy118
Posts: 18
Joined: Mon Dec 13, 2004 10:09 am

Side by Side

Post by capboy118 »

This is something I would like to do as well. I was about to start testing Nagios but of course things came up and i haven't had time to play with it. Is there any issues running them on the same server? Anyone know of a write-up that talk about installing them both? I would be interested in any information about using them together - shoot me a mail. toddtowles[~at~]brookshires.com

-Todd
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

No issues running them together. Other than watching that you don't kill the system.. :)

I had a number of installations running Nagios and Cacti number 300+ nodes monitored. And the only problem I had, before switching to cactid, was high loads durning cacti polling.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
MagnaChef
Cacti User
Posts: 164
Joined: Tue Nov 25, 2003 3:58 pm
Location: Buffalo, NY

Post by MagnaChef »

I know that Big Brother (and HOBBIT?) use LARRD to gather the data that is being displayed for that test and puts it in an RRD, and generates the graph to go inside that test page.

...other than that, it seems like you'll need to write a script to parse data files and stick the data in an RRD. To do this from another machine is to have a link to those cfgfiles on a webserver and use curl in the script to get the data. This is not the best way, but is a good way to get it done - in a duct tape sort of way :wink:
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

Nagios - Cacti integration

Post by Cornfed »

(please forgive the randomness, I'm thinking out loud)

Someone help me out if I am wrong. I haven't worked with cacti in a while. The polling that's done, is really only to feed the rrd files.

Nagios uses plugins to get status data from nodes it monitors. I would assume that there is a way to write a "wrapper" (probably in perl) for the plugins.

Nagios calls the plugin
The plugin gets data
The plugin stuffs the data into an rrd file
The plugin reports to nagios the status data

So your service command might be "cacti_wrapper!check_http!myhost.rrd".

I guess the big trick is to find out how to put that data into the rrd file.

As long as the rrd files get updated, you don't need to have cacti poll. It's just going to display what's in the file. How that data gets there doesn't matter.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Could do it the other way around... :)

Cacti polls, and stores the data. Plugin for Nagios gets the RRD file and returns the last value to Nagios... :)
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

Post by Cornfed »

rony wrote:Could do it the other way around... :)

Cacti polls, and stores the data. Plugin for Nagios gets the RRD file and returns the last value to Nagios... :)
That's true. Nagios also supports passive checks, so you can have cacti tell nagios the status.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Correct, you could have a script that runs right after the poller that would push the data, via passive checks to nagios.

Which, probably would be the easiest and less taxing way to do this.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
jad
Posts: 2
Joined: Fri Jun 03, 2005 10:08 am

Post by jad »

I am also interested in doing this. It seems to me that there are 4 ways this could be done.

1. Cacti does the monitoring and somehow sends the data to nagios via passive checks

2. Cacti does the monitoring and nagios reads the rrd files with a plugin

3. Nagios does the monitoring and sends the data to an external file that cacti reads with some kind of data input script

4. Nagios does the monitoring and puts the data directly into the rrd files

I would be interested to hear what people think are the pros and cons of these options.

It concerns me that I will end up with some things monitored by nagios, some by cacti and it will all get a bit confusing.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

1. Cacti does the monitoring and somehow sends the data to nagios via passive checks
I think this is the best option, from the stand point of not having Nagios work overtime to poll the data. Depending on check times, and intervals, this could be an issue. But, this option would allow you to run the cacti poller, then have a script that would run right after the poller. This script would read a configuration file, or something, and then would submit passive checks to the Nagios Command Pipe. This way, you don't have nagios and the poller competing for processor, at least as much as they would in other senarios.

Plus, the only complication with this method is the configuration of the passive services and what cacti metrics are passed to nagios. The script would read the database, get the rrd file, read the value, format it and submit it to nagios.

I would suggest that the configration be easy. What I mean by that, you would have the host (same on both systems), the service, the Cacti DS_ID and the Cacti DS value. The DS value, would have to support some sort of calculation syntax, so that you could do simple calculations, IE, percent. Then the script would use the Cacti DS ID to look up the RRD file path, then call RRD, retrieve the values, process the defined calculations and finally submit the passive check to Nagios.

Not that I haven't thought about this in the past.. :D
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

3. Nagios does the monitoring and sends the data to an external file that cacti reads with some kind of data input script
4. Nagios does the monitoring and puts the data directly into the rrd files
Not a good option, because of the way service and host checks work in Nagios. You can't even be sure that it will check it with in the typical 60 seconds. To much is unknown concerning the interval that you are polling.
2. Cacti does the monitoring and nagios reads the rrd files with a plugin
More doable, but again, you would have nagios hitting the RRD file every minute or so, this does not scale well. :(
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests