Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 156068

Summary: net-analyzer/nagios-core: /etc/init.d/nagios should set HOME
Product: Gentoo Linux Reporter: Wolfram Schlich (RETIRED) <wschlich>
Component: Current packagesAssignee: Gentoo Netmon project <netmon>
Status: RESOLVED FIXED    
Severity: normal CC: eldad, ks, ramereth
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 172480    

Description Wolfram Schlich (RETIRED) gentoo-dev 2006-11-23 15:22:02 UTC
When /etc/init.d/nagios starts the nagios daemon as user 'nagios',
HOME is kept as /root instead of setting it to, for example, /var/nagios.
See:

$ pgrep -n -u nagios -x nagios | xargs -n 1 -i cat /proc/{}/environ | xargs -0 -n 1 echo | grep '^HOME='

That makes it impossible to use a .my.cnf in ~nagios/ for check_mysql
or other check plugins that could use or even need special config
files in ~nagios/ (check_by_ssh is another example).

Solution:
1. Do not set the home directory of 'nagios' to /dev/null, use /var/nagios, /home/nagios or something else that can be used to put files into.
2. Add "-e HOME=/path/to/nagios/home" to the start-stop-daemon call in /etc/init.d/nagios

I have tried it and it works fine.
Comment 1 Tobias Scherbaum (RETIRED) gentoo-dev 2007-05-08 21:39:01 UTC
Fixed in nagios-core-2.9 and nagios-plugins-1.4.6.