{

if ( -x '/usr/sbin/asterisk' ){
    my $login = "";
    my $user = ${'zabbix-agent'}{'AsteriskManagerLogin'} || '';
    my $pass = ${'zabbix-agent'}{'AsteriskManagerPassword'} || '';
    if ($user ne ''){
        $login .= "--user=$user";
    }
    if ($pass ne ''){
        $login .= " --secret=$pass";
    }
    $OUT.=<<"HERE"
# Type: Agent or Agent (active)
# Key: asterisk[key] where key can be max_latency, sip_peers, channels, internal_calls,
# outgoing_calls, incoming_calls, external_calls, duration_internal or duration_external
# Type of information: Numeric (integer 64bit)
# Units: depends on the key
# Custom multiplier: Do not use
# Store Value: As is
 
UserParameter=asterisk[*],/var/lib/zabbix/bin/check_asterisk $login --what=\$1

HERE
}

}

