Ad Widget

Collapse

Problem with External Script, Zabbix1.4

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Umair
    Member
    • Feb 2007
    • 86

    #1

    Problem with External Script, Zabbix1.4

    Hello, I have an external script named "rnc".
    It is a simple script that executes Telent Session on a remote host and gathers back the results from the host for some operations.
    Based on the processing, the script prints either 0 or 1. (required for the zabbix external scripts)
    When executed normally, that is through the command promt, it works fine.
    But when i integrate it with Zabbix as an external script, it gives me the following error :

    3870:20070619:123604 Expression [{11953}<1] cannot be evaluated [Unable to get value for functionid [11953]]
    The Expression for the Item is :

    rnc(1)

    The expression for the trigger is :

    {Assoc:rnc(1).max(2)}<1

    Where :

    Assoc: Name of Host
    rnc : Name of External Script
    Max : Function

    Any clues, as why the script works outside perfectly but fails to work altogether when used with Zabbix ?

    The script is :

    $ip_address = $ARGV[1];
    $port = $ARGV[2];

    $t = Net::Telnet->new(Host => $ip_address,Port=>$port);

    @recent = $t -> cmd ("assoc list");
    @recent = $t -> cmd ("assoc list");
    open (MYFILE, '>/etc/zabbix/externalscripts/'.$ip_address);
    print MYFILE "@recent";
    close (MYFILE);
    open (MYFILE, '/etc/zabbix/externalscripts/'.$ip_address);
    @raw_data=<MYFILE>;

    @prot_data=("DK","UDP","TCP");

    OUTER: foreach $val (@raw_data)
    {
    chop($val);

    if(($index_val = index($val, "DK"))!=-1 || ($index_val = index($val, "UDP"))!=-1 || ($index_val = index($val, "TCP"))!=-1 ){

    $new_string =substr($val, $index_val);

    ($prot,$w_active,$w_up)=split(' ',$new_string);

    if($w_active eq "No" || $w_up eq "No") {
    print "0";
    last OUTER;
    }

    }


    }
    Last edited by Umair; 19-06-2007, 12:52.
Working...