thelowlyone Posted May 22, 2006 Share Posted May 22, 2006 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. Quote Link to comment Share on other sites More sharing options...
manuel Posted May 22, 2006 Share Posted May 22, 2006 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 Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 22, 2006 Share Posted May 22, 2006 Extremely ambitious, but a cool idea. Quote Link to comment Share on other sites More sharing options...
Sparda Posted May 22, 2006 Share Posted May 22, 2006 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] Quote Link to comment Share on other sites More sharing options...
Darren Kitchen Posted May 22, 2006 Share Posted May 22, 2006 What you need is a seperate computer polling the servers at a set interval and generating a page accessible from the Internet. A simple ping will tell you whether the server is online or not. As for services, check out the NET command. A great resource for NT commands is http://www.ss64.com/nt/ Quote Link to comment Share on other sites More sharing options...
override Posted May 22, 2006 Share Posted May 22, 2006 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/ Quote Link to comment Share on other sites More sharing options...
thelowlyone Posted May 22, 2006 Author Share Posted May 22, 2006 Thanks for all the suggestions. I really liked what Nagios can do but I don't want to have to setup an linux box just to do this. I think I'll try the txt file thing. Any other suggestions would be great. Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 22, 2006 Share Posted May 22, 2006 (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. Quote Link to comment Share on other sites More sharing options...
thelowlyone Posted May 22, 2006 Author Share Posted May 22, 2006 Wow, that's exactly what I'm looking for sentinel. I'll try it when I get home and find some time. I'll post back after I've tried it. Quote Link to comment Share on other sites More sharing options...
thelowlyone Posted May 23, 2006 Author Share Posted May 23, 2006 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. Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 23, 2006 Share Posted May 23, 2006 ... 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. Quote Link to comment Share on other sites More sharing options...
Darren Kitchen Posted May 23, 2006 Share Posted May 23, 2006 Ooh! I'm so getting into this thread when I get home from work. Batch scripting, my kinda stuff. Ok, useless post, consider it a placeholder :) Quote Link to comment Share on other sites More sharing options...
mubix Posted May 23, 2006 Share Posted May 23, 2006 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. Quote Link to comment Share on other sites More sharing options...
igodit Posted May 23, 2006 Share Posted May 23, 2006 You should look at Zabbix or OpenNMS Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 23, 2006 Share Posted May 23, 2006 Thanks for the comments :) It might actually be possible to do that input file list thingie. You could just use a loop or two. LOL I'm not even a coder, I'm just having fun. :P Quote Link to comment Share on other sites More sharing options...
thelowlyone Posted May 25, 2006 Author Share Posted May 25, 2006 Works great, sentinel! Thanks a lot. Sorry it took so long but I've been busy. As for why I couldn't access (FTP version of script) from the phone I have no idea but I could access it fine from a computer. Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 25, 2006 Share Posted May 25, 2006 :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) Quote Link to comment Share on other sites More sharing options...
sentinel Posted May 25, 2006 Share Posted May 25, 2006 Ooh! I'm so getting into this thread when I get home from work. Batch scripting, my kinda stuff. Ok, useless post, consider it a placeholder :)Lies! Quote Link to comment Share on other sites More sharing options...
thelowlyone Posted May 25, 2006 Author Share Posted May 25, 2006 Lies indeed Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.