Help with a script query please

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

Moderators: Developers, Moderators

Post Reply
avonnieda
Posts: 25
Joined: Wed Jan 04, 2006 1:16 pm

Help with a script query please

Post by avonnieda »

Hi folks,

I've looked through forum messages and the tutorial, I've got to be missing something simple and stupid, but I can't find it. My script query get information about filesystem usage over ssh. Here is the xml I'm using, followed by the data that the script returns. Any assistance would be much appreciated.

cat linux_filesystems_ssh.xml
<interface>
<name>Get Linux Filesystem Information Via SSH</name>
<script_path>|path_cacti|/scripts/linux_filesystems_query_ssh.pl</script_path>
<arg_prepend>|host_hostname|</arg_prepend>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<output_delimeter>!</output_delimeter>
<index_order>fsIndex</index_order>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<fsIndex>
<name>Indexes</name>
<direction>input</direction>
<query_name>index</query_name>
</fsIndex>
<fsMountPoint>
<name>fsMountPoint</name>
<direction>input</direction>
<query_name>fsmountpoint</query_name>
</fsMountPoint>
<fsBlocks>
<name>fsBlocks</name>
<direction>output</direction>
<query_name>fsblocks</query_name>
</fsBlocks>
<fsUsedBlocks>
<name>fsUsedBlocks</name>
<direction>output</direction>
<query_name>fsusedblocks</query_name>
</fsUsedBlocks>
<fsAvailBlocks>
<name>fsAvailBlocks</name>
<direction>output</direction>
<query_name>fsavailblocks</query_name>
</fsAvailBlocks>
<fsPctFull>
<name>fsPctFull</name>
<direction>output</direction>
<query_name>fspctfull</query_name>
</fsPctFull>
</fields>
</interface>

Cacti verbose query always gets zero rows.

+ Running data query [10].
+ Found type = '4 '[script query].
+ Found data query XML file at '/opt/lampp/htdocs/cacti-0.8.7b/resource/script_queries/linux_filesystems_ssh.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/opt/lampp/htdocs/cacti-0.8.7b/scripts/linux_filesystems_query_ssh.pl el5test01 index'
+ Executing script query '/opt/lampp/htdocs/cacti-0.8.7b/scripts/linux_filesystems_query_ssh.pl el5test01 query index'
+ Executing script query '/opt/lampp/htdocs/cacti-0.8.7b/scripts/linux_filesystems_query_ssh.pl el5test01 query fsmountpoint'
+ Found data query XML file at '/opt/lampp/htdocs/cacti-0.8.7b/resource/script_queries/linux_filesystems_ssh.xml'
+ Found data query XML file at '/opt/lampp/htdocs/cacti-0.8.7b/resource/script_queries/linux_filesystems_ssh.xml'
+ Found data query XML file at '/opt/lampp/htdocs/cacti-0.8.7b/resource/script_queries/linux_filesystems_ssh.xml'

The script outputs data like so..

./linux_filesystems_query_ssh.pl el5test01 index
1
2

./linux_filesystems_query_ssh.pl el5test01 query index
1!1
2!2

./linux_filesystems_query_ssh.pl el5test01 query fsmountpoint
1!/
2!/boot

./linux_filesystems_query_ssh.pl el5test01 get fsusedblocks 2
10878

Thanks very much!
Attachments
linux_filesystems_ssh.xml
xml file attached
(1.81 KiB) Downloaded 87 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Help with a script query please

Post by gandalf »

avonnieda wrote:<script_path>|path_cacti|/scripts/linux_filesystems_query_ssh.pl</script_path>
Please change to
<script_path>/full/path/to/perl |path_cacti|/scripts/linux_filesystems_query_ssh.pl</script_path>
to make sure, that cactiuser calls the perl script correctly
Reinhard
avonnieda
Posts: 25
Joined: Wed Jan 04, 2006 1:16 pm

Post by avonnieda »

Hi Reinhard,

Thanks for the reply. I've tried it both ways, it touches a log file in /tmp when it runs, so I know it's executing when I do the verbose query. Just can't figure out why it doesn't seem to recognize the output.

-Adam
avonnieda
Posts: 25
Joined: Wed Jan 04, 2006 1:16 pm

Post by avonnieda »

Also, I've attached the script, in case you would have a chance to try it out. Since it uses ssh, you need to generate a key for the cactiuser on the source, and copy the id_dsa.pub over to the authorized_keys file on the target. I'm sure you already know this stuff, but just in case..

One the source, cactiuser
> ssh-keygen -t dsa (take defaults)

Copy the ~/.ssh/id_dsa.pub over to the machine to be graphed and add the entry to the /root/.ssh/authorized_keys file. Then ssh from the source to the target manually once to get past the prompt, and then a second time to verify you can log in without a password. The above assumes you're logging in to the target machine as root.

I was having a similar issue with a script query about a year ago, someone tried to help but couldn't get ssh set up correctly, so I figured I'd post instructions. I never did get past the problem, I've not been able to get a script query to work, I'd really like to get it going this time.

Any help is much appreciated.

-Adam vonNieda
Attachments
linux_filesystems_query_ssh.pl
(2.21 KiB) Downloaded 91 times
avonnieda
Posts: 25
Joined: Wed Jan 04, 2006 1:16 pm

Post by avonnieda »

Here's the same script, but for testing purposes it doesn't use ssh, it executes the command locally (assumes Linux) for testing purposes, in case anyone's interested in trying it.

Thanks,

-Adam
Attachments
linux_filesystems_query_ssh.pl
(2.21 KiB) Downloaded 105 times
avonnieda
Posts: 25
Joined: Wed Jan 04, 2006 1:16 pm

Post by avonnieda »

Seems like it has something to do with the fact that it's executing over ssh. I posted the local script before I even tried it. That one works, so even though the output looks the same between the ssh and non-ssh scripts, the ssh one doesn't work. Guess I'll keep looking, and I'll post if I figure it out.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests