Re: [Nagios-devel] Nagios 4: Registering object relationships in
Re: [Nagios-devel] Nagios 4: Registering object relationships in
--Apple-Mail-36--774755181
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
Hi Andreas,
On 7 Jan 2013, at 19:27, Andreas Ericsson wrote:
> On 01/07/2013 05:31 PM, Ton Voon wrote:
>> I'll create a testcase for you, if that helps.
>=20
> That would be most helpful, yes.
The existing test suite has been broken, so please find patches attached =
that fix the 610cgistatus.t test. I've also included the necessary test =
files to demonstrate the problem. Invoke with "perl t/610cgistatus.t"
Patch explanations:
* t/etc/nagios.cfg - file locations used to be based on current working =
directory, but now appear to be relative to the nagios.cfg directory. =
Rather than change Nagios, I've just changed the test data. Note: if =
Nagios is left, this may affect some systems that use relative =
directories, but I only know of tests that utilise this
* cgi/cgiutils.c - I've added the object_cache_file to be read from the =
main nagios.cfg file. This is required for testing purposes, but also if =
not used, the object_cache_file will just use DEFAULT_OBJECT_CACHE_FILE, =
which I guess is undesirable
* t/610cgistatus.t - I've updated some existing tests because the =
strings in the HTML output are different (because of the pagination =
feature). I've also added in the last test which uses the status.cgi as =
the "second" user, which demonstrates this problem
* t/var/objects.cache - this is the definition file used to support the =
test. Note the normalhostcontactgroup is defined correctly for the host =
and the service, yet the status.cgi fails with a permission failure =
message. If you add the "second" user as a normal contact, then this =
works. This says to me that the contactgroups are not expanded correctly =
for the CGIs
My original patch, reattached, is not ideal but fixes the problem, so I =
present it as a way to show why the current behaviour is wrong. I'm sure =
there's a better solution, probably some other "do expansion of object =
relationships" call that should be invoked instead, but I can't quite =
understand the C-fu magic that is going on with the new configuration =
code!
Ton
--Apple-Mail-36--774755181
Content-Disposition: attachment;
filename=nagios_test_fixes_and_show_contactgroup_problem.patch
Content-Type: application/octet-stream;
name="nagios_test_fixes_and_show_contactgroup_problem.patch"
Content-Transfer-Encoding: 7bit
diff -ur nagios-4.0.20130107/cgi/cgiutils.c nagios-4.0.20130107.cgis/cgi/cgiutils.c
--- nagios-4.0.20130107/cgi/cgiutils.c 2013-01-08 04:57:06.000000000 +0000
+++ nagios-4.0.20130107.cgis/cgi/cgiutils.c 2013-01-08 04:54:59.000000000 +0000
@@ -461,6 +464,13 @@
strip(log_file);
}
+ else if(strstr(input, "object_cache_file=") == input) {
+ temp_buffer = strtok(input, "=");
+ temp_buffer = strtok(NULL, "\x0");
+ //printf("Reading object_cache_file=%s\n",temp_buffer);
+ object_cache_file = nspath_absolute(temp_buffer, config_file_dir);
+ }
+
else if(strstr(input, "log_archive_path=") == input) {
temp_buffer = strtok(input, "=");
temp_buffer = strtok(NULL, "\n");
diff -ur nagios-4.0.20130107/t/etc/nagios.cfg nagios-4.0.20130107.cgis/t/etc/nagios.cfg
--- nagios-4.0.20130107/t/etc/nagios.cfg 2012-12-24 15:29:55.000000000 +0000
+++ nagios-4.0.20130107.cgis/t/etc/nagios.cfg 2013-01-08 04:06:34.000000000 +0000
@@ -1,20 +1,20 @@
-log_file=var/nagios.log
+log_file=../var/nagios.log
cfg_file=minimal.cfg
-object_cache_file=var/objects.cache
-precached_object_file=var/objects.precache
+object_cache_file=../var/objects.cache
+precached_object_file=../var/objects.precache
resource_file=etc/resource.cfg
-status_file=var/status.dat
+status_file=../var/status.dat
status_update_interval=10
nagios_user=nagios
nagios_group=nagios
check_external_commands=1
-command_file=var/rw/nagios.cmd
-lock_file=var/nagios.lock
-temp_file=var/nagios.tmp
+command_file=../var/rw/nagios.cmd
+lock_file=../var/nagios.lock
+temp_file=../var/nagios.tmp
temp_path=/tmp
event_broker_options=-1
log_rotation_method=d
-log_archive_path=var/archives
+log_ar
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: tonvoon@gmail.com