Script
Moderators: Developers, Moderators
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Script
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
- 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
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: Script
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!)
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!)
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
yes; but how ?Howie wrote:That all sounds possible.
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: Script
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!)
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!)
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
I barely know how to code html / css so I guess I can forget my scriptHowie wrote:You write a script in any of the languages usable on Debian. It's a programming job.
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: Script
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.
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!)
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!)
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
yes that is what I did manually to get the list of devices in the networkHowie 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.
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 ?
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
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
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: Script
This part:
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.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.
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!)
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Re: Script
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!)
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!)
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
I just want to get he list of snmp responding revices then :sHowie wrote:This part:
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.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.
-
- Posts: 37
- Joined: Wed Jul 09, 2014 5:15 am
Re: Script
I have it installed already but it never worked for meHowie wrote:The Discover plugin already does something like this, as far as I know. I have never used it personally.
Re: Script
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.
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.
Who is online
Users browsing this forum: No registered users and 1 guest