Script_query make me crazy

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
fconza
Posts: 2
Joined: Wed Feb 14, 2007 5:16 am

Script_query make me crazy

Post by fconza »

Helo everyone.

I read all topics and howto about script_query but my own script don't work.

My XML file

Code: Select all

<interface>
        <name>Get Unix Mounted Partitions</name>
        <description>DS8xxx Io Port Stats</description>
        <script_path>/usr/bin/perl |path_cacti|/scripts/ds8x_ioports.pl</script_path>
        <arg_index>index</arg_index>
        <arg_query>query</arg_query>
        <arg_get>get</arg_get>
        <arg_num_indexes>num_indexes</arg_num_indexes>
        <output_delimeter>:</output_delimeter>
        <index_order>ioPort</index_order>
        <index_order_type>alphabetic</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <ioPort>
                        <name>Device Name</name>
                        <direction>input</direction>
                        <query_name>ioport</query_name>
                </ioPort>
                <byteRead>
                        <name>Bytes Read</name>
                        <direction>output</direction>
                        <query_name>byteread</query_name>
                </byteRead>
                <byteWrite>
                        <name>Bytes Write</name>
                        <direction>output</direction>
                        <query_name>bytewrit</query_name>
                </byteWrite>
                <byteWritPPRC>
                        <name>Bytes Write in PPRC</name>
                        <direction>output</direction>
                        <query_name>bytewritPPRC</query_name>
                </byteWritPPRC>
                <byteReadPPRC>
                        <name>Bytes Read in PPRC</name>
                        <direction>output</direction>
                        <query_name>bytereadPPRC</query_name>
                </byteReadPPRC>
        </fields>
</interface>

here the output of my script

Code: Select all

[cacti@test]$ ./ds8x_ioports.pl index                                  
I0000
I0001
I0002
I0003
[cacti@test]$
The get commande

Code: Select all

[cacti@test]$ ./ds8x_ioports.pl get bytewrit I0000
2386614[cacti@test]$
The query commande

Code: Select all

[cacti@MOPB2RPTSV-01]$ ./ds8x_ioports.pl query bytewrit
I0000:2386614
I0001:0
I0002:11108598
I0003:0
[cacti@test]$
and query the index

Code: Select all

[cacti@test]$ ./ds8x_ioports.pl query ioport
I0000:I0000
I0001:I0001
I0002:I0002
I0003:I0003
[cacti@test]$
the output of Debug Query

Code: Select all

+ Running data query [14].
+ Found type = '4 '[script query].
+ Found data query XML file at '/export/eznim/cacti-0.8.6j/resource/script_queries/ds8000_ioports.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'perl /export/eznim/cacti-0.8.6j/scripts/ds8x_ioports.pl index'
+ Executing script query 'perl /export/eznim/cacti-0.8.6j/scripts/ds8x_ioports.pl query ioport'
+ Found data query XML file at '/export/eznim/cacti-0.8.6j/resource/script_queries/ds8000_ioports.xml'
+ Found data query XML file at '/export/eznim/cacti-0.8.6j/resource/script_queries/ds8000_ioports.xml'
+ Found data query XML file at '/export/eznim/cacti-0.8.6j/resource/script_queries/ds8000_ioports.xml'
For debug i make a perl script simple

Code: Select all

#!/usr/bin/perl

$cmd = "cat ds8x.out";

open(CMD,"$cmd|")
   or die "can't start $cmd: $!\n";
while(<CMD>) {
#
  chomp();
  @words=split(/\s/,$_);
  %output = (
        ioport => "$words[0]",
        bytewritPPRC => "$words[1]" ,
        bytereadPPRC => "$words[2]",
        WritesPPRC => "$words[3]",
        ReadsPPRC => "$words[4]",
        timewritePPRC => "$words[5]",
        timereadPPRC => "$words[6]",
        byteread => "$words[7]",
        bytewrit => "$words[8]",
        Reads => "$words[9]",
        Writes => "$words[10]",
        timeread => "$words[11]",
        timewrite => "$words[12]",
  );
  if ($ARGV[0] eq "index") {
      print "$output{ioport}\n";
  }elsif (($ARGV[0] eq "get") && ($ARGV[2] eq $output{ioport})) {
      print $output{$ARGV[1]};
  }elsif ($ARGV[0] eq "query") {
         print "$output{ioport}:$output{$ARGV[1]}\n";
  }
}

close(CMD);
Thanks for people that can help me.
smilerpt
Posts: 30
Joined: Tue Apr 24, 2007 8:00 pm
Location: Portugal, Lisbon

Post by smilerpt »

Turn on debug for the poller, let it run during 1 cicle in debug mode and post the result in cacti.log.
There you probably will be able to understand what is hapenning.

rs
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Your perl script uses not fully qualified data set name to read from. Please check this
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest