Page 2 of 2

Re: Monitoring MSExchangeIS

Posted: Sun Aug 19, 2012 6:52 pm
by jsmurphy
Are you typing it exactly as su-nagios? Because if so you are missing the necessary spaces it should be su - nagios

Though it is weird that it would even execute without the spaces it shouldn't recognize that as a command. Is there even a user called nagios? if you do an ls -l on /usr/local/nagios/bin who owns the files?

On a related note: I hate shell script checks :lol:.

Re: Monitoring MSExchangeIS

Posted: Tue Aug 21, 2012 12:57 pm
by alceryes
Yup, the nagios user exists. I still can't 'su - nagios' though.

-rwxrwxr-- 1 nagios nagios 592488 2010-05-05 14:54 nagios
-rwxrwxr-- 1 nagios nagios 46772 2010-05-05 14:54 nagiostats
-rwxr-xr-- 1 nagios nagios 26436 2010-11-26 09:39 npcd
-rwxr-xr-- 1 nagios nagios 13764 2010-11-26 09:39 npcdmod.o
-rwxrwxr-x 1 nagios nagios 116674 2012-07-17 17:49 nrpe

Re: Monitoring MSExchangeIS

Posted: Tue Aug 21, 2012 6:18 pm
by jsmurphy
If you vi /etc/passwd is the nagios users shell set to /bin/false (the shell is the last field)? If it is change it to /bin/bash, then attempt to su again.

Re: Monitoring MSExchangeIS

Posted: Thu Aug 23, 2012 12:28 pm
by alceryes
The last line was set to /bin/false. I changed it to /bin/bash but still can't 'su - nagios'. Tried rebooting. The command executes (no error) but a whoami still shows root. Here is how the passwd file looks now.

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
landscape:x:102:105::/var/lib/landscape:/bin/false
bind:x:103:108::/var/cache/bind:/bin/false
roshan:x:1000:1000:Roshan Shiwcharran,,,:/home/roshan:/bin/bash
nagios:x:105:116::/var/lib/nagios:/bin/false
sshd:x:106:65534::/var/run/sshd:/usr/sbin/nologin
postfix:x:104:114::/var/spool/postfix:/bin/false
ntop:x:107:117::/var/lib/ntop:/bin/false
snmp:x:108:65534::/var/lib/snmp:/bin/bash

Re: Monitoring MSExchangeIS

Posted: Thu Aug 23, 2012 7:45 pm
by jsmurphy
It's still bin false? Or did you change it back to bin false? Or did the reboot change it back to bin false?
nagios:x:105:116::/var/lib/nagios:/bin/false
You shouldn't need to reboot after changing the users default shell at any rate. If you have a valid shell I'm not sure what else would cause that behaviour, what distro are you using? It smells suspiciously like Ubuntu.

You could also try "chsh -s /bin/bash nagios" which is another way of changing the default shell.

Re: Monitoring MSExchangeIS

Posted: Wed Sep 05, 2012 1:03 pm
by alceryes
Sorry for the late reply, I was on vaca.
Okay, I am able to run the command as nagios now (I was modifying the wrong line) and it runs fine. So it's just when the Nagios server runs it that it messes up. Maybe there's something wrong with my command.cfg lines -

define command{
command_name check_exchange_webmail
command_line /usr/local/nagios/libexec/check_exchange_webmail.sh -H $HOSTADDRESS$
}

...or my windows.cfg -

define service{
use generic-service
host_name [server name]
service_description STORE and WEBMAIL
check_command check_exchange_webmail
}

Re: Monitoring MSExchangeIS

Posted: Wed Sep 05, 2012 7:00 pm
by jsmurphy
I was about to give up all hope, then I realised that you have a -H switch in your commands.cfg... yet there's no -H in the instructions on nagios exchange just the macro for the host address. Remove the -H from your config and then see how you go?

Re: Monitoring MSExchangeIS

Posted: Tue Sep 18, 2012 11:07 am
by alceryes
You are THE MAN!!!!!!
Removing -H works! Thank you, thank you, thank you!!!!!

Re: Monitoring MSExchangeIS

Posted: Tue Sep 18, 2012 5:03 pm
by jsmurphy
Well we got there eventually :D glad that solved your problem!