# define the scalar to hold (?)
my $mail;

# if we're in debugging mode, print message saying where we're at
if( $BigSister::common::dl>3 )
{
   print "LOADING QMQUEUE MODULE!!!\n";
}

$method = "direct";
($method = $args{"method"}) if ($args{"method"});

# check to see if module is already in memory; if it isn't, load it
unless( $mail = $memory{"qmqueue_$args{frequency}"} )
{
    &uxmon::load_module( "qmqueue" );
    &uxmon::checker(
        $memory{"qmqueue_$args{frequency}"} = $mail = Monitor::qmqueue->new( 
	    $method, $args{"queue_dir"}||'', $args{"socket"}||'' )
    );
    $mail->sched_frequency( $args{"frequency"} );
}

my $item = $args{"alias"}.".".($args{"check"}?$args{"check"}:"mail");
my $warnlevl, $warnlevr, $warnlevt;
if ($args{"queue_yellow"}) {
    $warnlevl = $warnlevr = $warnlevt = $args{"queue_yellow"};
}
($warnlevl = $args{"warnlevl"}) if ($args{"warnlevl"});
($warnlevr = $args{"warnlevr"}) if ($args{"warnlevr"});
($warnlevt = $args{"warnlevt"}) if ($args{"warnlevt"});

my $paniclevl, $paniclevr, $paniclevt;
if ($args{"queue_red"}) {
    $paniclevl = $paniclevr = $paniclevt = $args{"queue_red"};
}
($paniclevl = $args{"paniclevl"}) if ($args{"paniclevl"});
($paniclevr = $args{"paniclevr"}) if ($args{"paniclevr"});
($paniclevt = $args{"paniclevt"}) if ($args{"paniclevt"});

# send the monitor program either the passed-in limits, or our pre-defined limits for CPU load warnings
$mail->add_check( $args{"alias"}.".".($args{"check"}?$args{"check"}:"mail"),
 $warnlevl, $paniclevl, $warnlevr, $paniclevr, $warnlevt, $paniclevt );

# if we're in debugging mode, print message saying where we're at
if( $BigSister::common::dl>3 )
{
    print "QMQUEUE: Made it through Config, anyway ...\n";
}
