#76689 - 2003-09-15 10:49 PM
Server Monitor
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Trying to rebuild our server monitor, which currently is a batch file using marker files..
Here is my initial attempt converting this to KiXtart -
code:
BREAK ON CLS
$srvlist=@scriptdir+'\SRVLST.INI' $srvMrk=@scriptdir+'\SRVMRK.INI'
:start ?'starting process' enumini($srvlist) ?'Process complete' SLEEP 1 GOTO start
FUNCTION ENUMINI($fl) DIM $sections,$keys,$sectionkey,$sectionentry,$rc,$resource,$i $sections=split(readprofilestring($fl,'',''),chr(10)) FOR EACH $sectionentry IN $sections IF $sectionentry <>'' ;?'Section '+$sectionentry $keys=split(readprofilestring($fl,$sectionentry,''),chr(10)) FOR EACH $sectionkey IN $keys IF $sectionkey <>'' ;? 'Key "'+$sectionkey+'" = "'+readprofilestring($fl,$sectionentry,$sectionkey)+'"' $resource=readprofilestring($fl,$sectionentry,$sectionkey) IF Ping($resource,0,12,5000) ;pings for max. 60 seconds $resource+' is running..'? ;Clear out the marker file $rc=writeprofilestring($srvMrk,'SERVERS',$resource,'') ELSE FOR $I=1 to 13 $resource+' server not available'? ;Create a Marker each time that it fails $rc=writeprofilestring($srvMrk,'SERVERS',$resource+$i,@time) NEXT ;if it hits 60 minutes, page IF $I=12 MAILER($resource) ENDIF ENDIF ENDIF NEXT ENDIF NEXT ENDFUNCTION
FUNCTION MAILER($resource) $mailhost='smtp.company.com' $recipient='kdyer@@company.com' $mailLine=@ldrive+'Programs\blat.exe - -to $recipient -server $mailhost -subject $resource+" server not available" ' $mailLine=$mailLine+'-body $resource+" server not available for 60 minutes" -f $recipient -q' SHELL $mailLine ENDFUNCTION
; http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000012 > PING()
It is a real rough draft at this and needs cleanup.
Thanks,
Kent
|
|
Top
|
|
|
|
#76691 - 2003-09-16 05:05 AM
Re: Server Monitor
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Les,
You are right.
I was running out of time for the day to leave for home.. So, yes my words were a bit sparse.
Using an INI file for the servers"
code:
1=SERVER1 2=SERVER2 3=SERVER3
Read in the server, check to see if it is on-line.. If it is not, create a marker. Wait 5 minutes and PING again.. If the server has not come back up after 12 times (60 minutes), page and/or e-mail admin that a server comes back up.
Currently, our batch file creates a marker and e-mails if the server is not available and does not e-mail and delete the marker again until it comes back on-line.
Thanks,
Kent
|
|
Top
|
|
|
|
#76693 - 2003-09-16 05:28 AM
Re: Server Monitor
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
So.. Yes, I was looking for feedback and ideas for the script I posted.
Kent
|
|
Top
|
|
|
|
#76695 - 2003-09-16 02:34 PM
Re: Server Monitor
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
if you look on my webpage for Kpinger... it is a simple 'ping tool' in a gui
|
|
Top
|
|
|
|
#76697 - 2003-09-19 04:19 AM
Re: Server Monitor
|
Anonymous
Anonymous
Unregistered
|
I currently use IPSentry for our server monitoring it has many features. Hope this might help you. I do like your script though, how does it support alpha pagers?
|
|
Top
|
|
|
|
#76698 - 2003-09-19 02:05 PM
Re: Server Monitor
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Hmm.. That is interesting.. It was really a bunch of pseudocode that I had not put together and tested yet.
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1607 anonymous users online.
|
|
|