Nagios Plugin for Cacti (NPC) 2.0.4
Moderators: Developers, Moderators
and adding:
$params['data'] = stripslashes($params['data'])
seems to fix it. However, then I end up with another error:
It then fails to open plugins/npc/address_cache.php for writing.. which seems reasonable.. should the web server really be able to write a php file in the web directory?
Seems like a security problem waiting to happen.
I made the npc directory writable by the web server and that seemed to fix it, but not sure it's a good fix.
I imported 4 hosts, one of which already existed. for the one that existed, I got the following in my browser:
Notice: undefined offset 2 in /var/www/cacti/plugins/ on line 74.
That appears to be this line in sync.php:
preg_match("/Success - new device-id: \((.*)\)/", $status[2], $matches);
Don't think it's harmful probably, but may want to prepend that line with @?
Anyway, with all that said, great plugin! Nice work indeed.
$params['data'] = stripslashes($params['data'])
seems to fix it. However, then I end up with another error:
It then fails to open plugins/npc/address_cache.php for writing.. which seems reasonable.. should the web server really be able to write a php file in the web directory?
Seems like a security problem waiting to happen.
I made the npc directory writable by the web server and that seemed to fix it, but not sure it's a good fix.
I imported 4 hosts, one of which already existed. for the one that existed, I got the following in my browser:
Notice: undefined offset 2 in /var/www/cacti/plugins/ on line 74.
That appears to be this line in sync.php:
preg_match("/Success - new device-id: \((.*)\)/", $status[2], $matches);
Don't think it's harmful probably, but may want to prepend that line with @?
Anyway, with all that said, great plugin! Nice work indeed.
1) Would it be possible to have it set the default snmp community (and other settings) from the cacti settings page when creating a new host? Or, I'm not sure if nagios supplies this info via ndo2db, but even better would be if you could take it from some custom variable in the nagios host definition or parent like _snmp_community.
2) How hard would it be to make it so that when you import a host, it automatically starts graphing the graph templates associated with the host template?
Where I'm going with this is that I'd like to try automating the host imports.. I already have a tool that creates nagios hosts.. if I could modify it to call your code to import the host into cacti and get it started graphing, that would be sweet
Thanks
2) How hard would it be to make it so that when you import a host, it automatically starts graphing the graph templates associated with the host template?
Where I'm going with this is that I'd like to try automating the host imports.. I already have a tool that creates nagios hosts.. if I could modify it to call your code to import the host into cacti and get it started graphing, that would be sweet
Thanks
- divagater
- Cacti User
- Posts: 191
- Joined: Wed Nov 17, 2004 5:22 pm
- Location: Chapel Hill, NC.
- Contact:
rmcclain, thanks for all the troubleshooting you have done... exactly what I was looking for from early adopters.
I agree I should not be writing the address cache under the web path. The next alpha release will move the cache file to a safer spot.
The wierd thing with the json issue you were having is that I have never been able to reproduce getting json_decode to fail. However, knowing that is "can" fail under the circumstances you showed is useful and I will have a fix in the next release.
Thanks,
Billy
I agree I should not be writing the address cache under the web path. The next alpha release will move the cache file to a safer spot.
The wierd thing with the json issue you were having is that I have never been able to reproduce getting json_decode to fail. However, knowing that is "can" fail under the circumstances you showed is useful and I will have a fix in the next release.
This suggestion has a lot of merit. The 1st way should not be very difficult. I am not sure about passing custom data through ndo2db but I will check it out.Would it be possible to have it set the default snmp community (and other settings) from the cacti settings page when creating a new host? Or, I'm not sure if nagios supplies this info via ndo2db, but even better would be if you could take it from some custom variable in the nagios host definition or parent like _snmp_community.
On its face this doesn't seem like it should be difficult. It's another good idea and I will see what I can do.How hard would it be to make it so that when you import a host, it automatically starts graphing the graph templates associated with the host template?
Thanks,
Billy
- chrisgapske
- Cacti User
- Posts: 278
- Joined: Tue May 22, 2007 7:56 am
- Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL
-
- Posts: 20
- Joined: Tue Apr 25, 2006 6:08 am
Hello
I didnt't start yet to do a from scrach install
But looking at my log this morning I found this:
--------------------- Init Begin ------------------------
**Unmatched Entries**
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
etc. etc. etc.
in my /etc/inittab
ndo:345:respawn:/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
is this line wrong ?
I didnt't start yet to do a from scrach install
But looking at my log this morning I found this:
--------------------- Init Begin ------------------------
**Unmatched Entries**
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
Id "ndo" respawning too fast: disabled for 5 minutes
etc. etc. etc.
in my /etc/inittab
ndo:345:respawn:/usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
is this line wrong ?
Ubuntu / Cacti 0.8.7g / PIA 2.9
-
- Posts: 20
- Joined: Tue Apr 25, 2006 6:08 am
Ok for the moment I clear the line in /etc/inittab...
I recheck in details all my configs the problem was permissions of the cactiuser in my mysql database...
So now nagios starts and I got outputs in npc tab ... VERY NICE I love it
Juste another thing I see in my logs is that:
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/contacts\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/timeperiods\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/templates\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/localhost\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/tel14\.cfg''
Is that normal... What should I do ?
I recheck in details all my configs the problem was permissions of the cactiuser in my mysql database...
So now nagios starts and I got outputs in npc tab ... VERY NICE I love it
Juste another thing I see in my logs is that:
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/contacts\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/timeperiods\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/templates\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/localhost\.cfg''
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/tel14\.cfg''
Is that normal... What should I do ?
Ubuntu / Cacti 0.8.7g / PIA 2.9
- divagater
- Cacti User
- Posts: 191
- Joined: Wed Nov 17, 2004 5:22 pm
- Location: Chapel Hill, NC.
- Contact:
I am intending on making Nagios configurable through NPC some time in the future. It would be a 2.x version. In addition to having a file based configuration system Nagios configs are extremely complicated with lots of inter dependencies which makes web based config challenging. My goal is to get the UI stable on 2.0.0 and then tackle this.chrisgapske wrote:Any Ideas for my problem I have 400 Cacti hosts but new Nagios install ..
Anyway ideas on going the other way. ?
However, getting just hosts from Cacti to Nagios will be less complicated. I will look at that for 2.1.0 as 2.0.0 is frozen for new features.
Cheers,
Billy
- chrisgapske
- Cacti User
- Posts: 278
- Joined: Tue May 22, 2007 7:56 am
- Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL
divagater wrote:I am intending on making Nagios configurable through NPC some time in the future. It would be a 2.x version. In addition to having a file based configuration system Nagios configs are extremely complicated with lots of inter dependencies which makes web based config challenging. My goal is to get the UI stable on 2.0.0 and then tackle this.chrisgapske wrote:Any Ideas for my problem I have 400 Cacti hosts but new Nagios install ..
Anyway ideas on going the other way. ?
However, getting just hosts from Cacti to Nagios will be less complicated. I will look at that for 2.1.0 as 2.0.0 is frozen for new features.
Cheers,
Billy
Great to know thank you.
- divagater
- Cacti User
- Posts: 191
- Joined: Wed Nov 17, 2004 5:22 pm
- Location: Chapel Hill, NC.
- Contact:
I am very glad that you were able to figure out the issue and get ndo2db populating the tables.miky_willis wrote:So now nagios starts and I got outputs in npc tab ... VERY NICE I love it
Juste another thing I see in my logs is that:
Mar 31 13:41:02 manage ndo2db: Error: mysql_query() failed for 'INSERT INTO npc_configfilevariables SET instance_id='1', configfile_id='4', varname='cfg_file', varvalue='/usr/local/nagios/etc/objects/contacts\.cfg''
Is that normal... What should I do ?
This error in coming from ndo2db failing on some inserts. As long as the only failed inserts you see are for the npc_configfilevariables table then don't sweat it right now. I don't use that table yet. Now that Ethan has Nagios 3 released I suspect we will see some work on ndo2db to get it out of beta.
This is really great stuff. But I wonder if you can give me a procedure to take the performance data from npc/nagios and make graphs out of it?! Because I'm really new to cacti and I don't really understand how I would do that.
I've pressed the Data Input Method button in NPC on some hosts and services and they show up in Cacti but I don't really know how to go from there.
And the Import Hosts in N2C says "You must choose a template" but I don't see where I do that. So if you could give me some instructions or point me towards some documentation, that'd be great.
Otherwise, kudos on a really great plugin. Installation was straighforward even for a total cacti newbie such as me.
I've pressed the Data Input Method button in NPC on some hosts and services and they show up in Cacti but I don't really know how to go from there.
And the Import Hosts in N2C says "You must choose a template" but I don't see where I do that. So if you could give me some instructions or point me towards some documentation, that'd be great.
Otherwise, kudos on a really great plugin. Installation was straighforward even for a total cacti newbie such as me.
More Graph to HOST
Hello, can i add more than one graph to Service or Host ???
SNX.
SNX.
- divagater
- Cacti User
- Posts: 191
- Joined: Wed Nov 17, 2004 5:22 pm
- Location: Chapel Hill, NC.
- Contact:
Re: More Graph to HOST
Not yet but it is my intention to support that going forward.daludinov wrote:Hello, can i add more than one graph to Service or Host ???
I need to come up with a user story on how this would work. Maybe you have some thoughts. For instance the map graph screen would need to show all the currently mapped graphs. You would then be able to add and delete as needed. However, the part I am unsure of is how and when to display the graphs back to the end user. Right now you click the graph icon and the mapped graph opens in a floating window. Should all mapped graphs be displayed in the window or maybe just a graph that was chosen as "default". I think I like the latter. Maybe the action to see all mapped graphs exists only on the service state information screen, or via a right click context menu.
So thinking this through I like the idea that clicking the graph icon only opens the default graph. Additional graphs can be accessed from the detail information screen or via a right click on the row. Right now a right click displays a list of all available commands. I would use submenus so a right click would display 'Commands' and 'Graphs' with the actual items being nested.
Thanks for the comment and look for this in 2.1.0.
Cheers,
Billy
- divagater
- Cacti User
- Posts: 191
- Joined: Wed Nov 17, 2004 5:22 pm
- Location: Chapel Hill, NC.
- Contact:
Hi Dag. I will try to touch on your questions.
I am not an rtfm kinda guy but in this case you will need to read a little. For now assume that each data input method will have its own data and graph template.
Look here: http://www.cacti.net/downloads/docs/htm ... _TEMPLATES for adding a data template. In the data template there is a Data Input Method drop down box. Choose one of the data input methods you added from NPC.
Next, look here http://www.cacti.net/downloads/docs/htm ... lates.html for the graph template creation.
The last step is to go to devices, click the appropriate device, and click the 'Create Graphs for this Host' link.
Cheers,
Billy
In Cacti to get a graph you need to complete 4 steps. A Data Input Method, a Data Template, a Graph Template, and lastly add the graph to a host. What I have done is automate the 1st step for you by auto creating a data input method with all the correct parameters required for Cacti to poll the perf data from NPC. The Data Template step could be automated as well but I would have to make some assumptions. The Graph Template step is going to be different for every user. Its you deciding what the graph should look like.Dag wrote:I wonder if you can give me a procedure to take the performance data from npc/nagios and make graphs out of it?
I've pressed the Data Input Method button in NPC on some hosts and services and they show up in Cacti but I don't really know how to go from there.
I am not an rtfm kinda guy but in this case you will need to read a little. For now assume that each data input method will have its own data and graph template.
Look here: http://www.cacti.net/downloads/docs/htm ... _TEMPLATES for adding a data template. In the data template there is a Data Input Method drop down box. Choose one of the data input methods you added from NPC.
Next, look here http://www.cacti.net/downloads/docs/htm ... lates.html for the graph template creation.
The last step is to go to devices, click the appropriate device, and click the 'Create Graphs for this Host' link.
In the N2C window you will see 3 columns. The last column is the 'Template' column. Click in a cell in the template column and a drop down select box will appear that will allow you to choose a template for that host group. Its a little tricky but I have not been able to figure out how to make the select box stay rendered all the time.And the Import Hosts in N2C says "You must choose a template" but I don't see where I do that. So if you could give me some instructions or point me towards some documentation, that'd be great. .
Cheers,
Billy
-
- Posts: 3
- Joined: Tue Apr 01, 2008 3:29 pm
Can't see NPC
I have installed cacti, nagios, and now NPC. when I go to the tab I get
// Add some properties to the params array npc.params.npc_portlet_refresh = 60; npc.params.npc_date_format = "Y-m-d"; npc.params.npc_time_format = "h:i:sA"; npc.params.npc_nagios_url = "http://nagiosip/nagios/"; npc.params.userName = "admin"; var ExtState = Ext.decode('
Any ideas why? Is there a config file that I am missing? I have ndo2db going into cacti db, but the interface won't show up. ideas?
// Add some properties to the params array npc.params.npc_portlet_refresh = 60; npc.params.npc_date_format = "Y-m-d"; npc.params.npc_time_format = "h:i:sA"; npc.params.npc_nagios_url = "http://nagiosip/nagios/"; npc.params.userName = "admin"; var ExtState = Ext.decode('
Any ideas why? Is there a config file that I am missing? I have ndo2db going into cacti db, but the interface won't show up. ideas?
Who is online
Users browsing this forum: No registered users and 2 guests