TECHZEN Zenoss User Community ARCHIVE  

Display latest rrd point in device overview?

Subject: Display latest rrd point in device overview?
Author: [Not Specified]
Posted: 2015-09-01 07:51

Hello,

how can I access the latest datapoint
of a given datasource's member
I'd like to display the variable's
freshest value on the device overview
page.
(I'd vote for a custom getter in the device,
just that i have zero idea how to access
the rrd points from the device).
Thanks,



Subject: You can retrieve the last RRD
Author: Jim R
Posted: 2015-09-02 11:17

You can retrieve the last RRD value using something like URL/UID/getRRDValuedsname=DPNAME and add that to your java script for the device.



Subject: Awesome, works great. Thanks
Author: [Not Specified]
Posted: 2015-09-02 23:52

Awesome, works great. Thanks a lot!!



Subject: Harsszegi, maybe you'd be
Author: [Not Specified]
Posted: 2015-09-08 08:15

Harsszegi, maybe you'd be willing to write up a wiki page for how you did that What files you edited, what you added, for others to follow as an example.



Subject: Actually not too much was
Author: [Not Specified]
Posted: 2015-09-08 08:23

Actually not too much was needed:
create a getter in the device's .py code
which simply does a self.getRRDValue('rrdfieldname')
Then simply define the membervariable in
info.py with a @property and call your getter in
the device.
But will update this thread with a bit nore details tomorrow



Subject: A lot of what you wrote there
Author: [Not Specified]
Posted: 2015-09-08 08:26

A lot of what you wrote there must seem blindingly obvious to you but the rest of us have no idea what you're talking about. :)



Subject: So here it goes:
Author: [Not Specified]
Posted: 2015-09-09 01:35

So here it goes:

a.) You have your Device or DeviceComponent, your create something like this:
- if you are a DeviceComponent

def getCPUFanStatus(self):
return self.device().getRRDValue('CPUFanStatus')

- if you are a Device

def getCPUFanStatus(self):
return self.getRRDValue('CPUFanStatus')

b.) You create something like this in your info.py

class CpuInfo(ComponentInfo):
implements(ICpuInfo)

@property
@info
def CPUFanStatus(self):
return self._object.getCPUFanStatus()

c.) You create the appropriate DataSource either manually or in your objects.xml,
e.g.



So practically you don't ProxyProperty the variable back to a variable in your device, but instead you
create a wrapper,so practically whenever ZenOss interacts with the "CPUFanStatus" ""variable"",
it'll automatically call "getCPUFanStatus()" underneath, hence you'll get your RRD value on the fly.



< Previous
Windows monitoring - Process scan error - cannot determine realm for numeric hos ...
  Next
Troubleshoot .js files?
>