NPC Nagios Plugin - manual fixes

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
piegtas
Posts: 1
Joined: Thu Feb 15, 2007 6:50 am

NPC Nagios Plugin - manual fixes

Post by piegtas »

Hi all!

I recently installed NPC plugin and found some inconveniences that I have fixed.

First of all, if inserter.o broker get disconnected (by timeout or whatever) from the mysql server, nagios daemon will get broken.

To fix this, you must set mysql option RECONNECT to ON after the connection is made.
This is the patch:

-----------------
--- inserter-orig.c Thu Feb 15 08:54:52 2007
+++ inserter.c Thu Feb 15 08:58:46 2007
@@ -125,6 +125,7 @@
{
char error[2048];
time_t current_time;
+ my_bool reconnect= 1;

/* save our handle */
inserter_module_handle=handle;
@@ -145,6 +146,7 @@
write_to_logs_and_console(error,NSLOG_INFO_MESSAGE,TRUE);
} else {

+ mysql_options(&mysql, MYSQL_OPT_RECONNECT, (char *)&reconnect);
write_to_logs_and_console("nagios-db: inserter locked into db",NSLOG_INFO_MESSAGE,TRUE);

/* do startup routine after the point when nagios loads its retention file */

-----------------

If you use fruity-1.0.r2_1, you need to use this patch to fix some issues adding the broker:

----------------
--- main-orig.php Thu Feb 15 09:00:22 2007
+++ main.php Wed Feb 14 20:29:25 2007
@@ -55,7 +55,7 @@
}
}
else if($_POST['request'] == "module_add") {
- if(!strlen(trim($_GET['module_line']))) {
+ if(!strlen(trim($_POST['module_line']))) {
$status_msg = "Broker module line cannot be blank.";
}
else {
----------------


If anyone has the missing files from the plugin (hostsLists.php, hostGroups.php, etc) please post it here.

It will be very nice to see a new release, including the fixes and new features.

Best regards
mbergevoet
Posts: 2
Joined: Thu Jul 12, 2007 6:56 am

Post by mbergevoet »

Hello All,

I need some help with NPC, perhaps this is covered in other NPC post, if so please provide me the link since i have not found anything. thanks
-------
I have followed all instructions in the readme document.
Installed the Cacti plugins, followed instructions in the readme from NPC but for some reason i do not see a active link between Nagios and Cacti.

When i look in Cacti under Settings->NPC i see :

Code: Select all

Nagios Command File Path
The path to nagios.cmd
I have filled in /usr/local/nagios/etc/ since that is the location where my nagios.cfg file is located.

When i see under "devices" and open a host you have the option:

Code: Select all

Nagios Host Mapping
Select the Nagios host that maps to this host.
This gives you a dropdown box , but i have only 1 option : none

Under the Tab NPC i also do not see the hosts from nagios.
Somewhere down the route it seems that there is no connection.

Can somebody help me with this ?
If i need to present more details please say so.

Thank you
Cacti Version - 0.8.6j
Plugin Architecture - 1.1
Poller Type - CMD.php
Server Info - Linux 2.6.20-16-server
Web Server - Apache/2.2.3 (Ubuntu) mod_ldap_userdir/1.1.11 PHP/5.2.1
PHP - 5.2.1
PHP Extensions - zip, xmlwriter, libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, session, SimpleXML, sockets, soap, SPL, shmop, standard, Reflection, posix, mime_magic, mbstring, json, iconv, hash, gettext, ftp, filter, exif, dom, dba, date, ctype, calendar, bz2, bcmath, zlib, pcre, openssl, xmlreader, apache2handler, gd, mysql, mysqli, PDO, pdo_mysql, snmp
MySQL - 5.0.38-Ubuntu_0ubuntu1-log
RRDTool - 1.2.15
SNMP - 5.2.3
Plugins
  • Thresholds (thold - v0.3.4)
    npc - v0.1
    Network Tools (tools - v0.2)
    Host Info (hostinfo - v0.1)
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests