VMware Cloud Community
m03hr3
Contributor
Contributor

Metric in own Plugin collected only once

I've written a Plugin that executes perlscripts and should show the output. The perl scripts put out 2 key=value pairs. One is called succes and one time. The problem is, that the second value is only collected sometimes ( after different intervals ) and not as said all 1 minute. I attach the plugin and hope somebody can help me ...
0 Kudos
11 Replies
m03hr3
Contributor
Contributor

Should I provide any further Information in order to make it more clear ?
0 Kudos
m03hr3
Contributor
Contributor

I think I should:

The script puts out two pairs e.g.:

success=1
time=2

If I query the Availability-prop of the template holding the executed script I get the value
for success as expected and the value is collected in that interval as I set it in the UI.
If I modify the plugin and use it in that way i posted it ( collect Av. and time value ) the interval set in the UI doesn't apply. the Value is only collected once when I change the value but not afterwards. If I change the interval it is collected once again. Also collecting values success and time with intervals specified in the metric didn't help.

Message was edited by: m03hr3
0 Kudos
m03hr3
Contributor
Contributor

I think I found something. Even If execute the example script, only the first value ist collected. So it seems to be a more general problem. Any Idea's were to look ?



drssm102:/home/hyperic/agent-2.7.6-EE# java -jar pdk/lib/hq-product.jar -Dplugins.include=io-device
I/O Device Availability:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:Availability
=>50,0%<=
I/O Device Read Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rrqm/s
I/O Device Write Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wrqm/s
I/O Device Read Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:r/s
I/O Device Write Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:w/s
I/O Device Sectors Read per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rsec/s
I/O Device Sectors Writen per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wsec/s
I/O Device Average Sector Request Size:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgrq-sz
I/O Device Average Queue Length:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgqu-sz
I/O Device Average Wait Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:await
I/O Device Average Service Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:svctm
I/O Device CPU Usage:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:%util

I/O Device Read Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rrqm/s
I/O Device Write Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wrqm/s
I/O Device Read Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:r/s
I/O Device Write Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:w/s
I/O Device Sectors Read per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rsec/s
I/O Device Sectors Writen per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wsec/s
I/O Device Average Sector Request Size:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgrq-sz
I/O Device Average Queue Length:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgqu-sz
I/O Device Average Wait Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:await
I/O Device Average Service Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:svctm
I/O Device CPU Usage:
I/O

Message was edited by: m03hr3
0 Kudos
m03hr3
Contributor
Contributor

I/O Device Read Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rrqm/s
I/O Device Write Requests Merged per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wrqm/s
I/O Device Read Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:r/s
I/O Device Write Requests per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:w/s
I/O Device Sectors Read per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:rsec/s
I/O Device Sectors Writen per Second:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:wsec/s
I/O Device Average Sector Request Size:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgrq-sz
I/O Device Average Queue Length:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:avgqu-sz
I/O Device Average Wait Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:await
I/O Device Average Service Time:
I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:svctm
I/O Device CPU Usage:
I/O
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee


On Mar 8, 2007, at 1:45 AM, Alexander Müller wrote:

I think I found something. Even If execute the example script, only the first value ist collected. So it seems to be a more general problem. Any Idea's were to look ?



drssm102:/home/hyperic/agent-2.7.6-EE# java -jar pdk/lib/hq-product.jar -Dplugins.include=io-device
I/O Device Availability:
   I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=sda:Availability
   =>50,0%<=

Notice Availability is not 100%, add -Dlog=debug to the command line and you should see:
[DEBUG] Collector -  [Warn] (pdk/scripts/device_iostat.pl) sda not found at pdk/scripts/device_iostat.pl line 30.

You need to configure the device option, for example to hda:
java -jar pdk/lib/hq-product.jar -Dplugins.include=io-device -Ddevice=hda
I/O Device Availability:
   I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=hda:Availability
   =>100.0%<=
I/O Device Read Requests Merged per Second:
   I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=hda:rrqm/s
   =>0.1<=
I/O Device Write Requests Merged per Second:
   I/O Device:exec:file=pdk/scripts/device_iostat.pl,args=hda:wrqm/s
   =>1.5<=

Does your plugin collect all expected values from the command line?  If not, maybe -Dlog=debug will shed some light.



0 Kudos
m03hr3
Contributor
Contributor

That's the output of the script i run:

drssm102:/home/hyperic/agent-2.7.6-EE/pdk/scripts# ./cl_test_wrapper_4.pl
right before loop!
sucess=1
time=1
right after loop!

and that's output of hq when invoking the plugin calling the script:

[INFO] ProductPluginManager - Loading plugin: direct_connect_extd-plugin.xml
[DEBUG] ControlPluginManager - PluginNotFound creating plugin for service '*+DIRECT_CONNECT+*' from server 'NetworkServer'
*+DIRECT_CONNECT+* Availability pcvisit 4:
*+DIRECT_CONNECT+*:exec:file=/root/cl_test_wrapper_4.pl:success
[DEBUG] Collector - Adding exec collector: [/root/cl_test_wrapper_4.pl]
[INFO] CollectorThread - CollectorThread started
[DEBUG] Collector - Running exec collectors
[DEBUG] ExecutableProcess - running: [/root/cl_test_wrapper_4.pl]
[DEBUG] Execute - Done exit=0 /root/cl_test_wrapper_4.pl
[DEBUG] ExecutableProcess - right before loop!
time=0
right after loop!

[DEBUG] Collector - Fri Mar 09 18:26:12 CET 2007 [Info] (/root/cl_test_wrapper_4.pl) right before loop!
time=0
right after loop!
values={Availability=1.0, ResponseTime=42.0, time=0, ResponseCode=0.0}
[DEBUG] CollectorResult - Attribute 'success' not found
*+DIRECT_CONNECT+* ExecTime pcvisit 4:
*+DIRECT_CONNECT+*:exec:file=/root/cl_test_wrapper_4.pl:time
[DEBUG] Collector - Running exec collectors
[DEBUG] ExecutableProcess - running: [/root/cl_test_wrapper_4.pl]
[DEBUG] UnitsFormat - format(0.0) -> 0,0
=>0,0<=
[DEBUG] Execute - Done exit=0 /root/cl_test_wrapper_4.pl
[DEBUG] ExecutableProcess - right before loop!
time=0
right after loop!

[DEBUG] Collector - Fri Mar 09 18:26:13 CET 2007 [Info] (/root/cl_test_wrapper_4.pl) right before loop!
time=0
right after loop!
values={Availability=1.0, ResponseTime=70.0, time=0, ResponseCode=0.0}
0 Kudos
m03hr3
Contributor
Contributor

(continued)


[DEBUG] Execute - Done exit=0 /root/cl_test_wrapper_4.pl
[DEBUG] ExecutableProcess - right before loop!
time=0
right after loop!

[DEBUG] Collector - Fri Mar 09 18:26:13 CET 2007 [Info] (/root/cl_test_wrapper_4.pl) right before loop!
time=0
right after loop!
values={Availability=1.0, ResponseTime=70.0, time=0, ResponseCode=0.0}



I added the used plugin and perl-script. Why are ther two values ResponseTime ?
Is the script called twice ?
Why don't I get the outpu of the open-function in the perl-script although When I exec the perl-script myself I get it ?
Any Ideas ?

Message was edited by: m03hr3
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee


On Mar 9, 2007, at 9:33 AM, Alexander Müller wrote:

That's the output of the script i run:

drssm102:/home/hyperic/agent-2.7.6-EE/pdk/scripts# ./cl_test_wrapper_4.pl

...


[DEBUG] Collector - Fri Mar 09 18:26:12 CET 2007 [Info] (/root/cl_test_wrapper_4.pl) right before loop!


Looks like the script you're running manually (in pdk/scripts) might be different from the one in /root?
Since your config option has the default of /root/cl_test_wrapper_4.pl, it is using that rather than the one in pdk/scripts/

The script will only be called once when invoked from the command line.  When invoked by the agent, it will be run once per scheduled interval of the metrics being collected by the script.  As for the other numbers you see with the debug output, these are added by the script collector:

