Using global variablename

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
Rno
Cacti Pro User
Posts: 694
Joined: Wed Dec 07, 2011 9:19 am

Using global variablename

Post by Rno »

I try to have some global variable used everywhere in my config but I't dosen't work any clue why
With this error on the log:
06/29/2017 01:17:34 PM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 206: POSITION SRE-B90-190m1 0 offset_node_x
06/29/2017 01:17:34 PM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 197: POSITION SRE-B90-190m2 0 offset_node_x
06/29/2017 01:17:34 PM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 188: POSITION SRE-B90-190m2 0 offset_node_y

Here is my setting:
# position of a node from another one
SET offset_node_x 120
SET offset_node_y 200
SET offset_ink_x 100
SET offset_ink_y -50

# node:
NODE SRE-B90-190m2
LABEL SRE-B90-190m2
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=44
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=44
ICON 50 50 images/c3bv.png
TARGET cactihost:19
LABELOFFSET 0 25
POSITION 220 350

NODE SRE-B90-190m1
LABEL SRE-B90-190m1
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=44
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=44
ICON 50 50 images/c3bv.png
TARGET cactihost:19
LABELOFFSET 0 -35
POSITION SRE-B90-190m2 0 offset_node_y

NODE SRE-B85-185m2
LABEL SRE-B85-185m2
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=43
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=43
ICON 50 50 images/c3bv.png
TARGET cactihost:18
LABELOFFSET 0 25
POSITION SRE-B90-190m2 0 offset_node_x

NODE SRE-B85-185m1
LABEL SRE-B85-185m1
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=43
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=43
ICON 50 50 images/c3bv.png
TARGET cactihost:18
LABELOFFSET 0 -35
POSITION SRE-B90-190m1 0 offset_node_x
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
Pucho
Cacti User
Posts: 185
Joined: Wed Jul 20, 2016 8:00 pm

Re: Using global variablename

Post by Pucho »

Shouldn't be like this?

Code: Select all

POSITION SRE-B90-190m2 0 {map:this:offset_node_y}
Cacti - 1.2.15
Poller Type - Spine
Weathermap 0.98a
Server Info - Linux 3.10.0 - Centos 7
Web Server - Apache/2.4.6 PHP 5.4.16
MySQL - 5.5 ;RRDTool - 1.4.8 ;SNMP - 5.7.2
Religion - Anti forum pets
Rno
Cacti Pro User
Posts: 694
Joined: Wed Dec 07, 2011 9:19 am

Re: Using global variablename

Post by Rno »

nope:
07/03/2017 12:46:27 PM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 210: POSITION SRE-B90-190m1 {map:this:offset_node_x} {map:this:offset_node_y}
07/03/2017 12:46:27 PM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 201: POSITION SRE-B90-190m2 {map:this:offset_node_x} {map:this:offset_node_y}


NODE SRE-B85-185m1
LABEL SRE-B85-185m1
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=43
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=43
ICON 50 50 images/c3bv.png
TARGET cactihost:18
LABELOFFSET 0 -35
POSITION SRE-B90-190m1 {map:this:offset_node_x} {map:this:offset_node_y}
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
Pucho
Cacti User
Posts: 185
Joined: Wed Jul 20, 2016 8:00 pm

Re: Using global variablename

Post by Pucho »

I'm sorry, I posted that after I've come back from holidays. Bad idea.. hehe

According to the manual, it should be {map:variablename} instead of {map:this:variablename}

https://network-weathermap.com/manual/0 ... anced.html

Cheers
Cacti - 1.2.15
Poller Type - Spine
Weathermap 0.98a
Server Info - Linux 3.10.0 - Centos 7
Web Server - Apache/2.4.6 PHP 5.4.16
MySQL - 5.5 ;RRDTool - 1.4.8 ;SNMP - 5.7.2
Religion - Anti forum pets
Rno
Cacti Pro User
Posts: 694
Joined: Wed Dec 07, 2011 9:19 am

Re: Using global variablename

Post by Rno »

Still not working
07/04/2017 10:54:26 AM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 211: POSITION SRE-B90-190m1 {map:offset_node_x} 0
07/04/2017 10:54:26 AM - WEATHERMAP: Poller[0] WARNING: [Map 1] ast.conf: Unrecognised config on line 201: POSITION SRE-B90-190m2 {map:offset_node_x} 0
Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
tomlewisflood
Posts: 3
Joined: Wed Nov 15, 2017 11:03 am

Re: Using global variablename

Post by tomlewisflood »

I've been playing with this also, but with mixed results. I think the key phrase in the manual about this is at the beginning of the "Special String Processing Tokens" Section:
Most places where you can specify a string in Weathermap config files...
I cried a bit when I figured out that in my LINK section, where I wanted to use globals for one or both arguments to the NODES config, I could not do so because the arguments to NODES is not a string in this context. Globals used like this:

(In globlal section:)

Code: Select all

SET router_a foorouter 
SET router_b barrouter
(Later in links section:)

Code: Select all

LINK {map:router_a}-to-{map:router_b}
    TEMPLATE basesetup
    NODES {map:router_a} {map:router_b}
only worked in the LINK Directive (a string), but not in the NODES directive.

As to your case, since the manual says the arguments are (nodename, x-coord, y-coord), I'm thinking you'll have similar problem. If you've figured out a good way to work around this, it'd be good to hear.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Using global variablename

Post by Howie »

@tom - can you explain a bit more what you are trying to do? I can't think of a reason to define the node names somewhere else like this...
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!)
tomlewisflood
Posts: 3
Joined: Wed Nov 15, 2017 11:03 am

Re: Using global variablename

Post by tomlewisflood »

Pardon my new status here, as I only started mapping last week. In any case, Ignoring the fact that I just found the random-bits directory with the script goodies (which is already changing how I am proceeding), I had the idea that in my case, I was mapping about 200 or so of the layer 2 redundant connections between corresponding ports of a primary router pair and their target end nodes. I have about 40 locations to map that have similar (but not identical) port relationships each centered around 2 asr9k pairs.

I figured that since every LINK name as well as at least one member of the NODES was always going to be one of the two members of the primary router pair, it would be expedient to SET those two router names globally at the top of the config file and then wherever I might put the proper name of the router, I could simply leave the {map:firstroutername} or {map:secondroutername} variable, depending on what side of the redundant connection I'm mapping.

If I completely mapped one of my 40 locations, I could then just copy the config file, update the SETs accordingly, and have a decent start before cacti integration. Obviously, I'm only just now understanding how to build a base map to leverage the benefit of cacti-integrate.php, et al.
User avatar
Pucho
Cacti User
Posts: 185
Joined: Wed Jul 20, 2016 8:00 pm

Re: Using global variablename

Post by Pucho »

So you're basically trying to auto populate links ? You want weathermap to save you from "adding links" manually?
Cacti - 1.2.15
Poller Type - Spine
Weathermap 0.98a
Server Info - Linux 3.10.0 - Centos 7
Web Server - Apache/2.4.6 PHP 5.4.16
MySQL - 5.5 ;RRDTool - 1.4.8 ;SNMP - 5.7.2
Religion - Anti forum pets
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Using global variablename

Post by Howie »

You can save a bit of time by naming your links differently. They don't *have* to have node names in at all. If 'uplink' or 'internet1' makes more sense (and allows re-use), that's allowed :-) They just have to be unique within the map.

Heck, you can do the same with nodes. If you always name e.g. the core router nodes core01 and core02, there's no need for that variable. You can add a LABEL to the node for what you want the viewer to see that's independent of the link or node name.

Also, you *can* use those variables for the labels. So if you really wanted to use the same map config with a bunch of SETs at the top, that would work fine. The same is true for OVERLIBCAPTION which is the only place the link name is used by default.

Generally, I try to use TEMPLATE as much as possible, coupled with cacti-integrate to do the boring work. Couple that with some simple scripting (or even excel) to generate blocks of sequential switch ports, if that's what you have a lot of, and you can get moving quite quickly. Especially with some relative positioning so you can move the whole block together (position port1, and position the rest relative to that, or to each other).
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!)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest