Script

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Script

Post by extragornax »

Hello, so I would like to know if it is possible to create script(s) that would :
- use SNMP to gather the list of devices ( Extreme network switches ) ( snmp a host then snmp all the devices coming out and then again until reaching the end of the tree.
- then compare the output of the script above with my list of hosts / devices on cacti and add the ones missing with a given template
- then add the host to the correct weathermap ( I have 5 ) in a corner or something and make the link between the 2 connected devices.
- then gather the info required for the link and input it into the link ( port and device ) to make the link work
- send an email telling that a new device has been found and that it should be placed correctly and the infos verified
- then add the device's port to the thold with the template
- send another email telling that the procedure has been followed successfully.

So, do you have any idea if it is possible, in any language usable on a debian vm ?

Thank you
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Script

Post by Howie »

That all sounds possible.
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!)
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

Howie wrote:That all sounds possible.
yes; but how ? :-?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Script

Post by Howie »

You write a script in any of the languages usable on Debian. It's a programming job.
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!)
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

Howie wrote:You write a script in any of the languages usable on Debian. It's a programming job.
I barely know how to code html / css so I guess I can forget my script :(
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Script

Post by Howie »

Or pay someone to write it for you. It's a very specific requirement.

Unless all your switches are L3 devices, just SNMP is not enough to recursively follow through all the switch ports, and then all the ports of connected switches. You will be able to get MAC addresses for all those ports, but to get IPs (which you need to connect with SNMP) you need an ARP table on some device to convert MAC to IP.

Also, you need SNMP enabled on all these devices.

The Discover plugin might do some of this work for you.
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!)
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

Howie wrote:Or pay someone to write it for you. It's a very specific requirement.

Unless all your switches are L3 devices, just SNMP is not enough to recursively follow through all the switch ports, and then all the ports of connected switches. You will be able to get MAC addresses for all those ports, but to get IPs (which you need to connect with SNMP) you need an ARP table on some device to convert MAC to IP.

Also, you need SNMP enabled on all these devices.

The Discover plugin might do some of this work for you.
yes that is what I did manually to get the list of devices in the network

snmpwalk -c public -v1 ( or v2c) -Os (IP or dns name) oid | grep ( if needed ) and so I know that all devices have snmp working, I didn't need there ip but just their dns name works.
What do you mean with L3 device ?
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

also, cacti will get all the ports and their data while the script uses the grep to get the specifi device's port with the oid
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Script

Post by Howie »

This part:
use SNMP to gather the list of devices ( Extreme network switches ) ( snmp a host then snmp all the devices coming out and then again until reaching the end of the tree.
requires that you are able to get the IP for all devices connected to a switch, via SNMP. A switch (a real layer 2 switch) only knows about MAC addresses. You need an IP address for each connected device to do what you are describing. To get the IP address for a MAC address, you need an ARP table from a layer 3 device (router) in the same network. That might be your switch (if it is a layer 3 switch) or a router, or a firewall.
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!)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Script

Post by Howie »

The Discover plugin already does something like this, as far as I know. I have never used it personally.
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!)
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

Howie wrote:This part:
use SNMP to gather the list of devices ( Extreme network switches ) ( snmp a host then snmp all the devices coming out and then again until reaching the end of the tree.
requires that you are able to get the IP for all devices connected to a switch, via SNMP. A switch (a real layer 2 switch) only knows about MAC addresses. You need an IP address for each connected device to do what you are describing. To get the IP address for a MAC address, you need an ARP table from a layer 3 device (router) in the same network. That might be your switch (if it is a layer 3 switch) or a router, or a firewall.
I just want to get he list of snmp responding revices then :s
extragornax
Posts: 37
Joined: Wed Jul 09, 2014 5:15 am

Re: Script

Post by extragornax »

Howie wrote:The Discover plugin already does something like this, as far as I know. I have never used it personally.
I have it installed already but it never worked for me :(
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Script

Post by cigamit »

Discover doesn't work exactly like you are wanting. You basically give it all your subnets, and it does a simple PING and SNMP scan of those subnets to find devices. Its not going to search through a device and follow breadcrumb trails based upon snmp connection info. If SNMP is available on the device (based upon Community names you give it to try) it will add the device to Cacti with a particular Host Template based upon a simple match of the SNMP Description. You would then use AutoMa8 to create the graphs for the host automatically.

From there, you are really on your own with the rest. A plugin could easily be written to most of what you want, but its definitely a custom job.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest