Installing with user other than Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Installing with user other than Nagios

Post 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
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Installing with user other than Nagios

Post 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.
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Installing with user other than Nagios

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Installing with user other than Nagios

Post 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!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Installing with user other than Nagios

Post 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.
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Installing with user other than Nagios

Post 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!
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Installing with user other than Nagios

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Installing with user other than Nagios

Post 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.
Deaner
Posts: 8
Joined: Tue Jul 08, 2014 9:30 am

Re: Installing with user other than Nagios

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Installing with user other than Nagios

Post by sreinhardt »

Sounds great, let us know if you have issues!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked