VMware Cloud Community
VoodooZ
Contributor
Contributor

calculating percentage in plugin?

Hi,

I want my plugin to be able to display a metric as a percentage but the snmp device in question only provides usedKBytes and limitKBytes.... Where and how would I calculate the percentage?
In the XML plugin?

Thanks in advance,
Reply
0 Kudos
5 Replies
VoodooZ
Contributor
Contributor

Here's another example:

In the latest netapp MIB, dfKBytesTotal is DEPRECATED.. so they recommend we use dfHighTotalKBytes and dfLowTotalKBytes instead which represents the upper and lower 32bits of an effective 64bits value.... How would one get around to putting those two composite value back together for display?? I would think it would be easier if done before the metric is passed back to the GUI right?

SIGAR maybe?

Thanks,
Reply
0 Kudos
VoodooZ
Contributor
Contributor

Anybody? Come on.. I'm trying to extend HQ with a decent NetApp plugin and give back to the community here...
There's got to be a knowledgeable developer who can at least give me a lead here...

Thanks,
Reply
0 Kudos
VoodooZ
Contributor
Contributor

nobody?

Let me rephrase just in case I wasn't crystal clear....

Where would I add code to "pre-process" metric data?
i.e. I want to pass a percentage to HQ which is not provided by the device's snmp agent/mib...
I only have "volume max size" and "volume used space" to work with and want to come up with a percentage so I can later create an alert using a percentage...

Thanks,
Reply
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee

There isn't a way to do this directly in the plugin.xml file currently, but I think it'd be do-able if were to integrate Groovy scripting. There's been alot of Groovy integration happening on the server-side, very cool stuff, but that's another topic. In the meantime, you'd either need to write a Java class or scripting language of choice to collect the data and calculate the percentage. With the Java option, you'd need to compile the class and package a plugin.jar. With the scripting option, the plugin.xml can reference an external script or have it embedded within the .xml, but either way it runs out-of-process and would require, with Perl for example, an SNMP module to be installed. The Groovy idea would be best of both worlds, in-process scripting in the plugin.xml with access to the bundled support classes.
Let me know what your preference is and I can provide further direction.
Reply
0 Kudos
VoodooZ
Contributor
Contributor

Thanks for the response... And sorry for the delay but I assumed nobody would ever respond so stop checking...

I did look into the possibility of going the script way but the problem with that is that I would lose the ability to have the various entities (netapp Q-trees in my case) auto-discovered.
they would need to be hard-coded in the xml file which is a pain and one more thing to remember...
The java way is harder for me as I don't know Java and the last time I tried to learn was met with tons of issues...

I am curious about the groovy solution though...

I do have all the necessary auto-metrics auto-discovered in my current prototype netapp plugin so all I would need to do is have a virtual metric of sorts that would calculate percentage as a function of 2 other metrics... Is that possible?

Thanks again,
Reply
0 Kudos