Visio Guy

Solution-specific Visio Discussions => Network Diagramming => Topic started by: howithink on July 28, 2010, 12:00:49 PM

Title: visio diagram to automatically ping and display device as red or green.
Post by: howithink on July 28, 2010, 12:00:49 PM
OK this might be a big difficult to explain but here it goes:

I have created Visio server room layout diagram. In which i have all the cabinets listed and each server/device represented. I can click on each device to rdp into it and also get my general information like serial, location, os and so on.

What i want to know is, is it possible for me to create an object (green dot, or red dot) next to each object which is actually actively pinging that device in the background so initially when i look at my server room layout, i can know right away if a device is down or not?

thank you


Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: Visio Guy on July 28, 2010, 03:04:06 PM
If you have Visio 2007 Pro, or Visio 2010 Pro or Premium, then data graphics will help you a lot with this.

It helps to store some of that data (Prop.Status = down/up) so that the data graphics can read this and show green or red.

Al (http://visguy.com/vgforum/index.php?action=profile;u=14;sa=showPosts) might have some info on this already. Check out his YouTube Channel (http://www.youtube.com/user/NtwrkTeam)  too!

Also of interest, Al's Visio Guy articles (http://www.visguy.com/tag/al-edlund/).
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on July 28, 2010, 04:02:29 PM
The desire to have current state of a network device is very common. The problem becomes one of how timely of a 'heartbeat' do you want to keep. All of it add's traffic to a network and some of it can actually cause problems, thus the equally strong desire from the network security teams to monitor that type of traffic. Almost all of the MS demo's that I have seen use the SystemCenter product as the query engine (because it is well behaved). In the example code that I put out there (both vb.net and vba) has a 'network friendly' delay component to reduce the chance of flooding the network. The example code that I released uses an ICMP echo (ping) to test for availablity, I've had to use a telnet session request for some networks. In both cases the response is saved to a database of some sort and then the drawing update queries the database (just like the MS demos). In most SMB accounts a user triggered query is adequate, they don't need full time/ real time data. In a large shops the effective organizations use a hierarchial alarm that 'perks up' to show net status (I think David Edson did that in one of his demo's) at a summarization level.
hth,
al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: howithink on July 28, 2010, 05:16:27 PM
@ Visio Guy: i tried your suggestion (by the way i am using visio 2007) and i created a custom field called Status in the shapesheet and used the code, but i don’t see anything happening.

@ aledlund: i dont want our network to be fludded. Obviously i want something that doesn’t get updated all the times. This visio diagram will be access maybe once or twice a day (Right now i have it saved as html and on our sharepoint). Every time it is accessed via the web, i want it to update and color code the device.  Is it possible? and how difficult will it be?

thanks
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on July 28, 2010, 10:11:01 PM
Your desired solution has a web component,

So start with a simple ping command that the results can update an access record

Randy Birch has some phenomenal code over here that can be modified for network queries

http://vbnet.mvps.org/

I have examples in both vba and vb.net for doing the basic pinging as well,

and the vbscript guys have lot's of example code for reaching out to touch data source/sink

http://technet.microsoft.com/en-us/scriptcenter/default.aspx

The visio sdk has examples on automating linking datarecordsets to shapes

my friend David Parker posted this to update the drawing from a datarecordset and post as web  page

http://bvisual.spaces.live.com/blog/cns!3350D61BC93733A9!2170.entry

hth,
al

Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on July 29, 2010, 07:46:48 AM
This is probably a better list of overview videos

http://www.youtube.com/view_play_list?p=BAFAAC68D36484CA

Four of these videos cover vb.net projects that have been released here: ism, wan, app connectivity, attribute drilldown. I'm working on updating the attribute drilldown and app connectivity (better use of lists) in preparation for a more complete drawing package.

al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: agould on September 02, 2010, 12:00:06 AM
i've been doing visio network diagram for years.  i don't know much of anything about the vb stuff ya'll talk about.  i would like to have an object in visio diagram change to green or red based on ping response or lack thereof.

can someone just do a one object (little square is fine) diagram and have it ping 192.168.1.1.....and based on that have the square be red or green?  that would be great, then i would have an example diagram that i could refer to as to how you accomplished this.

have it ping every 30 seconds please.  32 bytes of data is the typical ping size.

please put it somewhere here that i could download it or just email it to aaron01@juno.com

if that isn't possible, perhaps someone could just explain to me how to do it.

thanks
aaron
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: Nikolay on September 02, 2010, 09:59:17 AM
Here is a simple "red-green" Visio drawing (plus some VBA code)

It has three boxes with IP-addresses (see picture)
You can add more boxes or change the IPs, i.e. the text in the boxes; keep in mind, only 4-digit IP addresses are supported (no name resolution).

VBA code "in background" colors each box red, if PING to it's IP fails or green if it succeeds.
The refresh timer is set for 30 seconds.

Seems to work  ;)

N.B. I don't think that VBA is a good idea for this kind of "diagrams".
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: agould on September 02, 2010, 07:06:00 PM
thanks nikolay.  it seems to ping and do the green and red thing, but it ran very sluggish and i would need to do this with a diagram of about 300 boxes!!

is there a better way to accomplish this?

aaron
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: Nikolay on September 02, 2010, 10:41:26 PM
My drawing was designed just to demonstrate that it is possible to do that with VBA.
I think that to make the solution responsive you may consider moving "ping activities" to a real "background" process (background thread) instead of the timer (used in this solution).
Unfortunately, you can't really do that with VBA (real background threads/processes are basically not supported in VBA)

The options I can see are:
- Create a separate application for this (using Visio as control).
- Create an addin for Visio that implements that refresh.
- Create some server app that pings and provides states as a data table then link Visio diagram to that table.
- The same thing as previous, plus Visio Services - and you may have a neat web-based solution.
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on September 05, 2010, 08:09:26 PM
If you have 300 devices you are trying to manage, you might consider

http://www.microsoft.com/systemcenter/en/us/essentials/sce-compare-products.aspx

al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on September 06, 2010, 08:01:21 AM
Just as an fyi, if you're doing that many devices for status you should really be using something that can work synchronously. For a different project I had to work on one with several thousand devices and eventually went with a third-part control (www.dart.com) using vb.net. The load on the system eventually required a separate system to do the status capture since besides the network load the status has to be stored and then passed to the drawing code. In the end it's less expensive to go with an appropriate commercial product, unless you have a good budget for hours (weeks) spent and some very unique requirements.
al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: BullDog on February 01, 2011, 03:50:41 PM
Gotta silly question.  But for a server farm sort of set up with hundreds of pieces of equipment and expensive labor monitoring it, wouldn't it be more productive to just deploy an instance of a SiteScan type of product?  Thanks.
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on February 01, 2011, 04:16:05 PM
For some clients, people (and their time) can be perceived as being less expensive than tools.Some shops just don't want to spend the money, so you start looking for an alternative tool suite.
For all of these discussions you have to start with a "build, buy, or lease" set of issues included. This of course includes the "buy single vendor, or do the system integration yourself", "is it a one time project, or are we performing ongoing process development", and a lot of other decisions.
Al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: BullDog on February 02, 2011, 09:54:35 AM
Thanks Al, I think so too.  As long as folks remember the cost / benefit of the various options along with the time to deploy needs to be evaluated on a case by case basis.  My concern is that certain non-technical folks (managers) think they can wave a magic wand and have large scale exercises miraculaously developed and deployed on a fast track in the absence of appropriate resources.  Seen it time and time again...  the learning curve can be expensive in many many ways.  I've seen first hand how the do-it-yourself method can takes months / years on the leanring curve, vs just getting it done on a fast track by deploying the right tools and know how (and occasional third party resources).

I found this site / thread as I'm trying to use Visio to convert AutoCAD dwg files to something I can then modify and use in a Java development environment for web based building automation systems (ie I need to end up with a basic yet also decent quality png file when I'm done).  This site has been very helpful in that regard.
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on February 02, 2011, 12:16:42 PM
It's a popular topic. You might check these out (especially the included demo)

http://visguy.com/vgforum/index.php?topic=1241.msg5435#msg5435

al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: cliff50 on March 22, 2011, 01:07:18 AM
Al ,
it is an interesting concept,  to create a visio manifestation that apsires to display the on line status of the actual network.

From my experience, manufacturers of Network equipment often sell some sort of alarm monitoring system, albeit the GUI of which is not very versatile and has limited customisation.

I think telnet pinging to data nodes and interrogating the response or lack thereof may have open some avenue to determining node status, and as said, may also create its own set of problems flooding large networks with unneccesary traffic ,  i guess it all depends on the rate of change of what you are trying to track.

Again in my experience, "as built" vs "is built" maybe best served by a strict enterprise change control process, the problem there being once a "phantom" change is discovered the process of determining who,  and when a change occured becomes more relevant, then where or what change occurred.

our approach, was to create a customised data capture script which we run via the nodes local craft terminal interface, approximately every 3-4 months. Changes are detected and advised to the Visio doc maintainer who is empowered to update and vaildate each change.
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on March 22, 2011, 07:35:27 AM
The observation of "problems flooding large networks with unneccesary traffic" is very appropriate. At least one early study that  I saw several years ago observed almost 25% of the traffic on the Internet at that time was 'network management'. To make matters worse the echo command by design is supposed to be discarded when the network is in stress, thus TCPIP throws away the messenger that tells it there is a problem. This drives the discussion towards "alarming" vs "heart beat".
Telnet 'pinging' vs Echo 'pinging' should only be used under exceptional circumstances.
In any case using Visio as the visualization mechanism is an interesting exercise but is not intended to replace machaisms such as CiscoWorks or tools such as Openview and Netview. Unfortunately as a network consultant I was never guaranteed that any client would have what I would consider a catalog of tools to provide a minimally documented network, much less hope for materials that could be used to provide their management with a defendable appraisal of their current status. The defense was a toolkit that was portable and customizable for what I was being contracted for. Visio to the rescue..
My personal favorite experience was with the client where change/configuration management was a documented condition of employment. If they caught you making an undocumented/unauthorized change you were open to separation from the company.
Al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: vijay4b7 on May 24, 2014, 07:04:18 AM
Here is a simple "red-green" Visio drawing (plus some VBA code)

It has three boxes with IP-addresses (see picture)
You can add more boxes or change the IPs, i.e. the text in the boxes; keep in mind, only 4-digit IP addresses are supported (no name resolution).

VBA code "in background" colors each box red, if PING to it's IP fails or green if it succeeds.
The refresh timer is set for 30 seconds.

Seems to work  ;)

N.B. I don't think that VBA is a good idea for this kind of "diagrams".

Hi Nikolay,

I am new to this forum and Visio too.
Just started learning drawing a simple network topology diagrams.

Basically, I am developer on C language. We write protocols for switches and routers.

Coming to the point. I have a Lab with 20 devices.
I have made a small topology for our testing. So, started drawing a diagram for the same.
Here came the requirement after setting up the toplogy.

Requirement:
Visio diagram to automatically ping and display device as red or green.

Exactly this thread and found your example. Which is working great, but most of the times it is sluggish.
I have copy pasted more boxes to ping other devices too.

I would like to know, how you have created the code? Need some inputs on that.
I want to learn.

I want use switches (Senticls) and write the same piece of code, which should ping my devices when ever required.

Also, I would like to know, whether this is possible only through Visio?
I mean let's say, I done the work and save the file in some other format? do I still get the requirement?

Please mail me the steps to follow.
vijayraju11@gmail.com

 



Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: dave748 on March 04, 2016, 05:12:16 AM
Hi,

I know this topic hasn't been posted in for a long time but I have a Visio document I use to look at the various sites in my network.  I a few macro's running that allow me to telnet to a device using double click and some mouse overs that give me extra info and a few other things.  On the front page is a list of all the sites that I double click on to go to the page of that site.  What I'd like is to put a small circle next to each site name that stays green when pinging an ip address at that site and turns red when it can't be reached.

I've tried to adjust the ping green and red square Visio code posted a while ago in this forum but I want it to only work on specific shapes in the document not every shape as per the For Every shp, For Loop in the code.  I'm only going to be pinging about 10 devices and I can't install any kind of external software so it has to be done in visio in VB code.

I beleve the part of the code I need to adjust to point to a single shape is the below:

Public Sub UpdatePingState()
           Dim shp As Shape
           For Each shp In ThisDocument.Pages(1).Shapes
           IP = "**.**.**.**"
           etc.
           etc.

I've tried various things to make it point to one particular shape but not been able to do it, can anyone help?
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: JohnGoldsmith on March 04, 2016, 06:14:05 AM
Hi,

I would be tempted to build this into your master shape.  For example, if you have a Group shape and add a circle shape to it, the group shape would have Shape Data such as Prop.State and this is the cell your code would write to.  Your sub-shape (the circle) would reference the Shape Data in the group and change it's colour accordingly.  This way you can separate the visual change from the state data.  You could then start your ping code by setting the Shape Data:

Code
shp.CellsU("Prop.State").FormulaU = "Starting"

make you ping call, wait for the result and then set the Shape Data cell once more with the result:

Code
shp.CellsU("Prop.State").FormulaU = "Success"

Once you've got a master you can use the CreateSelection (https://msdn.microsoft.com/en-us/library/office/ff767064.aspx) method on Page to get a selection object based on that master.

If you can't do this by master then you'll need to determine some other method of how you uniquely indentify your target shapes - by a particular Shape Data / User cell, maybe with a particular value, by position on the page etc.

Hope that helps.

Best regards

John
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: dave748 on March 04, 2016, 09:03:44 AM
Hi,

I would be tempted to build this into your master shape.  For example, if you have a Group shape and add a circle shape to it, the group shape would have Shape Data such as Prop.State and this is the cell your code would write to.  Your sub-shape (the circle) would reference the Shape Data in the group and change it's colour accordingly.  This way you can separate the visual change from the state data.  You could then start your ping code by setting the Shape Data:

Code
shp.CellsU("Prop.State").FormulaU = "Starting"

make you ping call, wait for the result and then set the Shape Data cell once more with the result:

Code
shp.CellsU("Prop.State").FormulaU = "Success"

Once you've got a master you can use the CreateSelection (https://msdn.microsoft.com/en-us/library/office/ff767064.aspx) method on Page to get a selection object based on that master.

If you can't do this by master then you'll need to determine some other method of how you uniquely indentify your target shapes - by a particular Shape Data / User cell, maybe with a particular value, by position on the page etc.

Hope that helps.

Best regards

John


Thanks John,

Would it be possible to reply as if your talking to someone who is not a VB scripter or visio expert but who can, given enough time, manipulate very simple code other people have written to do sort of what I want it to do.  This one I'm struggling with though.

I don't want to change the way it works, I just want to apply the code to a specific shape(s) rather than every shape on the page, there must be an easy way to do that.
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: JohnGoldsmith on March 04, 2016, 11:34:39 AM
Sure - on what basis do you want to choose which shapes to process?  Normally this would be based on a particular master shape.  Are the shapes you want to target based on a master?

Best regards

John
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on March 04, 2016, 11:47:36 AM
assuming that this is v20xx pro and can support datagraphics, I would tie the indicator to a status property that is only available on the shapes with an ipaddress that is 'pingable' and has been tested.
That resolves the issue of not having the datagraphics tied to every shape.
al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: JohnGoldsmith on March 04, 2016, 03:36:30 PM
Good point Al.  I have a ShapeSheet hammer so all I see are new masters :)
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: aledlund on March 05, 2016, 09:24:20 AM
John,
One of the challenges I had to face was the client wanting to include 'future' devices in the drawings, which did not yet have a valid IP address assigned. What I ended up doing was assigning an invalid address to the device to allow the code to step past the attempted pinging. I used the address of "911" for the key to ignore the device, and then would flag the device status as questionable.
hth,
al
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: hrvoje144 on August 06, 2020, 03:29:01 AM
Is there this code for win64 i am newbie in VBA?
Title: Re: visio diagram to automatically ping and display device as red or green.
Post by: Surrogate on August 06, 2020, 03:48:18 AM
Is there this code for win64 i am newbie in VBA?
Try add PtrSafe (https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/ptrsafe-keyword) keyword, like
Code
Private Declare PtrSafe Function SetTimer

Compatibility Between the 32-bit and 64-bit Versions of Office 2010 (https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2010/ee691831(v=office.14)?redirectedfrom=MSDN)