Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #2272] Debian Base Installation and External Commands won't work (still or again) #851

Closed
icinga-migration opened this issue Jan 18, 2012 · 12 comments

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/2272

Created by aswen on 2012-01-18 12:19:38 +00:00

Assignee: formorer
Status: Closed (closed on 2012-05-05 12:06:35 +00:00)
Target Version: (none)
Last Update: 2012-05-05 12:06:35 +00:00 (in Redmine)


Hi,
Please have a look at Issue 629. It was closed after part of the paste of part of the README.Debian file.
Yet, version 1.6.1 still seems to have some problems when on Debian with an ext cmd file.
here's what I have:
Debian 6.0.3, icinga 161 + icinga-idoutils, icinga-phpapi (all from backports)
followed instructions in README file to enable external_commands and override dpkg defaults on external commands, resulting in this dir listing in /var/lib/icinga/

drwxr-x--x 4 nagios nagios 4.0K Jan 18 11:23 .
drwxr-xr-x 35 root root 4.0K Jan 17 12:14 ..
srwxr-xr-x 1 nagios nagios 0 Jan 17 16:49 ido.sock
rw------ 1 nagios www-data 11K Jan 18 11:23 retention.dat

drwx-s-- 2 nagios www-data 4.0K Jan 18 12:49 rw
drwxr-x--- 3 nagios nagios 4.0K Dec 6 10:20 spool

