Cacti sending data to nagios/NPC

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

linebacker2 wrote:Billy,

It works!! I check my php installation on my windows box again since the problem is on the NPC host. So I checked and one of the two issues potentially solved the problem.

1) I had to enable pdo support for mysql.
2) I uninstalled Pear support.

Thanks Billy for all the help!!

Only question now is what would the NPC settings look like for since this is a remote Cacti host interacting with another remote Nagios host?
Thats great and is a first as far as I know :) So I am fairly certain that N2C which syncs hosts from Nagios to Cacti and auto creating data input methods from services will not work. In each of those cases I call command line scripts and use hard coded unix paths.

But, more importantly writing to the Nagios command file should work just fine as I use fopen and fwrite which are surely portable. So what you need to do is create a cifs (samba) share on your nagios box and share the /path/to/nagios/var/rw directory. Then mount the share in windows.

Under Console -> Settings -> NPC check to enable remote commands and then add the path to the command file. It will be something like:

x:\path\to\mount\nagios.cmd

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
juangose
Posts: 12
Joined: Thu Jul 07, 2005 2:15 pm

Post by juangose »

I put the version NCP 2.0.4, but I have the mapping host with none yet. I dont now if I have to install another application in my windows server. I only install the cacti installer for windows and the ncp 2.0.4.

Thanks

Att. juangose
juangose
Posts: 12
Joined: Thu Jul 07, 2005 2:15 pm

Post by juangose »

This is my configuration in NCP
Attachments
npc.JPG
npc.JPG (131.4 KiB) Viewed 12727 times
linebacker2
Posts: 28
Joined: Fri May 08, 2009 11:34 am

Post by linebacker2 »

Hi Billy,

I created a samba share as you suggested.
enable remote commands under Console -> Settings -> NPC
add the path to the command file.

I still see the Nagios status displayed as "OFF"
Shouldn't that show up as "ON"

Is there something else that needs to be done?

Thanks again!
juangose
Posts: 12
Joined: Thu Jul 07, 2005 2:15 pm

Post by juangose »

I have npc plugins in cacti but my server is windows. I dont know how integrate nagios with the pluggins? How I install nagios in window server?
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

linebacker2 wrote:Hi Billy,

I created a samba share as you suggested.
enable remote commands under Console -> Settings -> NPC
add the path to the command file.

I still see the Nagios status displayed as "OFF"
Shouldn't that show up as "ON"

Is there something else that needs to be done?

Thanks again!
the nagios status of on or off simply comes from reading the database. If ndo2db were not running and the nagios process record was not updated for some certain amount of time nagios would display as off. So really in order to get it to show as on you need nagios and ndo2db running.

Check your npc_programstatus table:

Code: Select all

mysql> select * from npc_programstatus \G
*************************** 1. row ***************************
              programstatus_id: 528
                   instance_id: 1
            status_update_time: 2009-07-24 09:32:23
            program_start_time: 2009-07-24 00:01:03
              program_end_time: 0000-00-00 00:00:00
          is_currently_running: 1
                    process_id: 3768
                   daemon_mode: 1
            last_command_check: 2009-07-24 09:32:06
             last_log_rotation: 1969-12-31 18:00:00
         notifications_enabled: 1
 active_service_checks_enabled: 1
passive_service_checks_enabled: 1
    active_host_checks_enabled: 1
   passive_host_checks_enabled: 1
        event_handlers_enabled: 1
        flap_detection_enabled: 1
    failure_prediction_enabled: 1
      process_performance_data: 1
             obsess_over_hosts: 0
          obsess_over_services: 0
      modified_host_attributes: 3
   modified_service_attributes: 3
     global_host_event_handler: 
  global_service_event_handler: 
The status_update_time column needs to have been recently updated else NPC will show nagios as off.

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
joseme
Cacti User
Posts: 90
Joined: Fri May 15, 2009 9:36 am

NPC on windows

