Jump to content

Network Monitoring


thelowlyone

Recommended Posts

I don't know if this is the right place to ask this question so if it doesn't belong here move it.

This is what I want to accomplish: Network with domain consisting of Win2k, XP, and 2003 servers. I want to have a way to monitor all the servers (30+) with my cell phone. Preferably, I want to have "reports" automatically generated to be in html format so I can use my phone's web browser to view it.

What I want the "reports" to contain: Name or IP of server (both would be best) and its status (online, offline, etc.). And a short list of the processes running on it.

I want to accomplish this using free software or batch scripts. (I kind of want to learn how to write batch scripts :D ) So what would be the best way to do this?

Second thing I want to accomplish: Network without domain consisting of WinXP and 2003 servers/workstations (10 to 20). Same as above but on a network without domain.

Oh and yes, I want it in HTML format. Nothing else. And by the way, I don't really know how to program. I took an intro class to VB .Net and thats it. So the easiest way to do this would be best.

Any help or suggestions would be greatly appreciated.

Link to comment
Share on other sites

you might want to look at nagios ( www.nagios.org ) mixed with an apache web server, you could accomplish this (I think). It can be setup to email, sms or whatever you want on hosts -- not completely sure about processes list, but I think its possible.

I have not installed this myself, however I have seen it in action and it works great when setup correctly.

-Manuel

Link to comment
Share on other sites

I t seems doable to me, it seems to me that it would be easy to actualy get all this information. You would just write this informtion to a file like so:

ipconfig >> file.txt

for the IP address, you could do

ipconfig /all >> file.txt

if you realy want the host name, and then for the list of proccesses

tasklist >> file.txt

the only problem with this method is that it won't be in html formate, it is, however, in plain text so any web browser should beable to view it.

I'm not sure what you mean by status, offline would say to me the computer it turned off and vis versa.[/code]

Link to comment
Share on other sites

If you want more than just the online status of the servers you can use MRTG to generate graphics and make them accessible from the internet in html format. You can get information on traffic, users online, services, pretty much everything if you have a good SNMP daemon on the servers.

I've been using it this semester at a Network Configuration and Management class and it's pretty cool.

http://oss.oetiker.ch/mrtg/

http://net-snmp.sourceforge.net/

Link to comment
Share on other sites

(Note: This most of this will only work on a Windows XP Pro or 2003 machine)

Maybe try something like this: (I haven't tested it, I hope it works)

@echo off

@systeminfo | @find "Host Name:" >> c:info.txt

@systeminfo | @find "[01]: 192.168" >> c:info.txt

@systeminfo | @find "System Up Time::" >> c:info.txt

@tasklist >> c:info.txt

You can also poll other, connected, computers with these commands, using the /s switch followed by the computer's name or IP.

Go into a command line (Start > Run > cmd) and type either of these to find out more about these commands or the fanciness you can do with them:

systeminfo /? (or even just systeminfo by itself to see what it outputs, also look here)

tasklist /?

put your final product in a new text file in notepad and save it as whatever.bat

then use the windows task scheduler to run it at a regular intervals

The '>>' operator adds on to the file, so if you don't want to keep adding on to the same file, make the first line only use '>' to start fresh.

If you really want to get fancy you could have the same script upload this file you created to your webserver so it's accessable (if it's not run locally) http://www.computerhope.com/software/ftp.htm

So the final product might look like this:

@echo off



@echo . > c:info.txt



@systeminfo | @find "Host Name:" >> c:info.txt

@systeminfo | @find "[01]: 192.168" >> c:info.txt

@systeminfo | @find "System Up Time::" >> c:info.txt

@tasklist >> c:info.txt



@systeminfo /s COMPUTERNAME1 | @find "Host Name:" >> c:info.txt

@systeminfo /s COMPUTERNAME1 | @find "[01]: 192.168" >> c:info.txt

@systeminfo /s COMPUTERNAME1 | @find "System Up Time::" >> c:info.txt

@tasklist /s COMPUTERNAME1 >> c:info.txt



ftp -s:c:uploadinfo.txt

for the FTP you'll need to make a second file (c:uploadinfo.txt, in this example)

open FTP.DOMAIN.COM

USERNAME

PASSWORD

cd public_html

put c:info.txt

bye

I dunno, hope that helps. Let me know if you have any more questions.

Link to comment
Share on other sites

Ok, so I tried it the way sentinel suggested. It's working fine except for one thing. I can get it uploaded to my FTP server but I can't access it from the phone. And I decided that including the process list wasn't necessary. My main concern is whether or not the servers are up. Something that just says: Server1 is up or Server1 is down. Nice and simple. Anyone else have any suggestions? I really appreciate all the help so far.

EDIT: I would also like another way of uploading because the way its being done right now means my username and password for the FTP server is in readable format.

Link to comment
Share on other sites

... I can get it uploaded to my FTP server but I can't access it from the phone...
What do you mean by this exactly? Have you tried from a computer?

The FTP script in my example changed to a directory called public_html. On your server you may not have to change to any directory, or you may have to change to a different one. Try to log in with an FTP client and see if it puts you right where the files are supposed to go.

I've redone it. I simplified the output as you wanted, and I changed it to an html page with simple formatting. Give this one a try.

@ECHO off



SET filename=c:status.htm



ECHO ^<html^>^<body^> > %filename%

ECHO ^<b^>Server Status at %time%^<^/b^> >> %filename%





ECHO ^<br^>>> %filename%

ping Server1 -n 1 -w 100 >NUL

if %errorlevel% NEQ 0 (

    ECHO Server1 is down.>> %filename%

) ELSE (

    ECHO Server1 is up.>> %filename%

)



ECHO ^<br^>>> %filename%

ping Server2 -n 1 -w 100 >NUL

if %errorlevel% NEQ 0 (

    ECHO Server2 is down.>> %filename%

) ELSE (

    ECHO Server2 is up.>> %filename%

)





@ECHO  ^<^/body^>^<^/html^> >> %filename%

If I were doing this for myself, I might change

    ECHO Server1 is down.>> %filename%

) ELSE (

    ECHO Server1 is up.>> %filename%

to

    ECHO Server1 is ^<font color=FF0000^>down^<^/font^>.>> %filename%

) ELSE (

    ECHO Server1 is ^<font color=00FF00^>up^<^/font^>.>> %filename%

It complicates the code a bit but it colour-codes the output with a simple visual redlight/greenlight idea.

EDIT: I would also like another way of uploading because the way its being done right now means my username and password for the FTP server is in readable format.
That's a valid concern, but a little trickier. The only thing I can think of is if you were to store the password and other server info (securely) in an external FTP program and then access that from batch commands or automate it in some other way. I think WS_FTP will let you do that. I'm too tired to do it all tonight, but maybe tomorrow.
Link to comment
Share on other sites

Another meaningless post, but AWESOME job on the scripting. I guess I should put more faith in batch files. mubix = bash scripter != batch scripter. but maybe soon. Thanks sentinel.

EDIT: Now all you have to do is make the script able to take a list of ips from a file, and/or use network ranges. Then market it as a network monitoring tool and make millions.

Link to comment
Share on other sites

:D

Great! I'm glad you're happy.

I was thinking about that FTP thing, and if you were to use a program like AutoFTP it could store your password slightly more securely, and you could have it automatically run when the file changes or on a regular timed interval. (or even just launch it from the script)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...