Page 1 of 3

Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 9:45 am
by PCrossan
Hello

Nagios issue:

We are using nagios XI and have come across a issue with monitoring tomcat6 - the command that gets run is check_nrpe!check_init_service!-a 'tomcat6'

With the error message You need root privileges to run this script

Tomcat6 is not a public facing for us we use it as a servlet running locally on the linux box. We use apache as the main public web server and this gets picked up fine by using the same check..

Is the above command correct for this set-up of tomcat or do we look to monitor this a different way?

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 10:16 am
by slansing
Does the plugin script itself have the correct permissions to be executed? It seems that is the problem you are running into, I also assume by "it as a servlet running locally on the linux box" you mean locally on the remote linux box? If it is locally on the Nagios server you do not need to call the plugin with check_nrpe.

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 10:53 am
by PCrossan
Hi,

yes its running locally on the remote linux machine and the scripts have permissions that have been given
so for check_nrpe its

-rwxrwxr-x 1 nagios nagios 75444 Aug 22 2012 check_nrpe
and for check_init_service its
-rwxrwxr-x 1 nagios nagios

check_init_service
should these been chmod to root

thanks

Paul

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 10:59 am
by abrist
You may have to add a sudoers rules, set the suid execute bit, or both. See the following document:
http://assets.nagios.com/downloads/nagi ... utions.pdf

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:05 am
by sreinhardt
Are you able to run the command correctly by ssh-ing into the remote machine and using the same command? Where did you find the plugin?

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:20 am
by bkelly
Hi

I've done a change to the permissions to the sudoers files to add the rights as suggested

/etc/sudoers

nagios ALL = NOPASSWD:/usr/local/nrdp/plugins/AIX/check_init_service
nagios ALL = NOPASSWD:/usr/local/nagios/libexec/check_nrpe

Nagios still shows the same error message as before :-(

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:26 am
by PCrossan
Haven't been able to run the command via ssh as it appears to use two commands as shown in the first post and this is just the standard monitor service command via the nagiosXI wizard

permission have been set in /etc/sudoers

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:30 am
by abrist
You could try setting the execute bit. Is this system running selinux?

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:31 am
by abrist
Additionally, you may want to look at the script as it may be calling a system binary that you need to set a sudoers rule for. Have you tried the "check_procs" plugin?

Re: Tomcat6 You need root priviledges to run this script

Posted: Thu Mar 21, 2013 11:44 am
by bkelly
Hi

Thanks for the reply - I will need to check all this as this is the appliance downloaded straight from nagios website so we thought it was all set to go?

As far as I can see its disabled

SELinux status: disabled