in reply to Re: Creating a perl script for database monitoring
in thread Creating a perl script for database monitoring

Thank you for the quick reply :) I have too use the ->plugin_exit( each time to return a code (0=OK,1=UNKNOWN,2=CRITICAL,3=WARNING) from the data. If I rename the $data i have uncompiled result.  File attente de datatable CRITICAL - File attente (ARRAY(0x10841e8) ARRAY(0x1084230) ARRAY(0x1084278))

Replies are listed 'Best First'.
Re^3: Creating a perl script for database monitoring
by SimonPratt (Friar) on Apr 08, 2016 at 13:25 UTC

    Thats because when you change foreach $data ( @$data) { to foreach my $thisone ( @$data) {, you must also change (my $variable1,my $variable2,my $variable3) = @$data; to (my $variable1,my $variable2,my $variable3) = @$thisone; and change check    => $data, to check    => $thisone,

Re^3: Creating a perl script for database monitoring
by poj (Abbot) on Apr 08, 2016 at 13:49 UTC

    The docs say "You can specify $value as an array of values and each will be checked against the thresholds." so try without the loop.

    my $data = $sth->fetchall_arrayref(); $sth->finish; my $code_retour = $oracle_connector->check_threshold( check => $data, warning => $oracle_connector->opts->warning, critical => $oracle_connector->opts->critical, ); $oracle_connector->plugin_exit( $code_retour, "File attente (@$data)" +);
    poj

      Without the loop the programm do again unreadable results

      File attente de datatable CRITICAL - File attente (ARRAY(0x10841e8) ARRAY(0x1084230) ARRAY(0x1084278))

      With your instruction my result can be read but there is again the main problem to have result of each line of the sql request, i will think if an idea for not doing the loop

        Sorry my mistake, $data is a reference to an array-of-arrays rather than an array. Try this

        my @count = map {$_->[0]} @$data; my $code_retour = $oracle_connector->check_threshold( check => \@count, warning => $oracle_connector->opts->warning, critical => $oracle_connector->opts->critical, ); $oracle_connector->plugin_exit($code_retour,"File attente (@count)" );
        poj