Page 1 of 1 1
Topic Options
#76689 - 2003-09-15 10:49 PM Server Monitor
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76690 - 2003-09-16 01:18 AM Re: Server Monitor
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Are you just sharing your code or are you asking for input? Either way, a few more words would be in order.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76691 - 2003-09-16 05:05 AM Re: Server Monitor
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Les,

You are right. [Frown]

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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76692 - 2003-09-16 05:14 AM Re: Server Monitor
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well, from my experience with servers, most of the time when they are in a failed state, they still respond to a ping, so what you have is poor-man's insurance.

The real monitors will watch the event log or specific services or SNMP traps. SQL server, FE can generate SNMP traps.

I use Whatsup Gold from Ipswitch to monitor not only servers but all manner of SNMP devices. I usually know when something goes down before my users or co-workers do.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76693 - 2003-09-16 05:28 AM Re: Server Monitor
Kdyer Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#76694 - 2003-09-16 02:32 PM Re: Server Monitor
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Sorry [Frown]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76695 - 2003-09-16 02:34 PM Re: Server Monitor
Radimus Moderator Offline
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
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76696 - 2003-09-17 08:30 PM Re: Server Monitor
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I would change the .INI file structure to make the servenames either sections or keys. This will allow you to use just one line of KiXtart code to enumerate all servers to be checked. Use e.g. the server OS as value or a timestamp for the last successful check in case you'd want to keep track of when the server became unavailable.
code:
[SERVER1]
LastCheck=2003/10/10 10:10:10am
LastDown=2003/10/10 10:10:10am

_________________________
There are two types of vessels, submarines and targets.

Top
#76697 - 2003-09-19 04:19 AM Re: Server Monitor
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 Offline
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
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1607 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.062 seconds in which 0.028 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org