Wednesday, January 5, 2011

Morning Coffee

As promised, this post is for you network/sysadmins that get to work early.
I was walking around and checking on machines every morning and even though I enjoyed the walk sometimes,  decided there should be a better way.
I check around 50 devices every morning this way.
So, with the idea of keeping it simple stupid (KISS), here is what you can do.

This is a simple program to run while you drink your morning coffee.  It will "reach out" to all of your networked servers, workstations, routers, printers, copiers, and anything else on the network.


Here is the premise.  Use the ping command to your advantage. 
[ping -c 2 mycomputer@mydomain.com]   will send out 2 pings to my computer@mydomain.com and wait for 2 replies for the standard wait time.
(Remove the brackets in the above line)
You can change the count to 1, if desired.  I always do 2 just to be sure.
If there is no reply and a timeout, the ping command will reply with "no packets received" or "0 packets received"  etc. 
Redirect the output to a text file and you have a morning report.
Overwrite the report each morning and there is no report cleanup at the end of the week. 


Use VI or similar text editor and make a file called:
start_ping_all.sh

Include the following code:
/home/<your files>/ping_all.sh > ping_report.txt
exit
#end


(The file path must be explicit)
This creates/overwrites a text file: ping_report.txt
--------------------------------------------------
Make another file named:
ping_all.sh

Include the following code:
ping -c 2 yourcomputer@yourdomain.com
#
ping -c 2 yournetworkprinter@yourdomain.com
#
ping -c 2 123.123.123.123


#END

If you are using DHCP, you will not have a static IP address, so you must use the full machine name.
If you are using static IP addresses, you can use the IP address.
Build the ping_all.sh file one time and edit as machines are deleted or added.
Run chmod 755 on both files to make them executable.


Run the program when you sit down with your first cup of coffee and you can read the report in a few minutes.  I check 50 pieces of hardware in about 5 minutes. 
Get ahead of the game in the mornings and enjoy the day.
Jim

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.