TARGET {variables from other nodes}

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
jantram
Posts: 12
Joined: Mon Aug 27, 2012 1:25 pm

TARGET {variables from other nodes}

Post by jantram »

Hello everyone,

I'm working on a hierarchical alerting / status map. I am able to display a value from a remote node (same map) but I'm unable to TARGET the same value string.

The goal is host group behavior... such as this:

Site A
HostGroup A-1
HostGroup A-2
ThresholdGroup X
ThresholdGroup W

I have copied/modified the cactihost: data input method to report 0 for host up and 1 for down. (This method uses the keyword cactiboolhost and behaves like cactihost).

This allows a host-group status with a boolean TARGET line including many hosts ID's.

What I'm unable to do is move beyond first-level group status to allow the Site A object report failure on any child object.

Part of my testing code is actually using HVAC output values rather than the bools directly for testing.

NODE SITEA
TARGET {node:XXXXCACU10t:bandwidth_in}
LABEL Failed Systems {node:this:bandwidth_in}

This fails at the TARGET line with invalid target. I can however pull that same value from other node to the label:

NODE SITEA
LABEL {node:XXXXCACU10t:bandwidth_in} to display it.

I've hacked around on the TARGET lines with various syntax and even setting a variable to a valid source (such as an RRA file) errors on use.

The target node looks a little like this:
NODE XXXXCACU10t
TARGET gauge:XXXXXXXXXXXXXXXXXXXXXXXXXXXXdpsanalog11_7585.rrd:DPSAnalog11:-

The file name is obscured for security, and is valid and reports and behaves properly.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: TARGET {variables from other nodes}

Post by Howie »

This fails for two reasons:

1) all the variables in TARGETs are resolved before any TARGET is fetched, so bandwidth_in would never have a value. There is no cleverness to figure out dependencies between targets. Labels are resolved just before the node is drawn, which is after all the data has been fetched.

and (more importantly):
2) weathermap doesn't trust any data it has received from a datasource plugin to substitute into another TARGET anyway. Imagine you had a plugin from a third-party that set values to things like " !rm /boot/kernel" - it's just string substitution.

So internally, there are "hints" and "notes". Notes come from plugins, and hints come from the user (SET or the Cacti admin page 'special variables' settings). TARGET lines only recognise hints.

Any suggestions for more flexible, but still relatively secure ways to deal with this are welcome. This was just a first pass, really.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
jantram
Posts: 12
Joined: Mon Aug 27, 2012 1:25 pm

Re: TARGET {variables from other nodes}

Post by jantram »

Understandable from a distrusting environment perspective.

I've been unable to define a TARGET such as TARGET {this:node:rravariablefilenamefromset}.

The dependency layers do make sense for further trouble in resolving.

Perhaps another custom cactiboolhostgroup custom data source to report any nodes matching a string (from host.notes) would be the easiest solution. Maybe after the new year.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: TARGET {variables from other nodes}

Post by Howie »

Yeah, I did start on some stuff to have Weathermap write a data file which contained all the collected data in the format that the tab-separated data plugin uses, plus some totals, averages etc, so that another map can present summary information from it.

The next thought for that was to add a GROUP keyword, so that it could also write out min/max/avg/total for each group.

Depending on the order of the maps, that would give you 5-minute delayed data though.

For the specific case of bandwidth_in, it might be OK to trust it anyway, because that is forced to a number anyway.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
jantram
Posts: 12
Joined: Mon Aug 27, 2012 1:25 pm

Re: TARGET {variables from other nodes}

Post by jantram »

I think I have a work-around, and it should be fairly nice.

I have a non-plugin script to return the number of hosts down, selected from the pool of cactihosts by a keyword in the host.notes field. The script also returns the number of matching hosts.

I will be storing this data in an .rra file for normal TARGET use. It won't be an instant update, but will give the added historical data for outages and an OVERLIB target.

Targeting node-in-group by keyword also allows for "region" data, multiple group membership and network-topography group reporting of dissimilar node types.

I'll share the code if anyone cares to use it.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest