BUILD A NETWORK MONITORING SYSTEM WITH VISUAL FOXPRO
I have completed the main part of the programming for a centralized monitoring application that has the ability to look out on our network and verify if key servers, or computers are in fact attached to the network. In our case all our production servers should be in this program and any key workstations that should be left running all the time. The main purpose for coding this application was the verification of the newly planned scale site computers being attached and seen on the network. However, this same application can test for any computer name and provide us an early warning system in the event any key servers / computers cannot be seen.
This program is called Monitor.exe and is only 84k in size, thus very little memory is required on our AdminPC for this application to be running all the time. If a key computer is not seen, a warning message is displayed advising us of a problem.
The second part provided us the ability to add user names, say for our IT members. Once, a problem is detected (not seeing a computer in the list), by the Monitor program; Monitor will advise us using NET SEND and we will receive the message on all our desktops of the potential problem.
The entire installation to the AdminPC involves:
1: Create a folder on the AdminPC called Monitor.
2: Copy all the files for this application into the AdminPC's C:\Monitor folder. Ensure the VFP runtime library files are in the folder, or copied in the C:\WinNT\System32 folder.
3: Place a shortcut on the AdminPC's desktop to point to C:\Monitor\Monitor.exe
4: Copy this shortcut into the AdminPC's startup folder.
That's it. When the AdminPC is booted Monitor will automatically load each time.
Basic Use and Operation
Above is what the Monitor application looks like loaded. You will note the server names I have added for testing purposes. Computer names can be added, edited, and deleted via the command buttons on the right of the screen. You can change the timing scan interval as to the frequency you wish on the network. If the computer is not seen a graphic "No" image will appear beside the computer name. If the computer is seen a graphic smilie face with "OK" will be seen beside the computer name. You can stop the program from scanning with the Stop this Program button and start it up again with the Startup this Program button. You can as well Exit & Close this Program say for a weekly server reboot.
This next screen shot shows what the error screen looks like if a computer name is not detected on the network.
The setup of this application is very simple. Below is a screen shot of the setup screen.
As you see, there are only 2 things you need to enter in the setup. One is the actual timer interval. This is in seconds how often you want this application to scan for the computers in the list. You need at least 10 seconds per computer name. So if scanning 14 computers in total, you would need to set the interval at a minimum of 140 seconds. This is due to the Ping command takes 5-6 seconds and 10 seconds is amply for the ping to return the ping test per computer. I suggest a scan every 30 minutes, or every 1800 seconds.
Note: The only procedural issue is, if you are going to work on the AdminPC you should stop this scan while working and start it up again after finishing. This is due to the fact when issuing the Ping and Net Send command, they obtain the focus in a suppressed DOS Window and the application you are working in will loose its focus at the time of the 30 minute scan cycle. This will not hurt anything, just after the scan is over you will have to click into your application again to continue working with it. The second input would be a list of user ID's to be advised of a problem using the NET SEND command.
Net Send Capabilities
Below is a screen shot of the NET SEND message.
We can enter in all our IT user names if we wish to ensure someone is notified of the potential problem.
This is a very simple and easy utility to use. Installation takes 3 minutes and the only maintenance is to keep your key computers in the scan list and the user names we wish advised with NET SEND.
In total, the entire application as it exists took 3 hours on Sunday afternoon and an additional hour here at work to test functionality with the NET SEND command.
I think that this very simple application will assist Foxite users in the following areas that are frequent questions on the
- How to properly use Formsets with VFP.
- How to use the Ping command and Net Send with the suppression of the DOS window. These prg's will apply to other shell outs you have to perform.
- How to properly use Formsets as top level forms and suppress the VFP environmental window. For this, see my Main.prg and the Config.PFW in the project.
- General image graphics that you can use with automated GIF's to enhance a simple application.
- How simple are the VFP commands to run this application? … no brain surgery here!
- From Foxhound, some code to display different graphic images in a grid. In this case there are only 2 images added to the Grid.Column3. Based upon the Grid.Column3DynamicCurrentControl: IIF(Monitor.Status=.T.,'Image1','Image2'), the image will change based upon a true, or false from the Pinger() function. As well, Foxhound had a bit of code for Ping MS-DOS windows suppressions… so I thank him for his options.
- Basic structure in a Main.prg (startup program).
- Using a memory file versus an ini file for startup parameters.
- And the bottom line is that within the family of Foxite, when being able to post a question and within a few hours get several views to pick from… well this is the "Best of the Best!"
As with all my examples you will only find very basic VFP coding. No complicated classes here, just pure and simple Visual FoxPro code. As I am a VFP advocate, look at the "About Me" on the main Monitor screen, the yellow question mark icon and click on it. As in all my applications within my corporation, I ensure I include this type of message and the "Powered by Visual FoxPro" logo. In this way I do what I can to promote this language. Does this at time rub corporate staff the wrong way, as VB is their standard? To answer this "Yes", but I now got corporate IT people visiting me, and asking questions about VFP. I got their attention, as more and more of what we code in VFP seems to flow into corporate systems-lol. As if I had a doubt!
I do have to end this with the recognition for Eric who I know has put a lot of personal time into the Foxite site. I am so happy Microsoft has recognized him for his work and efforts. It gives me great pleasure to see this, and give me great pleasure to be part of the Foxite team.
You can download the discussed program and source codes
. The download is a zipfile. Its size is 83,308 bytes.
ABOUT THE AUTHOR: PETE SASS
Pete has worked in the computer world since the late 70's. He loves the outdoors and lives in a small town called Marathon, in the north of Canada.
@ 12/7/2008 5:38:01 PM
@ 2/10/2009 9:17:03 PM
very very good
@ 7/7/2009 6:04:27 PM
it's OK! well i had just looking a sample program that will help me to create a school system...'coz when I tried to make a program in MS Access it was limited to 1 PC only and I could't link it to other PC's so I decided to try in MS Visual Foxpro but unfortunatelly it was long time ago when I used Foxpro as a programming language so I need to refresh my knowledge about it. And it helps me a lot when I got your very useful program. Hope to have more sample program!
Enter the code shown: