Page 1 of 1

Installing with user other than Nagios

Posted: Tue Jul 08, 2014 9:52 am
by Deaner
Hey All,

I am attempting to setup Nagios to monitor the network at a remote site, but cannot use the username nagios because it is already being used. The head quarters for the company already has monitoring using nagios, but I do not have access to this account. Is there anyway to make nagios use another user account (nagios2 or whatever) and home directory for monitoring?

Thank you,
Deaner

Re: Installing with user other than Nagios

Posted: Tue Jul 08, 2014 10:04 am
by slansing
You'd need to change this in the source a great number of places, as well as in the compile chain. Is there not another system you can install on that does not have this user? You should also just be able to install there unless there is already a nagios installation, the nagios user does not generally have a password, and in most cases you would not want a password on it.

Re: Installing with user other than Nagios

Posted: Tue Jul 08, 2014 10:22 am
by Deaner
The company uses LDAP authentication so every machine sees a nagios account even though it's not locally on the machine. I have tried logging in using the nagios account with no password but was met with "permission denied". I am able to su to nagios, but /home/nagios is undefined.

Frustrating to say the least.

**DISCLAIMER** I am not very well versed in Linux Administration, I only do what is necessary on a day to day basis. If I say something stupid please feel free to correct me.

Re: Installing with user other than Nagios

Posted: Tue Jul 08, 2014 5:26 pm
by abrist
What agent are you using? You may be able to bypass the issue by specifying a different user for the agent to run as. Even better, if they are linux systems, you could just use the good old check_by_ssh with any valid remote user. Be aware that check_by_ssh requires ssh keys!

Re: Installing with user other than Nagios

Posted: Tue Jul 08, 2014 5:26 pm
by slansing
Silly me, you can give it a configure flag pre-compile, take a look at the configure script section here:

http://people.virginia.edu/~rtg2t/nagio ... lling.html
Run the Configure Script

Run the configure script to initialize variables and create a Makefile as follows...(the last two options: --with-command-xxx are optional, but needed if you want to issue external commands)

./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup

Replace prefix with the installation directory that you created in the step above (default is /usr/local/nagios)
Replace cgiurl with the actual url you will be using to access the CGIs (default is /nagios/cgi-bin). Do NOT append a slash at the end of the url.
Replace htmurl with the actual url you will be using to access the HTML for the main interface and documentation (default is /nagios/)
Replace someuser with the name of a user on your system that will be used for setting permissions on the installed files (default is nagios)
Replace somegroup with the name of a group on your system that will be used for setting permissions on the installed files (default is nagios)
Replace cmdgroup with the name of the group running the web server (default is nagios, in the example above it was nagcmd). This will allow group members (i.e. your web server) to be able to submit external commands to Nagios.

Re: Installing with user other than Nagios

Posted: Thu Jul 10, 2014 9:24 am
by Deaner
Thanks for the advice guys, I'm going to be trying these out today if I get the opportunity. I'll check back in here with the results!

Re: Installing with user other than Nagios

Posted: Thu Jul 10, 2014 10:17 am
by Deaner
slansing wrote:Silly me, you can give it a configure flag pre-compile, take a look at the configure script section here:

http://people.virginia.edu/~rtg2t/nagio ... lling.html
Run the Configure Script

Run the configure script to initialize variables and create a Makefile as follows...(the last two options: --with-command-xxx are optional, but needed if you want to issue external commands)

./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup

Replace prefix with the installation directory that you created in the step above (default is /usr/local/nagios)
Replace cgiurl with the actual url you will be using to access the CGIs (default is /nagios/cgi-bin). Do NOT append a slash at the end of the url.
Replace htmurl with the actual url you will be using to access the HTML for the main interface and documentation (default is /nagios/)
Replace someuser with the name of a user on your system that will be used for setting permissions on the installed files (default is nagios)
Replace somegroup with the name of a group on your system that will be used for setting permissions on the installed files (default is nagios)
Replace cmdgroup with the name of the group running the web server (default is nagios, in the example above it was nagcmd). This will allow group members (i.e. your web server) to be able to submit external commands to Nagios.
This one seemed easiest, so that's what I went with and voila! It worked.

Can you explain a couple of things to me though? I used MY account and MY group for running this, will that cause problems? And what is the difference in cmdgroup and group?

Thank you for this advice. Saved me a world of effort getting this to run.

Re: Installing with user other than Nagios

Posted: Fri Jul 11, 2014 10:30 am
by slansing
The nagcmd group allows you to submit external commands through the web interface, such as re-scheduling checks, etc... if this is working you should be okay. You should be sure to add apache to your group as that will be required in some cases. You are going to need to make sure that the plugins you are using are able to be executed by your user, or group.

Re: Installing with user other than Nagios

Posted: Fri Jul 11, 2014 11:13 am
by Deaner
Thank you slansling, I will look out for group issues and will probably create a dedicated account once I get the basics figured out.

Re: Installing with user other than Nagios

Posted: Fri Jul 11, 2014 12:27 pm
by sreinhardt
Sounds great, let us know if you have issues!