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 Plugin for Cacti 2.0.0b (build 166) released
Goto page Previous  1, 2, 3, ... 13, 14, 15  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General
Author Message
miky_willis



Joined: 25 Apr 2006
Posts: 11

PostPosted: Fri Mar 28, 2008 9:00 am    Post subject: Reply with quote

THANKS A LOT !!

Ok great I use TCP and Nagios starts great

My npc tables appear in cacti database...

Let's see then how to populate them
Back to top
divagater
Cacti User


Joined: 17 Nov 2004
Posts: 101
Location: Chapel Hill, NC.

PostPosted: Fri Mar 28, 2008 9:18 am    Post subject: Reply with quote

If nagios is running and you re-enabled the broker:

broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

And you have the ndo2db daemon running then... you should have some data in your npc_ tables

Let me know how it goes.

~Billy
Back to top
miky_willis



Joined: 25 Apr 2006
Posts: 11

PostPosted: Fri Mar 28, 2008 9:23 am    Post subject: Reply with quote

oh damned... I talk too fast....

with the broker nagios does not starts like before

sorry then.
Back to top
divagater
Cacti User


Joined: 17 Nov 2004
Posts: 101
Location: Chapel Hill, NC.

PostPosted: Fri Mar 28, 2008 12:50 pm    Post subject: Reply with quote

The good news is that I just got this all running on a clean FC8 install without any issues at all. So now the trick is to figure out whats different with your setup.

Here is what I did:

Install the needed mysql stuff
yum install mysql-server mysql mysql-devel

Added nagios user/group
useradd nagios
groupadd nagcmd

Install nagios-3.0
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config

Install nagios-plugins-1.4.11
./configure
make
make install

Install ndoutils-1.4b7
./configure
make
cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp config/ndo2db.cfg /usr/local/nagios/etc
cp config/ndomod.cfg /usr/local/nagios/etc

Configure Nagios and NDO

nagios.cfg add the following line:
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg


ndo2db.cfg:

ndo2db_user=nagios
ndo2db_group=nagios
socket_type=tcp
socket_name=/usr/local/nagios/var/ndo.sock
tcp_port=5668
db_servertype=mysql
db_host=localhost
db_port=3306
db_name=cacti
db_prefix=npc_
db_user=cacti
db_pass=passw0rd
max_timedevents_age=1440
max_systemcommands_age=10080
max_servicechecks_age=10080
max_hostchecks_age=10080
max_eventhandlers_age=44640
debug_level=0
debug_verbosity=1
debug_file=/usr/local/nagios/var/ndo2db.debug
max_debug_file_size=1000000



ndomod.cfg:

instance_name=default
output_type=tcpsocket
output=127.0.0.1
tcp_port=5668
output_buffer_items=5000
buffer_file=/usr/local/nagios/var/ndomod.tmp
file_rotation_interval=14400
file_rotation_timeout=60
reconnect_interval=15
reconnect_warning_interval=15
data_processing_options=-1
config_output_options=2


PHP components:
php-cli-5.2.4-3
php-common-5.2.4-3
php-pdo-5.2.4-3
php-mysql-5.2.4-3
php-ldap-5.2.4-3
php-5.2.4-3

MySQL components:
mysql-devel-5.0.45-6.fc8
mysql-5.0.45-6.fc8
mysql-libs-5.0.45-6.fc8
mysql-server-5.0.45-6.fc8


Check out my configs and double check yours.
Back to top
rmcclain



Joined: 28 Mar 2008
Posts: 9

PostPosted: Fri Mar 28, 2008 2:24 pm    Post subject: Reply with quote

The database is populating now. I had turned on debugging and run ndo2db as root. It then creates the debug file owned by root, and then calls setuid nagios, and is unable to write the debug file. That seemed to be the source of my problems somehow. I fixed that and data started flowing.

But now I have another one.. When I click on a hostgroup and select a template in N2C, nothing happens. Firebug tells me there is one error when I click import:

On ext-all.js, line 24

Invalid flag after regular expression
<b>Warning</b>: Invalid argument supplied for foreach() in <b>/var/www/cacti-0....

Any ideas? Thanks
Back to top
divagater
Cacti User


Joined: 17 Nov 2004
Posts: 101
Location: Chapel Hill, NC.

PostPosted: Fri Mar 28, 2008 2:58 pm    Post subject: Reply with quote

Just to be clear on exactly where it is failing for you. When you click a cell in the template column a drop down select box should render and then the available templates are loaded into the select box via a call to the server.

I attached a screenshot with and without the template selection box rendered. When you click in the template sell does the drop down box get rendered?

Also, to get some better debugging make the following change for me:

Edit plugins/npc/controllers/layout.php

Change the line that looks like this (line 44)
<script type="text/javascript" src="<?php echo $config["url_path"]; ?>plugins/npc/js/ext/ext-all.js"></script>

to this:

<script type="text/javascript" src="<?php echo $config["url_path"]; ?>plugins/npc/js/ext/ext-all-debug.js"></script>

The difference between the 2 lines is that ext-all.js is changed to ext-all-debug.js. This sets up NPC to use a none minimized vresion of EXT. Shoot me the results of a firebug error after that change.

~Billy



template_combobox.png
 Description:
N2C with template selection box rendered
 Filesize:  17.06 KB
 Viewed:  2648 Time(s)

template_combobox.png



no_selection.png
 Description:
n2c without a template selection
 Filesize:  9.61 KB
 Viewed:  2648 Time(s)

no_selection.png


Back to top
colejv



Joined: 19 Mar 2008
Posts: 17

PostPosted: Fri Mar 28, 2008 3:35 pm    Post subject: Reply with quote

I was having issues with no data being displayed, although it was present in the database and in the drop-down box on the devices page, the solution for me was to install the PHP extension pdo_mysql (see hostinfo below)

I seem to be suffering from performance issues but I have not pinpointed them yet, services and hosts never load on the first attempt and what the dashboard displays seems to be hit or miss. I do have a decent sized system (currently 160hosts 261services) so I may have just pushed our hardware too far, I also have not really tuned my configs for nagios 3.0 yet either.

N2C has remained without data blank this may be from the performance issues above.

N2C does not display properly on IE7(Vista) the input button and header is missing just the tab and a horizontal scrollbar display,not that it really matters to me (I thought maybe my 64bit browser was causing a problem so I tried my windows box)

Overall it looks very promising

Quote:
Cacti Version - 0.8.7b
Plugin Architecture - 2.1
Poller Type - Cactid v
Server Info - FreeBSD 6.1-RELEASE-p11
Web Server - Apache/2.2.4 (FreeBSD) mod_ssl/2.2.4 OpenSSL/0.9.7e-p1 DAV/2 PHP/5.2.3 with Suhosin-Patch
PHP - 5.2.3
PHP Extensions - session, Reflection, date, libxml, apache2handler, ctype, pcre, SimpleXML, SPL, dom, filter, hash, iconv, json, mysql, PDO, pdo_sqlite, posix, standard, SQLite, tokenizer, xml, xmlreader, xmlwriter, sockets, snmp, pdo_mysql
MySQL - 5.0.51a-log
RRDTool - 1.2.23
SNMP - 5.3.1
Plugins
    Thresholds (thold - v0.3.9)
    Global Plugin Settings (settings - v0.3)
    Network Tools (tools - v0.2)
    Host Info (hostinfo - v0.2)
    Nagios plugin for Cacti (npc - v2.0.0a)
Back to top
rmcclain



Joined: 28 Mar 2008
Posts: 9

PostPosted: Fri Mar 28, 2008 4:24 pm    Post subject: Reply with quote

It does show the dropdown list, and I select the ucd template. I added the debugging js and have attached a screenshot of the firebug output. Thanks


snapshot1.png
 Description:
 Filesize:  143.73 KB
 Viewed:  2629 Time(s)

snapshot1.png


Back to top
miky_willis



Joined: 25 Apr 2006
Posts: 11

PostPosted: Fri Mar 28, 2008 4:52 pm    Post subject: Reply with quote

Thanks for your step by step divagater !

that's great I will retry and "reverify" all this when I got time perhaps not before monday

have all a nice evening by testing this wonderfull plugin
Back to top
divagater
Cacti User


Joined: 17 Nov 2004
Posts: 101
Location: Chapel Hill, NC.

PostPosted: Fri Mar 28, 2008 6:39 pm    Post subject: Reply with quote

rmcclain, thanks for the screenshot, that helped a lot.

If you don't mind, try to do a sync again selecting the same hostgroup. Only this time in firebug show me the post data for the ajax request by selecting the post tab just to the left of the request tab.

What is happening is that the selected hostgroup is either not being sent to the server at all or there are some special charachters in the hostgroup name that is breaking the json_decode on the server side. Seeing the posted data should get us close to the issue.

Thanks for helping to troubleshoot...

~Billy
Back to top
rmcclain



Joined: 28 Mar 2008
Posts: 9

PostPosted: Fri Mar 28, 2008 9:07 pm    Post subject: Reply with quote

Here is the POST data:

action getHosts
module sync
p_data {"0":{"alias":"Unix Servers","template":"3"}}

Thanks
Back to top
divagater
Cacti User


Joined: 17 Nov 2004
Posts: 101
Location: Chapel Hill, NC.

PostPosted: Sat Mar 29, 2008 7:54 am    Post subject: Reply with quote

Ok, so you are submitting a well formed json string to the server. This puts the problem in 1 of 2 possible places. Either the post data is failing to be read in or json_decode() is failing to decode the json string.

I am working on another alpha release that will include configurable logging using the existing Cacti logging mechanism. The should help greatly with troubleshooting.

In the meantime if you are inclined could you copy the attached file (sync.txt) to npc/controllers/sync.php? I had to call the file sync.txt to get it to attach here. This will overwrite the existing sync.php. I added 3 debugs that will show what was posted and the data string retrieved from the post prior to and after the json_decode(). The debug will be written to /tmp/NPC.debug.

After dropping in the file, attempt to do a sync again and then shoot me the contents of /tmp/NPC.debug. There wont be a lot of data so you could just cat the file and post the contents in a reply.

~Billy



sync.txt
 Description:
sync.php with some debugging added.

Download
 Filename:  sync.txt
 Filesize:  6.14 KB
 Downloaded:  69 Time(s)

Back to top
keefe007



Joined: 23 Sep 2005
Posts: 21

PostPosted: Sun Mar 30, 2008 3:43 pm    Post subject: Reply with quote

Anyone have a guide on how to get this working from scratch if I don't already have nagios installed?
Back to top
rmcclain



Joined: 28 Mar 2008
Posts: 9

PostPosted: Sun Mar 30, 2008 5:29 pm    Post subject: Reply with quote

Here ya go. As you can see, nothing shows up under JSON_DECODE:


POST: Array
(
[module] => sync
[action] => getHosts
[p_data] => {"0":{"alias":"Unix Servers","template":"3"}}
)



DATA: {"0":{"alias":"Unix Servers","template":"3"}}


JSON_DECODE:
Back to top
rmcclain



Joined: 28 Mar 2008
Posts: 9

PostPosted: Sun Mar 30, 2008 5:53 pm    Post subject: Reply with quote

I changed your debug code to fprintf a file instead of echo so I could see if there are any special characters not passing through the shell. I ended up with:

{\"0\":{\"alias\":\"Linux Servers\",\"template\":\"3\"}}

It seems that the json_decode works fine without all the slashes, but returns null with them:

<?php
$data1 = '{"0":{"alias":"Unix Servers","template":"3"}}';
$data2 = '{\"0\":{\"alias\":\"Linux Servers\",\"template\":\"3\"}}';
$arr1 = json_decode($data1);
$arr2 = json_decode($data2);
echo "arr1\n";
print_r($arr1);
echo "arr2\n";
print_r($arr2);
?>

Results in
arr1
stdClass Object
(
[0] => stdClass Object
(
[alias] => Unix Servers
[template] => 3
)

)
arr2
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, ... 13, 14, 15  Next
Page 2 of 15

 



Powered by phpBB © 2001, 2005 phpBB Group