Post by joseme »

HI:
I installed the NPC plugin on my CACTI (windows 2003 server), and NAGIOS in centOS (there are in two differents boxes),(I see the Nagios web page), but when I try to Installed NDOUTILS I got in the message :"My SQL Library could no t be located), all the rest of cpmpilation is OK. So my question is: do ihave to install mysql in my centos?, because my BD Mysql is in my CACTI Box.

thanks.
ZarayK
Posts: 3
Joined: Wed Apr 29, 2009 4:37 pm

Post by ZarayK »

I can´t see these files: /ndo.sock
/ndo2db.debug
/ndomod.tmp
any idea??

Thanks
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Re: NPC on windows

Post by divagater »

joseme wrote:HI:
I installed the NPC plugin on my CACTI (windows 2003 server), and NAGIOS in centOS (there are in two differents boxes),(I see the Nagios web page), but when I try to Installed NDOUTILS I got in the message :"My SQL Library could no t be located), all the rest of cpmpilation is OK. So my question is: do ihave to install mysql in my centos?, because my BD Mysql is in my CACTI Box.

thanks.
You need to install the mysql development libraries on centos that would be: yum install mysql-devel

Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

ZarayK wrote:I can´t see these files: /ndo.sock
/ndo2db.debug
/ndomod.tmp
any idea??

Thanks
Are you going for the vague award? :) Seriously though I am not sure what your asking. What leads you to believe you should be able to see those files? What steps have you taken and what works and doesn't work?

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
joseme
Cacti User
Posts: 90
Joined: Fri May 15, 2009 9:36 am

Post by joseme »

Hi Divagater:
I got install NDOutils in my centos(thanks for you advice), so i got to connect it to mysql in my windows box (CACTI):

[root@localhost var]# mysql -u cactiuser -p -h 172.31.123.27 cacti
mysql> select host_id,alias,address from npc_hosts;
+---------+------------------------+---------------+
| host_id | alias | address |
+---------+------------------------+---------------+
| 1 | Linksys SRW224P Switch | x.x.x.x |
| 2 | localhost | 127.0.0.1 |
+---------+------------------------+---------------+
2 rows in set (0.01 sec)

But I can not see the NPC working in CACTI, look at the capture:

my nagios.log looks:

[root@localhost var]# tail -f nagios.log
[1250606097] SERVICE ALERT: linksys-srw224p;Uptime;CRITICAL;SOFT;2;(Return code of 127 is out of bounds - plugin may be missing)
[1250606117] Warning: Return code of 127 for check of service 'Port 1 Link Status' on host 'linksys-srw224p' was out of bounds. Make sure the plugin you're trying to run actually exists.
[1250606217] Warning: Return code of 127 for check of service 'Uptime' on host 'linksys-srw224p' was out of bounds. Make sure the plugin you're trying to run actually exists.
[1250606217] SERVICE NOTIFICATION: nagiosadmin;linksys-srw224p;Uptime;CRITICAL;notify-service-by-email;(Return code of 127 is out of bounds - plugin may be missing)
[1250606717] Warning: Return code of 127 for check of service 'Port 1 Link Status' on host 'linksys-srw224p' was out of bounds. Make sure the plugin you're trying to run actually exists.
[1250606817] Warning: Return code of 127 for check of service 'Uptime' on host 'linksys-srw224p' was out of bounds. Make sure the plugin you're trying to run actually exists.
[1250607317] Warning: Return code of 127 for check of service 'Port 1 Link Status' on host 'linksys-srw224p' was out of bounds. Make sure the plugin you're trying to run actually exists.


my configuration in my cacti box is:

Cacti Version 0.8.7d
Plugin Architecture 2.4
Poller Type CMD.php
Server Info Windows NT 5.2
Web Server Microsoft-IIS/6.0
PHP Version 5.2.9
PHP Extensions bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash, iconv, json, odbc, pcre, Reflection, date, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, ISAPI, ldap, mysql, snmp, sockets, SourceGuardian, gd, PDO, pdo_mysql

MySQL Version 5.0.77-community-nt

my question is why (in the capture) Nagios is OFF(in red)?, because my npc_hosts table has data so it means there is connection.

thanks
Attachments
cacti-npc.JPG
cacti-npc.JPG (147.88 KiB) Viewed 12418 times
User avatar
divagater
Cacti User
Posts: 191
Joined: Wed Nov 17, 2004 5:22 pm
Location: Chapel Hill, NC.
Contact:

Post by divagater »

joseme, your nagios logs dont show anything about ndo2db, instead it just says that nagios is trying to execute some plugins but they are not there. Install the nagios plugins and read nagios docs.

Because the nagios status portlet shows notifications, host checks, and service checks enabled we can be sure that your pdo and json support for php are working.

Nagios shows OFF if the npc_programstatus does not have a recent status_update_time. Do a:
select * from npc_programstatus \G
Look at the status_update_time. It should show an update within the last couple minutes if nagios is running and updating things. First get nagios so its actually executing plugins for service checks then in Cacti go to Console -> Settings -> NPC and look at the option called 'Host/Service Config Type'

Cheers,
Billy
[url=http://forums.cacti.net/viewtopic.php?t=26540][b]NPC 2.0.4[/b][/url]
[url=http://trac2.assembla.com/npc][size=75]Trac[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=defect][size=75]Bugs[/size][/url] | [url=http://trac2.assembla.com/npc/newticket?type=enhancement][size=75]Requests[/size][/url]
linebacker2
Posts: 28
Joined: Fri May 08, 2009 11:34 am

Post by linebacker2 »

Divagater,

I checked my npc_programstatus table by doing a "select * from npc_programstatus \G;" on my cacti box. The result was that the nagios process record was not updated as it is showing a previous date. All else works as far as showing me nagios data through the NPC plugin. I can see all my host and there status. In Console->Settings-->NPC-->Host/Service Config Type is set to 1.

With this result the Nagios Status bar shows "Off" and Notifications, Host Checks, and Service show up as "NA". Host Status Summary and Service Status Summary all work.

When I set Host/Service Config Type 0. All of the above show up as "NA"

What can I do to alleviate this?
nullzero7x
Posts: 2
Joined: Sat Sep 19, 2009 10:19 pm
Location: Guatemala

Nagios appears always Off

Post by nullzero7x »

Thanks for this wonderfull plugin, I have just a minor problem that I just cant find how to solve, the nagios process always appears Off, just as the previous 2 or 3 posts, I have checked the npc_programstatus table and the status_update_time is being updated correctly, but this doesnt reflects in the nagios status panel, everything else works fine I have host/services information, comments can be added an so on.

I know that its just a status indicator but it kinds of looks not ready when the process appears off, can somebody help.

regards and keep up the good work.
Attachments
NPC - nagios off.PNG
NPC - nagios off.PNG (125 KiB) Viewed 11975 times
ljernstadt
Posts: 4
Joined: Thu Sep 24, 2009 8:17 am

Same issues, N2C is not show info

Post by ljernstadt »

divagater
I have been working on a new install for about a week and a half now.
We have been running Cacti for about two years and just setup a new environment for both Nagios and Cacti for the integration of the two.

Before we start adding too many devices I would like to get a couple of devices working in both environments.

Here is where I am at.
Nagios appears to be fully operational.
I have not added any devices to Cacti yet as I would like them to be imported from Nagios.

The host I have created show up in the Cacti npc_ tables, but when I go to import them under N2C I get a message "There are no hosts available for import in the selected hostgroup"
I also do not see anything in the templates column?
I have tried several things mentioned over multiple post and verified others.

I have Webex available to me, so when you get a chance I would like to get together.
I see great prospects for us to implement this plug-in.

Thanks
L.J.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests