[Nagiosplug-devel] [ nagiosplug-New Plugins-997991 ] check pop3 server

SourceForge.net noreply at sourceforge.net
Wed Aug 11 04:59:02 CEST 2004


New Plugins item #997991, was opened at 2004-07-26 13:56
Message generated for change (Comment added) made by kosli
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=541465&aid=997991&group_id=29880

Category: C plugin
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Seamus Dean (seamusdean)
Assigned to: Nobody/Anonymous (nobody)
Summary: check pop3 server

Initial Comment:
check_pop3.c is a nagios plugin that check a pop3 
server.
You can specify a username and password to this 
plugin,It will using the username and password to login 
to the pop3 server and see if the server is ok or dead.


----------------------------------------------------------------------

Comment By: KoS (kosli)
Date: 2004-08-11 13:57

Message:
Logged In: YES 
user_id=42372

i've made a perl plugin that checks pop3 AND pop3 with SSL:
it uses the Mail::POP3Client for the connection

cat check_pop3.pl
#!/usr/bin/perl
# POP3/POP3s check script for nagios
use Mail::POP3Client;

$host     = $ARGV[0];
$user     = $ARGV[1];
$password = $ARGV[2];
$usessl   = $ARGV[3];

if ($#ARGV != 3) {
  print "Usage: check_pop3.pl HOST USER PASS USESSL\n";
  exit 1;
}

#print substr($usessl,0,4);
if ($usessl eq "true") {
  $proto = "POP3s";
  $pop = new Mail::POP3Client(  USER => "$user",
          PASSWORD => "$password",
          HOST  => "$host",
          USESSL => true );
}else{
  $proto = "POP3";
  $pop = new Mail::POP3Client(  USER => "$user",
          PASSWORD => "$password",
          HOST  => "$host");
}

$count = $pop->Count();

if ($count == -1 ) {
  print "$proto CRITICAL [User: $user]\n";
  $pop->Close();
  exit 2;

}else{
  print "$proto OK [$count Messages at $user]\n";
  $pop->Close();
  exit 0;
}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=541465&aid=997991&group_id=29880




More information about the Devel mailing list