A good starting Weathermap example fromr a weathermap addict
Moderators: Developers, Moderators
-
- Cacti User
- Posts: 164
- Joined: Thu Jan 21, 2010 8:41 pm
A good starting Weathermap example fromr a weathermap addict
To All, I been using Howie weathermaps for the last 5 years plus. Over the years I have developed a strong addiction to network environment monitoring via Howie's tool and infected everyone around me to the point that we use Cacti as our primary network monitoring tool with Cacti Weathermap being the main focus!
Today I would like to share my best knowledge that I have acquired over the last 5 years as well as some transparent images and fonts I have created and collected over the years to support my habit.
I'm including a complete example of map config file as a starting point for anyone looking to create a professional looking map. Of cause I have removed some of the private data to protect the innocent. Please note: There are few features (such as VPN tunnel uptime and CISCO ASA VPN tunnel logout) that use features that isn't currently publicly released code by Howie, but part of development SVN.
Today I would like to share my best knowledge that I have acquired over the last 5 years as well as some transparent images and fonts I have created and collected over the years to support my habit.
I'm including a complete example of map config file as a starting point for anyone looking to create a professional looking map. Of cause I have removed some of the private data to protect the innocent. Please note: There are few features (such as VPN tunnel uptime and CISCO ASA VPN tunnel logout) that use features that isn't currently publicly released code by Howie, but part of development SVN.
- Attachments
-
- Example-map.png (142.44 KiB) Viewed 13212 times
-
- images.rar
- Cacti weathermap Images folder. All the custom images I have created over time.
- (2.18 MiB) Downloaded 1271 times
-
- Example-map.rar
- Map Example conf file + fonts details
- (504.4 KiB) Downloaded 1694 times
Re: A good starting Weathermap example fromr a weathermap ad
Hello,
I wanna be the first to thank you for you work and for sharing. In a world where's so much competition and more and more people are keeping things for themselfs, its a breath of fresh air to see a post like yours.
PS : I've shown your maps to almost everyone I know and its into Cacti/Monitoring.
SO : A big thank you.
I wanna be the first to thank you for you work and for sharing. In a world where's so much competition and more and more people are keeping things for themselfs, its a breath of fresh air to see a post like yours.
PS : I've shown your maps to almost everyone I know and its into Cacti/Monitoring.
SO : A big thank you.
-
- Cacti User
- Posts: 164
- Joined: Thu Jan 21, 2010 8:41 pm
Re: A good starting Weathermap example fromr a weathermap ad
Thank your for a big thank you, but in my opinion the BIGGEST thank you deserves Howie!
Also I would like to comment that I wish people who have done a quality Maps In cacti would post their configs for users to review and use as a starting point. In opinion it would go a long way in increasing visibility of this great project. I for my part always love to examine other people's configs for the maps to learn new ways of how to do things in cacti or at a very least pick new ideas since that is what makes this project great.
P.S I have posted some of my quality maps starting from this page forward: http://forums.cacti.net/viewtopic.php?f ... &start=120
Just screenshots no configs.
Also I would like to comment that I wish people who have done a quality Maps In cacti would post their configs for users to review and use as a starting point. In opinion it would go a long way in increasing visibility of this great project. I for my part always love to examine other people's configs for the maps to learn new ways of how to do things in cacti or at a very least pick new ideas since that is what makes this project great.
P.S I have posted some of my quality maps starting from this page forward: http://forums.cacti.net/viewtopic.php?f ... &start=120
Just screenshots no configs.
- Happiness0
- Cacti User
- Posts: 63
- Joined: Wed Oct 29, 2014 5:01 am
- Contact:
Re: A good starting Weathermap example fromr a weathermap ad
Great, thanks for sharing!
-
- Cacti User
- Posts: 117
- Joined: Fri Aug 22, 2014 2:11 pm
Re: A good starting Weathermap example fromr a weathermap ad
Hi ikorzha758,
Your weathermap is truly amazing and advanced!
I downloaded your weather map example and was shocked at how you were able to achieve so many different functions that I did not know you could do..
I do have a few questions if that's ok..
Is your ISP icon changing colours based on the status? For example, if the ISP is "down", then it shows red? If up, it's green?
How were you able to do the interface status? I'm trying to traceback your source code but I got way too confused.. May you also please explain to me how you were able to put all the info such as:
firewall policy - last pushed, I assume?
is primary xxx vpn tunnel up - how did you make a dynamic picture display yes/no based on status?
active/standby - how do you show the status dynamically?
Thanks so much for your help!!
Your weathermap is truly amazing and advanced!
I downloaded your weather map example and was shocked at how you were able to achieve so many different functions that I did not know you could do..
I do have a few questions if that's ok..
Is your ISP icon changing colours based on the status? For example, if the ISP is "down", then it shows red? If up, it's green?
How were you able to do the interface status? I'm trying to traceback your source code but I got way too confused.. May you also please explain to me how you were able to put all the info such as:
firewall policy - last pushed, I assume?
is primary xxx vpn tunnel up - how did you make a dynamic picture display yes/no based on status?
active/standby - how do you show the status dynamically?
Thanks so much for your help!!
-
- Cacti User
- Posts: 117
- Joined: Fri Aug 22, 2014 2:11 pm
Re: A good starting Weathermap example fromr a weathermap ad
May I also know how you were able to display your bandwidth in percentage?
Re: A good starting Weathermap example fromr a weathermap ad
awesome map
i wish there was a quicker way to make diagrams like your switches. i have about 300 switches.
i wish there was a quicker way to make diagrams like your switches. i have about 300 switches.
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: A good starting Weathermap example fromr a weathermap ad
There is a quicker way - scripting! Or even Excel to calculate the positions for the nodes. I'll write up an example on my blog sometime.
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!)
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!)
-
- Cacti User
- Posts: 117
- Joined: Fri Aug 22, 2014 2:11 pm
Re: A good starting Weathermap example fromr a weathermap ad
@ ikorzha758: any chance you could reply when you're free regarding my questions? You have some pretty awesome features you implemented there...
- Happiness0
- Cacti User
- Posts: 63
- Joined: Wed Oct 29, 2014 5:01 am
- Contact:
Re: A good starting Weathermap example fromr a weathermap ad
I'm not ikorzha758 but to display percent of bandwidth you should look at http://network-weathermap.com/manual/0. ... NK_BWLABEL
Re: A good starting Weathermap example fromr a weathermap ad
Hi,
Thank you for your great job, I use it to manage around 100 Cisco 2960.
To create my weathermaps I use a script in bash.
I use three files, one is the script and the two others are for the position of each node :
The script file :
The position file fort FAST nodes (in my case named "distrib_48_position_fast", used in the script):
The line 1 is for port 1, line 2 fort port 2, etc...
The position file fort GIGA nodes (in my case named "distrib_48_position_giga", used in the script):
After executing the script :
>> Copy/Paste the result of script (stored in a file named as switch name) in the conf file
Script execution :
Two switchs configured in one minute :p
I'm working to determine if port is on top or bottom (the first switch is corrected direct in conf file).
It's not awesome but usefull.
Regards,
Ch3i.
Thank you for your great job, I use it to manage around 100 Cisco 2960.
To create my weathermaps I use a script in bash.
I use three files, one is the script and the two others are for the position of each node :
The script file :
Code: Select all
#!/bin/bash
##################################################
# Configuration
##################################################
CACTI_DB="cacti_database_name"
CACTI_USER="cacti_user" #in my case I create a user in read only
CACTI_PASSWORD="cacti_password"
CACTI_IP="cacti_ip_address"
##################################################
# Get device name and position
##################################################
echo -n "Cacti device name : "; read -e DEVICE_NAME
echo -n "Overlibgraph device port index : "; read -e DEVICE_OVERLIBGRAPH_PORT
echo -n "Position switch (like 200 50) : "; read -e DEVICE_POSITION
DEVICE_ID=$(mysql --host="$CACTI_IP" --user="$CACTI_USER" --password="$CACTI_PASSWORD" "$CACTI_DB" -Bse "SELECT id FROM host WHERE description='$DEVICE_NAME'";)
#check if device exist
if [ "$DEVICE_ID" = "" ]
then
echo "No device found... exit";
exit
else
##################################################
# Create port nodes
##################################################
#lower case the name of device to match with rdd files
DEVICE_NAME_LC=$(echo "$DEVICE_NAME" | awk '{print tolower($0)}')
#empty result file if exist
echo "" > $DEVICE_NAME
# get switch ports and data IDs
mysql --host="$CACTI_IP" --user="$CACTI_USER" --password="$CACTI_PASSWORD" "$CACTI_DB" -Bse "SELECT data_local.id AS data_id, graph_local.snmp_index AS snmp_index, SUBSTRING(graph_local.snmp_index, 4, 2) AS sw_port, SUBSTRING(graph_local.snmp_index, 1, 3) AS sw_port_type FROM data_local INNER JOIN graph_local ON (data_local.host_id=graph_local.host_id AND data_local.snmp_index=graph_local.snmp_index) WHERE data_local.host_id=$DEVICE_ID AND data_template_id=73 AND graph_template_id=48" | while read DATA_ID SNMP_INDEX SW_PORT SW_PORT_TYPE;
do
# get graphs speed IDs
GRAPH_SPEED_ID=$(mysql --host="$CACTI_IP" --user="$CACTI_USER" --password="$CACTI_PASSWORD" "$CACTI_DB" -Bse "SELECT id FROM graph_local WHERE host_id=$DEVICE_ID AND graph_template_id=2 AND snmp_index=$SNMP_INDEX";)
# get ethernet port type (fast or giga) and port position
if [ "$SW_PORT_TYPE" = "100" ]
then
POSITION=$(sed -n $SW_PORT'p' distrib_48_position_fast)
SW_PORT_TYPE_NAME="F"
elif [ "$SW_PORT_TYPE" = "101" ]
then
POSITION=$(sed -n $SW_PORT'p' distrib_48_position_giga)
SW_PORT_TYPE_NAME="G"
fi
# write file
echo "NODE $DEVICE_NAME-$SW_PORT_TYPE_NAME$SW_PORT
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=$GRAPH_SPEED_ID
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=$GRAPH_SPEED_ID
ICON images/port_{node:this:inscaletag}.png
TARGET gauge:/var/lib/cacti/rra/${DEVICE_NAME_LC}_int_status_$DATA_ID.rrd:int_status:-
USESCALE ifstatus in percent
POSITION $DEVICE_NAME $POSITION
" >> $DEVICE_NAME
done
##################################################
# Create switch node
##################################################
# get graphs speed IDs
DEVICE_GRAPH_SPEED_ID=$(mysql --host="$CACTI_IP" --user="$CACTI_USER" --password="$CACTI_PASSWORD" "$CACTI_DB" -Bse "SELECT id FROM graph_local WHERE host_id=$DEVICE_ID AND graph_template_id=2 AND snmp_index=$DEVICE_OVERLIBGRAPH_PORT";)
echo "NODE $DEVICE_NAME
LABEL $DEVICE_NAME
ZORDER 200
LABELOFFSET W
LABELFONT 111
LABELANGLE 90
LABELOUTLINECOLOR none
LABELBGCOLOR none
INFOURL /cacti/graph.php?rra_id=all&local_graph_id=$DEVICE_GRAPH_SPEED_ID
OVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300&local_graph_id=$DEVICE_GRAPH_SPEED_ID
ICON images/sw_2960_distrib.png
POSITION $DEVICE_POSITION" >> $DEVICE_NAME
exit
fi
Code: Select all
-384 -12
-384 16
-355 -12
-355 16
-326 -12
-326 16
-297 -12
-297 16
-268 -12
-268 16
-239 -12
-239 16
-198 -12
-198 16
-169 -12
-169 16
-140 -12
-140 16
-111 -12
-111 16
-82 -12
-82 16
-53 -12
-53 16
-12 -12
-12 16
17 -12
17 16
46 -12
46 16
75 -12
75 16
104 -12
104 16
133 -12
133 16
174 -12
174 16
203 -12
203 16
232 -12
232 16
261 -12
261 16
290 -12
290 16
319 -12
319 16
The position file fort GIGA nodes (in my case named "distrib_48_position_giga", used in the script):
Code: Select all
374 21
421 21
>> Copy/Paste the result of script (stored in a file named as switch name) in the conf file
Script execution :
Two switchs configured in one minute :p
I'm working to determine if port is on top or bottom (the first switch is corrected direct in conf file).
It's not awesome but usefull.
Regards,
Ch3i.
- Happiness0
- Cacti User
- Posts: 63
- Joined: Wed Oct 29, 2014 5:01 am
- Contact:
Re: A good starting Weathermap example fromr a weathermap ad
I do such a thing with a perl script.
This is the code to generate the ports:
The code for the switches:
The result is the one I posted in the "Show off your Weathermaps." thread. The ports are identified with a for loop, so I can perform actions for specific ports and manage the position with $self->{x}. The whole script writes the configuration file for the map in about 15 secs
ch3i i don't know what you grab from your mysql queries but you should check if the port is on top or bottom by testing if the port number is > 24?
This is the code to generate the ports:
Code: Select all
use strict;
use warnings;
use Net::SNMP;
use RRD::Query;
my ($community, $img, $out) = 'xxxx';
open(my $fh, '>', 'carte_switch_mae.conf');
sub newSwitch {
my ($name, $ip, $x, $y) = @_;
my $self = {
'name' => $name,
'ip' => $ip,
'x' => $x,
'y' => $y
};
bless($self, $name);
return $self;
}
sub genPort {
my ($self) = @_;
my $session = Net::SNMP->session( Hostname => $self->{ip},
Community => $community,
port => 161)
or die "Session: $!";
# for the ethernet ports
for (1..48) {
my $query = $session->get_request("1.3.6.1.2.1.2.2.1.8.$_");
my $state = $query->{"1.3.6.1.2.1.2.2.1.8.$_"};
$img = $state == 1
? 'port_up.png'
: 'port_down.png';
$out = "NODE " . $self->{name} . "_$_\n"
. "\tPOSITION " . $self->{x} . " " . $self->{y} . "\n"
. "\tICON images/$img\n";
print $fh $out;
# for the position of the ports
$self->{x} += 17;
$self->{x} += 4
if /\A8\z|16|32|40/;
$self->{x}--
if /\A[3-6]\z|1[024-7]|2[02-47]|3[014-69]|4[0-267]/;
if ($_ == 24) {
$self->{x} -= 403;
$self->{y} += 20;
}
}
$self->{x} += 22;
$self->{y} -= 32;
# for sfp ports
for (1,2) {
my $rq = new RRD::Query('../../../rra/switch_'
. (split '\.', $self->{ip})[-1]
. '_traffic_g' . $_ . '.rrd')
or die ($!);
$img = $rq->fetch('traffic_out', offset => 10)
? 'port_up.png'
: 'port_down.png';
$out = "NODE " . $self->{name} . "g$_\n"
. "\tTEMPLATE port\n"
. "\tPOSITION " . $self->{x} . " " . $self->{y} . "\n"
. "\tICON images/$img\n";
print $fh $out;
$self->{y} += 13;
}
$session->close();
}
[Some stuff here...]
my $switch1 = newSwitch('switch1', 'xxx.xxx.xxx.xxx', 121, 109);
print 'Generating config for ' . $switch1->{ip} . "\n";
genPort($switch1);
Code: Select all
my $dsn = 'dbi:mysql:cacti:xxxx:3306';
my ($user, $pwd) = qw (xxx xxx);
my ($dbh, $error) = DBI->connect($dsn, $user, $pwd)
or die "MySQL : $!";
my $query = 'SELECT DISTINCT (b.id), (b.nom_dns), (a.id), (c.id)
FROM graph_tree_items AS a
LEFT OUTER JOIN host AS b
ON b.id = a.host_id
LEFT JOIN graph_local AS c
ON b.id = c.host_id
WHERE c.graph_template_id = 43 OR c.graph_template_id = 52
ORDER BY b.nom_dns';
my $sth = $dbh->prepare($query);
$sth->execute() or die 'Cannot execute :' . $sth->errstr();
my @row;
my ($x, $y);
while (@row = $sth->fetchrow_array) {
if ($row[1] =~ /40|11/) {
$y = 120
} elsif ($row[1] =~ /25|50/) {
$y = 780
} elsif ($row[1] =~ /30\z|60\z/) {
$y = 550
}
if ($row[1] =~ /40\z|30\z|25\z/) {
$x = 314;
} elsif ($row[1] =~ /11\z|50\z|60\z/) {
$x = 2050;
} elsif ($row[1] =~ /21\z/) {
$x = 1944;
$y = 1180;
}
$out = "NODE img_switch" . $row[0] . "\n";
$out .= "\tTEMPLATE port" . "\n"
if $row[1] !~ /21/;
if ($row[1] =~ /21/) {
$out .= "\tLABELFONT 110\n"
. "\tLABELOFFSET 426 0\n"
. "\tICON images/swich_24.png\n";
}
$out .= "\tLABEL " . $row[1] . "\n"
. "\tINFOURL /cacti/graph_view.php?action=tree_content&tree_id=2&leaf_id=" . $row[2]. "&host_group_data=\n"
. "\tOVERLIBGRAPH /cacti/graph_image.php?rra_id=0&graph_height=200&graph_width=500&local_graph_id=". $row[3] . "\n"
. "\tPOSITION " . $x . ' ' . $y . "\n";
print $fh $out;
$y += 100;
}
$sth->finish;
$dbh->disconnect;
ch3i i don't know what you grab from your mysql queries but you should check if the port is on top or bottom by testing if the port number is > 24?
Re: A good starting Weathermap example fromr a weathermap ad
Happiness0 : In my cisco on top 1 3 5 7... on bottom 2 4 6 8...
I'll post the full script next week, I had the generation of switch an possibility to add it directly on an exisiting map.
I'll post the full script next week, I had the generation of switch an possibility to add it directly on an exisiting map.
Re: A good starting Weathermap example fromr a weathermap ad
I'd like to put on my map links to ssh console to my network devices.
I 'd found in conf file posted by ikorzha758:
What I should do to made "INFOURL ssh://" workable?
Script on cacti?
Something on web browser client site?
I 'd found in conf file posted by ikorzha758:
Code: Select all
NODE XXX_RTR_ssh
INFOURL ssh://xxx@10.10.1.1
NOTES Click here to open XXX Router Console
ICON 13 13 images/ssh.gif
POSITION XXX_2851 106 0
Script on cacti?
Something on web browser client site?
Who is online
Users browsing this forum: No registered users and 2 guests