with this in place icinga stops immediately after starting up the daemon (it looks like this when done from cmd line:
/usr/sbin/icinga /etc/icinga/icinga.cfg

Icinga 1.6.1
Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-02-2011
License: GPL

Icinga 1.6.1 starting... (PID=23496)
Local time is Wed Jan 18 13:06:41 CET 2012

so, I thought I had to manually create the fifo (
mknod -m 660 /var/lib/icinga/rw/icinga.cmd p
chown nagios:www-data /var/lib/icinga/rw/icinga.cmd
and here he is:
prw-rw---- 1 nagios www-data 0 Jan 18 13:10 /var/lib/icinga/rw/icinga.cmd

however, when I start icinga from cmdline it starts and keeps running. but the initscript has a function called check_named_pipe that greps the command_file var from cfgfile and the start function removes this file before launching the daemon.

This way icinga can never run with a command file.

this bug could be solved in a few ways:

  1. extend the code in the init script check_cmdfile and start functions to also take into account the check_external_commands setting and leave the cmd file untouched when it's 1.
  2. extend the code even further by also creating the cmd file itself and set propper perms when check_external_commands=1
  3. add some lines to the readme file explaining one has to modify the init script.

Kind regards, Alex

PS: I will attached a diff when I changed and tested the init script.

Attachments

  • icinga_init.diff aswen - 2012-01-18 13:52:18 +00:00 - icinga init.d script diff
  • icinga_init aswen - 2012-01-18 13:52:18 +00:00 - resulting script to be saved as /etc/init.d/icinga
  • icinga.log aswen - 2012-01-18 14:22:46 +00:00
  • icinga.cfg aswen - 2012-01-18 14:22:46 +00:00
  • icinga.bash-x aswen - 2012-01-18 14:28:03 +00:00 - output of
  • icinga.bash-x aswen - 2012-01-18 14:36:00 +00:00 - output of bash -x /etc/init.d/icinga start (with a cmd file in place)
@icinga-migration
Copy link
Author

Updated by formorer on 2012-01-18 13:46:51 +00:00

  • Status changed from New to Feedback
  • Priority changed from Normal to Low

aswen wrote:

Hi,
Please have a look at Issue 629. It was closed after part of the paste of part of the README.Debian file.
Yet, version 1.6.1 still seems to have some problems when on Debian with an ext cmd file.
here's what I have:
Debian 6.0.3, icinga 161 + icinga-idoutils, icinga-phpapi (all from backports)
followed instructions in README file to enable external_commands and override dpkg defaults on external commands, resulting in this dir listing in /var/lib/icinga/
drwxr-x--x 4 nagios nagios 4.0K Jan 18 11:23 .
drwxr-xr-x 35 root root 4.0K Jan 17 12:14 ..
srwxr-xr-x 1 nagios nagios 0 Jan 17 16:49 ido.sock
rw------ 1 nagios www-data 11K Jan 18 11:23 retention.dat
drwx-s-- 2 nagios www-data 4.0K Jan 18 12:49 rw
drwxr-x--- 3 nagios nagios 4.0K Dec 6 10:20 spool

with this in place icinga stops immediately after starting up the daemon (it looks like this when done from cmd line:
/usr/sbin/icinga /etc/icinga/icinga.cfg

Icinga 1.6.1
Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-02-2011
License: GPL

Icinga 1.6.1 starting... (PID=23496)
Local time is Wed Jan 18 13:06:41 CET 2012

so, I thought I had to manually create the fifo (
mknod -m 660 /var/lib/icinga/rw/icinga.cmd p
chown nagios:www-data /var/lib/icinga/rw/icinga.cmd
and here he is:
prw-rw---- 1 nagios www-data 0 Jan 18 13:10 /var/lib/icinga/rw/icinga.cmd

however, when I start icinga from cmdline it starts and keeps running. but the initscript has a function called check_named_pipe that greps the command_file var from cfgfile and the start function removes this file before launching the daemon.

This way icinga can never run with a command file.

this bug could be solved in a few ways:

  1. extend the code in the init script check_cmdfile and start functions to also take into account the check_external_commands setting and leave the cmd file untouched when it's 1.
    The file gets created by icinga itself therefore all leftovers after a unclean (!) shutdown get removed.

And it works as documented:

sed -i -e 's/check_external_commands=0/check_external_commands=1/' /etc/icinga/icinga.cfg
root@hawking:# dpkg-statoverride --update --add nagios www-data 2710 /var/lib/icinga/rw
root@hawking:
# dpkg-statoverride --update --add nagios nagios 751 /var/lib/icinga

invoke-rc.d icinga start
Starting icinga monitoring daemon: icinga.

invoke-rc.d icinga restart
Restarting icinga monitoring daemon: icinga
.
ls -l /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 nagios www-data 0 Jan 18 13:45 /var/lib/icinga/rw/icinga.cmd

ls -l /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 nagios www-data 0 Jan 18 13:43 /var/lib/icinga/rw/icinga.cmd

works without problems.

Alex

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 13:52:18 +00:00

  • File added icinga_init.diff
  • File added icinga_init

as promised attached the diff of /etc/init.d/icinga

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 14:14:52 +00:00

formorer wrote:

And it works as documented:

1st of: thanks for your quick reply!

but it is not working here teh same way as on your system with the packages I installed (from debian squeeze backports):

please have a look at this:
root@host:/var/log/icinga# cp /tmp/icinga /etc/init.d/icinga
root@host:/var/log/icinga# egrep "check_external_commands|command_file" /etc/icinga/icinga.cfg
check_external_commands=1
command_file=/var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 nagios www-data 0 Jan 18 14:48 /var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# /usr/sbin/dpkg-statoverride --list /var/lib/icinga
nagios nagios 751 /var/lib/icinga
root@host:/var/log/icinga# /usr/sbin/dpkg-statoverride --list /var/lib/icinga/rw
nagios www-data 2710 /var/lib/icinga/rw
root@host:/var/log/icinga# /etc/init.d/icinga stop
Stopping icinga monitoring daemon: icinga
.
root@host:/var/log/icinga# /etc/init.d/icinga start
Starting icinga monitoring daemon: icingaroot@nl14s0008-vm7:/var/log/icinga#
root@host:/var/log/icinga# ps axf|grep icinga
28015 pts/0 S+ 0:00 \_ grep icinga
9156 ? Ss 0:00 /usr/sbin/ido2db -c /etc/icinga/ido2db.cfg
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
ls: cannot access /var/lib/icinga/rw/icinga.cmd: No such file or directory
root@host:/var/log/icinga# dpkg -l icinga\*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description

**+-===
ii icinga 1.6.1-2bpo60+1 host and network monitoring system - metapackage
ii icinga-cgi 1.6.1-2
bpo60+1 host and network monitoring system - CGI scripts
ii icinga-common 1.6.1-2bpo60+1 host and network monitoring system - support files
ii icinga-core 1.6.1-2
bpo60+1 host and network monitoring system - core files
un icinga-dbg (no description available)
ii icinga-doc 1.6.1-2bpo60+1 host and network monitoring system - documentation
ii icinga-idoutils 1.6.1-2
bpo60+1 host and network monitoring system - icinga-dataobjects support
ii icinga-phpapi 1.0.2-2 host and network monitoring system - PHP API

I don't see what I am doing wrong then...
btw: I got here following the manual https://wiki.icinga.org/display/howtos/Setting+up+Icinga+Web+on+Debian
which states: Note: If using packages, use these configure params instead to stay more fhs compliant
./configure --with-api-cmd-file=/var/lib/icinga/rw/icinga.cmd --with-conf-dir=/etc/icinga-web --with-log-dir=/var/log/icinga-web --with-cache-dir=/var/cache/icinga-web

however, we need to be able to send commands to icinga anyway.

best regards
Alex

@icinga-migration
Copy link
Author

Updated by formorer on 2012-01-18 14:18:30 +00:00

aswen wrote:

formorer wrote:
> And it works as documented:

1st of: thanks for your quick reply!

but it is not working here teh same way as on your system with the packages I installed (from debian squeeze backports):

please have a look at this:
root@host:/var/log/icinga# cp /tmp/icinga /etc/init.d/icinga
root@host:/var/log/icinga# egrep "check_external_commands|command_file" /etc/icinga/icinga.cfg
check_external_commands=1
command_file=/var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 nagios www-data 0 Jan 18 14:48 /var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# /usr/sbin/dpkg-statoverride --list /var/lib/icinga
nagios nagios 751 /var/lib/icinga
root@host:/var/log/icinga# /usr/sbin/dpkg-statoverride --list /var/lib/icinga/rw
nagios www-data 2710 /var/lib/icinga/rw
root@host:/var/log/icinga# /etc/init.d/icinga stop
Stopping icinga monitoring daemon: icinga
.
root@host:/var/log/icinga# /etc/init.d/icinga start
bash -x /etc/init.d/icinga start please.

And icinga.log if there is something in it, and attach icinga.cfg

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 14:22:46 +00:00

  • File added icinga.log
  • File added icinga.cfg

formorer wrote:

And icinga.log if there is something in it, and attach icinga.cfg

only last lines of icinga.log. icinga warns that there are no services: I know, will do that once I got the rest ok. currently icinga starts without them (with my patched init script)

@icinga-migration
Copy link
Author

Updated by formorer on 2012-01-18 14:26:57 +00:00

aswen wrote:

formorer wrote:
> And icinga.log if there is something in it, and attach icinga.cfg

only last lines of icinga.log. icinga warns that there are no services: I know, will do that once I got the rest ok. currently icinga starts without them (with my patched init script)

and the bash -x?

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 14:28:03 +00:00

  • File added icinga.bash-x

formorer wrote:

bash -x /etc/init.d/icinga start please.
saw that only later...
here you go

bash -x /etc/init.d/icinga start

@icinga-migration
Copy link
Author

Updated by formorer on 2012-01-18 14:30:13 +00:00

aswen wrote:

formorer wrote:
> bash -x /etc/init.d/icinga start please.
saw that only later...
here you go

bash -x /etc/init.d/icinga start
... and the output of that command?

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 14:36:00 +00:00

  • File added icinga.bash-x

formorer wrote:

> bash -x /etc/init.d/icinga start
... and the output of that command?
that was the attachment
however, I ran that bash x /etc/init.d/icinga start with no cmd file in place, not very exiting ;)

so, I did this afterwards, may be more interesting:
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
ls: cannot access /var/lib/icinga/rw/icinga.cmd: No such file or directory
root@host:/var/log/icinga# mknod -m 660 /var/lib/icinga/rw/icinga.cmd p
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 root www-data 0 Jan 18 15:31 /var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# bash -x /etc/init.d/icinga start

please have a look at the new attached file

@icinga-migration
Copy link
Author

Updated by formorer on 2012-01-18 14:41:26 +00:00

aswen wrote:

formorer wrote:
> > bash -x /etc/init.d/icinga start
> ... and the output of that command?
that was the attachment
however, I ran that bash x /etc/init.d/icinga start with no cmd file in place, not very exiting ;)

so, I did this afterwards, may be more interesting:
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
ls: cannot access /var/lib/icinga/rw/icinga.cmd: No such file or directory
root@host:/var/log/icinga# mknod -m 660 /var/lib/icinga/rw/icinga.cmd p
root@host:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd
prw-rw---- 1 root www-data 0 Jan 18 15:31 /var/lib/icinga/rw/icinga.cmd
root@host:/var/log/icinga# bash -x /etc/init.d/icinga start
I really don't understand why you are doing any mknods. Icinga creates the socket, nothing else.

/var/lib/icinga should look like this:

ls -l /var/lib/icinga/
total 32
rw------ 1 nagios www-data 10563 Jan 18 13:45 retention.dat
drwx-s-- 2 nagios www-data 4096 Jan 18 13:45 rw
drwxr-x--- 3 nagios nagios 4096 Jan 18 13:37 spool
rw-rw-r- 1 nagios www-data 11266 Jan 18 14:40 status.dat

please have a look at the new attached file
The logfile looks exactly as expected.

@icinga-migration
Copy link
Author

Updated by aswen on 2012-01-18 14:54:48 +00:00

formorer wrote:

I really don't understand why you are doing any mknods. Icinga creates the socket, nothing else.

because in my case, icinga is not creating any socket (I assume you mean de icinga cmd file with socket) and is not running either after a start command when no icinga.cmd is in place.

/var/lib/icinga should look like this:

ls -l /var/lib/icinga/
total 32
rw------ 1 nagios www-data 10563 Jan 18 13:45 retention.dat
drwx-s-- 2 nagios www-data 4096 Jan 18 13:45 rw
drwxr-x--- 3 nagios nagios 4096 Jan 18 13:37 spool
rw-rw-r- 1 nagios www-data 11266 Jan 18 14:40 status.dat

> please have a look at the new attached file
The logfile looks exactly as expected.

ls -la /var/run/icinga/icinga.pid -- -d /etc/icinga/icinga.cfg
roothost:/var/log/icinga# ls -la /var/lib/icinga/rw/icinga.cmd@
ls: cannot access /var/lib/icinga/rw/icinga.cmd: No such file or directory
roothost:/var/log/icinga# ls -la /var/lib/icinga/@
total 28
drwxr-x--x 4 nagios nagios 4096 Jan 18 15:45 .
drwxr-xr-x 35 root root 4096 Jan 17 12:14 ..
-rw-rw-r-- 1 nagios nagios 0 Jan 18 15:45 idomod.tmp
srwxr-xr-x 1 nagios nagios 0 Jan 17 16:49 ido.sock
-rw------- 1 nagios www-data 11153 Jan 18 15:45 retention.dat
drwx--s--- 2 nagios www-data 4096 Jan 18 15:45 rw
drwxr-x--- 3 nagios nagios 4096 Dec 6 10:20 spool
roothost:/var/log/icinga# ps axf|grep icinga@
29386 pts/0 S+ 0:00 \_ grep icinga
@ 9156 ? Ss 0:00 /usr/sbin/ido2db -c /etc/icinga/ido2db.cfg@

this is what is in my /etc/init.d/icinga file
@ if ! check_named_pipe; then@
@ log_action_msg "named pipe exists - removing"@
@ rm -f $icingapipe@
@ fi@

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2012-05-05 12:06:35 +00:00

  • Status changed from Feedback to Closed

debian bug, should be solved with a new revision

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant