check_imap Unexpected response

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
tduncan
Posts: 4
Joined: Tue Aug 11, 2015 1:11 pm

check_imap Unexpected response

Post by tduncan »

check_imap


Returns the following warning in the web interface
IMAP WARNING - Unexpected response from host/socket: 220 MYSERVER Microsoft ESMTP MAIL Service ready at Wed, 12 Aug 2015 10:57:43 -0400

But when ran at the command line it returns OK
check_imap -H 10.1.1.1 -e '220 myserver'
IMAP OK - 0.005 second response time on port 143 [220 MYSERVER Microsoft ESMTP MAIL Service ready at Wed, 12 Aug 2015 10:53:58 -0400]|time=0.004699s;;;0.000000;10.000000



MYSERVER.cfg contains...

define service{
use generic-service
host_name MYSERVER
service_description imap
check_command check_imap!-e '220 MYSERVER' -M ok
}


Any help with understanding or fixing this would be great.

Nagios® Core™
Version 3.2.3
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_imap Unexpected response

Post by jolson »

In addition to the service.cfg that you provided, I would like to see your commands.cfg file - typically located at /usr/local/nagios/etc/commands.cfg. The output should look something like this:

Code: Select all

define command {
       command_name                             check_imap
       command_line                             $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
}
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
tduncan
Posts: 4
Joined: Tue Aug 11, 2015 1:11 pm

Re: check_imap Unexpected response

Post by tduncan »

My commands.cfg file looks nothing like that.

cat: /usr/local/nagios/etc/commands.cfg: No such file or directory


cat /etc/nagios3/commands.cfg
###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS
###############################################################################


################################################################################
# NOTIFICATION COMMANDS
################################################################################


# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Tim
e: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n
\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}





################################################################################
# HOST CHECK COMMANDS
################################################################################

# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package

################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################


# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-p
erfdata.out
}


# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOU
TPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
}
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: check_imap Unexpected response

Post by jolson »

Similar to the other thread, we'll need to look through your nagios directory for the command definition:

Code: Select all

grep -A2 -B2 -R command_name.*check_imap /etc/nagios3/
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked