2007-05-22 Jason Schoonover Unnoc daemon was added in 1.0.9 Unnoc Daemon ************************************************************************* ** ** THE DAEMON MODE IS CURRENTLY CONSIDERED 'BETA' ** ** Even though daemon mode is just as reliable as the cron wrapper, it ** is still very new to Unnoc and it hasn't had a chance to prove itself ** longterm. ** ** I have been running Unnoc 1.0.9 in daemon mode since 2007-05-01, and it ** is very reliable. I just havent had a chance to test it long term. ** ** Testers needed! Specifically, on all different OSs. ** ************************************************************************* New to 1.0.9, Unnoc now has a daemon mode. Daemon mode is faster and just as reliable as the cron wrapper counter part. It is particularly useful for installations that have greater that 200 hosts and have high load average issues. If you have many hosts but your load average / CPU usage is not heavily used, then you do not need to run the daemon mode. 1. Installation 2. Configuration 3. Running 4. Problems ********************************************************************** IMPORTANT: PLEASE DO NOT RUN IN BOTH CRONTAB MODE AND DAEMON MODE! If you choose daemon mode, please comment out the unnoc-cron.pl line from your crontab. ********************************************************************** 1. Installation Configuration is very easy, simply install the rc.d script located in the scripts/ directory. Currently, there are two methods two start the daemon. CHOOSE ONLY ONE METHOD Method 1 Init.d: Debian / Ubuntu: # cp scripts/init.d/debian/unnocd /etc/init.d/unnocd # update-rc.d unnocd defaults 90 15 Fedora / Redhat: # cp scripts/init.d/fedora/unnocd /etc/init.d/unnocd # chkconfig --add unnocd # chkconfig unnocd on Method 2 Daemontools Or, if you wish, you can use Dj. Bernstein's daemon tools to start/stop unnocd (this assumese /service/ as root location of the service directory): # mkdir /service/unnocd # cp scripts/daemontools/run /service/unnocd IMPORTANT: Make sure you update the $webroot directory in /etc/init.d/unnocd or the /service/unnocd/run file to match your installation. 2. Configuration It is recommended to run the unnocd.pl daemon as a separate user, other than root. You can specify the user in the unnoc.conf config file, the options of interest are: unnoc.conf: daemon_user = unnoc daemon_group = users Make sure that the daemon_user has read/write access to the entire webroot directory. If you do not specify any users in the unnoc.conf file, then unnocd will not try and switch users. Instead it will run as the current user whoever started it. So you may simply start the daemon as a user if you wish. It is also okay to run unnocd.pl as the root user. There is one other option of interest unnoc.conf: daemon_concurrent = 8 This is the number of concurrent daemon processes that are launched in succession. This means that the unnoc daemon will try and check this many hosts at the same time, and generally means that this is the most amount of unnocd.pl processes that will run on the unnoc host at any given time. This number will probably be different for every host, it is dependent on CPU speed, disk I/O, network speed and so forth. 3. Running / Reloading / HUP For the Init.d method, simply start with 'start': # /etc/init.d/unnocd start For the daemontools method: # svc -u /service/unnocd Daemon mode reads hosts as it starts, so if you make any changes to the unnoc.conf file, then you need to reload with a HUP signal: For the Init.d method, issue a "reload": # /etc/init.d/unnocd reload For the daemontools method: # svc -h /service/unnocd 4. Problems - If you start the daemon mode for the first time and receive an error like this: Died at line 52 in /usr/lib/perl/5.8/Encode.pm (sub (eval)): Can't locate Encode/ConfigLocal.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl /usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 .) at /usr/lib/perl/5.8/Encode.pm line 52. You can fix it by running the following command as root: # enc2xs -C I believe it's a very uncommon error. - Inaccurate latency times. Latency host times are going to be off slightly if you are using updown method of ping. Daemon mode forks one process per host, so this means that it could be checking anywhere from 1-10 hosts at the same time. Also, if you are running the daemon in non-privleged mode, then the latency times will be off even more. This is actually due to Net::Ping::External not pulling the ping times from the ping utility, but instead it is actually doing its own timing internally using Time::Hires. As this will give you a low ping time (generally in the millisecond range), it does not count for the shell load, and the load of ping into memory, which can be extremely fast, but your ping times might be off by anywhere from 10ms - 400ms. If you do not care about this, then you can keep running in unprivileged mode. If accurate ping times are important, then run the daemon as root. This will use Net::Ping which has a much more efficient means. vim:tw=72:wm=1