Sunday, February 03, 2008

System data gathering super mega script

I'm running this script on a Linux box to gather info on the processes it is running, besides, of course, Nagios.
That box was having a problem that sometimes, totally random stuff, the network went down, this particular box has two NICs, but I can access it only thru SSH, so, went the net went down, I lost the box completely.
Ever since I started to run the script, this system stopped having troubles...
An option I have considered was using a software Watchdog, but I'm not that convinced on running one.


#!/bin/sh
# Data gather script (Modified from one found on Internet)
# /root/devel/dataGathering/system-snapshot.sh
# Be sure to run logrotate on $LOG (!)

ECHO='/bin/echo'
DATE='/bin/date'
UPTIME='/usr/bin/uptime'
CAT='/bin/cat'
PS='/bin/ps fuaxww'
NETSTAT='/bin/netstat -na'
LOG='/var/log/system-snapshot.log'


${ECHO} "0000000000000000000000000000000" >> ${LOG}
${DATE} >> ${LOG}
${UPTIME} >> ${LOG}
${CAT} /proc/meminfo >> ${LOG}
${PS} >> ${LOG}
${NETSTAT} >> ${LOG}

# EoF #

Labels: , ,

2 Comments:

Anonymous Anonymous said...

Keep up the good work.

5:53 AM  
Blogger hictio said...

You 2 Dudez! Keep up those insurances, baby!

2:19 PM  

Post a Comment

<< Home