#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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|