Availability - Availability based on process exit code (see table at http://support.hyperic.com/confluence/display/DOCSHQ30/Script+Plugin)
ResponseTime - Time (in ms) taken to execute the script
ResponseCode - Process exit code

0 Kudos
m03hr3
Contributor
Contributor

Didn't work. I made the case a little simpler but the problem remains.

if i invoke cl_test ( ELF )with the params the output is "sucess=..." and "time=...".
The files called by the plugin is defintly the right one.

I added the used Plugin.

if I invoke the plugin:

java -jar pdk/lib/hq-product.jar -Dplugins.include=direct_connect_extd -Dlog=debug

the output is:

drssm102:/home/hyperic/agent-2.7.6-EE# java -jar pdk/lib/hq-product.jar -Dplugin
[DEBUG] ProductPluginManager - Initializing in client mode (pdk=/home/hyperic/ag
[DEBUG] MIBTree - No MIBs in directory: /home/hyperic/agent-2.7.6-EE/pdk/mibs
[INFO] ProductPluginManager - Loading plugin: system-plugin.jar
[INFO] ProductPluginManager - Loading plugin: netservices-plugin.jar
[INFO] MeasurementPlugin - Register TCP Socket proxy for domain: socket
[INFO] MeasurementPlugin - Register HTTP proxy for domain: http
[INFO] MeasurementPlugin - Register HTTP proxy for domain: url.availability
[INFO] MeasurementPlugin - Register FTP proxy for domain: ftp
[INFO] ProductPluginManager - Loading plugin: sqlquery-plugin.jar
[DEBUG] ProductPluginManager - adding to sqlquery classpath:
[DEBUG] ProductPluginManager - d /home/hyperic/agent-2.7.6-EE/pdk/lib/jdbc
[INFO] SQLQueryMeasurementPlugin - Registered proxy for domain: sql
[DEBUG] ProductPluginManager - Skipping activemq (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping adwords (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping apache (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping bind (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping db2 (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping dotnet (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping exchange (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping geronimo (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping hqagent (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping iis (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping iplanet (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping jboss (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping jmx (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping memcached (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping metaframe (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping mqseries (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping mssql (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping mule (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping mysql (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping nagios (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping netdevice (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping ntds (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping ntp (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping oracle (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping postfix (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping postgresql (not in plugins.include)
[DEBUG] ProductPluginManager - process-metrics.xml not a loadable plugin
[DEBUG] ProductPluginManager - Skipping resin (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping servlet (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping silverstream (not in plugins.include)
[DEBUG] ProductPluginManager - sun-jvm-service.xml not a loadable plugin
[DEBUG] ProductPluginManager - Skipping sybase (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping vmware (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping weblogic (not in plugins.include)
[DEBUG] ProductPluginManager - Skipping websphere (not in plugins.include)
[DEBUG] ProductPluginManager - direct_connect_extd-plugin.xml~ not a loadable pl
[DEBUG] ProductPluginManager - Skipping io-device (not in plugins.include)
[INFO] ProductPluginManager - Loading plugin: direct_connect_extd-plugin.xml
[DEBUG] ControlPluginManager - PluginNotFound creating plugin for service '*+DIR
*+DIRECT_CONNECT+* Availability pcvisit 4:
*+DIRECT_CONNECT+*:exec:file=/root/cl_test,args=--ConnectionSettings "nxuc1ny
Establishment 0:sucess
[DEBUG] Collector - Adding exec collector: [/root/cl_test, --ConnectionSettings,
tablishment, 0]
[INFO] CollectorThread - CollectorThread started
[DEBUG] Collector - Running exec collectors
[DEBUG] ExecutableProcess - running: [/root/cl_test, --ConnectionSettings, nxuc
shment, 0]
[DEBUG] Execute - Done exit=137 /root/cl_test --ConnectionSettings nxuc1nyuv733c
[ERROR] ExecutableProcess - No message, exit value=137
[DEBUG] Collector - Thu Mar 15 14:59:14 CET 2007 [Error] (/root/cl_test) No mess
, ResponseCode=137.0}
[DEBUG] CollectorResult - Attribute ''sucess" not found
drssm102:/home/hyperic/agent-2.7.6-EE#

Permissions are set to a+a for the cl_test-executable.

What could be the reason ?
0 Kudos
m03hr3
Contributor
Contributor

I think I know what exactly is the problem. If I place a command like ps in the backticks in my perlscript, that command gets executed and I can work with the output in my perlscript. If I replace that command with

./cl_test --ConnectionSettings \"nxuc1nyuv733c9b051cv5d\"
\"DIRECT_CONNECTION\" \"\" \"\" 0 \"\" \"PROXY_UNKNOWN\" --TestConnectionEstabl
ishment 0"

that app doesn't get executed. But it does get executed if I invoke the perlscript by myself. Only If I start It through a plugin the backticks aren't executed ( the perlscript itself does).
I also tried using the absolute Path which also didn't work.
Also permission issues can't be the problem. Any Idea's?
0 Kudos
m03hr3
Contributor
Contributor

Perlscript
0 Kudos