Page 1 of 1
Nagios user
Posted: Mon Nov 25, 2013 1:12 pm
by rentsys
What user does Nagios run check scripts with? I set up a device to auto log in when I ssh into it in order to run a check script. It works when I ssh into the Nagios server.
Code: Select all
[root@Juno ~]# /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
OK : All FC ports have normal status (ready or offline)
But when I run the command that I set up in Nagios it doesn't work.
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
OUTPUT: Could not connect to InServ 10.160.1.32
Edit.
I logged into
then I ran the command again and got this
Code: Select all
[nagios@Juno libexec]$ /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
/usr/local/nagios/libexec/check_3par.pl: line 248: /tmp/3par_check_port_fc.10.160.1.32.out1: Permission denied
Could not connect to InServ 10.160.1.32
Do I have to add the nagios user to the sudoers file?
Re: Nagios user
Posted: Mon Nov 25, 2013 3:13 pm
by mmiltchev
The reason the nagios user cannot write to the file "check_port_fc" is because the check was originally run as root on the command line and the file's owner became root, which the nagios user cannot modify. If you get rid of the file "check_port_fc" and recreate it with the nagios user, your permission problem should be resolved.
or alternatively, you could change the permissions of the plugin,
Code: Select all
chown nagios:nagios /usr/local/nagios/libexec/check_3par.pl
Re: Nagios user
Posted: Mon Nov 25, 2013 3:32 pm
by rentsys
That fixed that part, thanks. But now I have a different problem. The check needs to have it so that the nagios user can auto login to the device. I can do it with the root user but it doesn't generate the rd_rsa.pub when I do it with the nagios user. Here is the instruction page, on page four it says how to configure the nagios to auto login.
http://exchange.nagios.org/components/c ... 0&cf_id=29
Edit.
Alright so I set up auto log in for nagios and ran the check script. It worked! But when I ran it again it failed.
Code: Select all
[nagios@Juno .ssh]$ /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
OK : All FC ports have normal status (ready or offline)
[nagios@Juno .ssh]$ /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
/usr/local/nagios/libexec/check_3par.pl: line 248: /tmp/3par_check_port_fc.10.160.1.32.out1: Permission denied
Could not connect to InServ 10.160.1.32
[nagios@Juno .ssh]$ /usr/local/nagios/libexec/check_3par.pl 10.160.1.32 3paradm check_port_fc
/usr/local/nagios/libexec/check_3par.pl: line 248: /tmp/3par_check_port_fc.10.160.1.32.out1: Permission denied
Could not connect to InServ 10.160.1.32
Edit.
Alright, so I kept testing it and it seems that if I run the script while I'm root user I can run the script as the nagios user. But if I am in Service Management and I click the Test Check Command and type in the Ip address. Then it says
could not connect to InServ 10.160.1.32
.
Re: Nagios user
Posted: Mon Nov 25, 2013 4:48 pm
by mmiltchev
Testing the check with the "Test Check Command" button is an inaccurate way of testing the check as it runs the check as the apache user. Testing from the CLI is the preferred method and will give you much more accurate results of what the check will actually return. If I were you, I would ignore the "Test Check Command" button and check from the CLI only.
Re: Nagios user
Posted: Tue Apr 01, 2014 4:01 pm
by rentsys
this can be closed