BusinessObjects Board

Service Monitor Script - Perl for Windows Services

Author: MikeD Business_Intelligence@hotmail.com
Author notes: XiServiceMonitor_Guide.txt General guide for setting up and running the script.
Thread: Service Monitoring
Platform: Windows 2003 Should be backward & forward compatible as no specific 2003 inclusions were used.
Version: 0.1 Updates will be available on request or per any onsite modifications.
Code: XiServiceMonitor.pl Perl Script with embedded comments.

This Perl script will read a list of services to be monitored, and then attempt a restart on any stopped service(s).
If the failed service won’t restart - all services in the list will be stopped.

Note: The script should be able to handle any windows service monitoring by simply changing the list of services that is read in from the text file i.e. my requirement was to develop something for XI so the input file contains a list of all the BOE XI and EPM services.

I have included a command in the guide as to how to print out all the services running on your machine.
One cannot use the Description name that you see in the Services monitor.
By running the command mentioned, you can select which service name(s) to place in the list.
i.e. I have not tested this on any previous BO versions, but I did some offsite testing on a few DB2 and laptop services, which worked just fine, so it is proved to be flexible re any services.

The zip includes:
[list]
XiServiceMonitor_Guide.txt General guide for setting up and running the script.
XiServiceList.txt List of services to be monitored.
XiServiceMonitor.pl Perl Script with embedded comments.
XiServiceMonitor.log Example of logged actions.
Komodo_screenshot.rtf Screenshot for testing/running the script with Komodo - this IDE handles perl syntax and has smart prompts for errors etc.
[/list]

If you have the environment variables set as per the guide, you will be able to start the script by double clicking it - or running it via a DOS command window once you have set the directory path to the perl.exe i.e. c:\Perl\bin.
The loop is set via a sleep(300) cycle (5 minutes) - as per the embedded script comments - this can obviously be changed to a cycle of your own choosing.

At this point in time, I have yet to be able to get this script to run as a service :hb:
I have listed all the methods that I tried by including the relevant site links in the guide.
i.e. According to all my forum hopping, it apparently is possible, so hopefully if anyone here decides to use this and manages to get that right - please contact me :stuck_out_tongue:
XiServiceMonitor.zip (170.0 KB)


MikeD :south_africa: (BOB member since 2002-06-18)

Has there been any modifications to this pearl script since it’s posting. I am also facing the challenge of the identifying hung services. They show that they are running but they are non responsive.


mcliffordgoo :us: (BOB member since 2003-02-13)

Nope - it works, but I left the BO realm to dabble in the Cognos realm, so did not get a chance to revisit the creation of the script as a service i.e. the actual method works re constantly checking the service status.
Methinx you might have an issue re the status check in that the script uses a windows method to get the status of the service, so you will have to confirm whether the hung state can be identified via the windows service status - maybe the PENDING state?

Let me know if you need any further info re the script etc.


MikeD :south_africa: (BOB member since 2002-06-18)

Being that BO 3.1 Servers & Services have now been “Virtualized” (ie. all BO Services & Servers no longer show up as a “Windows Service”), will this script work with BO 3.1? If not, do you (or anyone else) know of a way to monitor & alert when a BO virtualized Service/Server goes down (and to then bring it back up)?

Thanks.


Captspeed :us: (BOB member since 2006-10-03)

Nope - this script was windows service specific but I am looking into a replacement that monitors processes etc


MikeD :south_africa: (BOB member since 2002-06-18)

Hi Mike,

Thanks for sharing good script.

As per instruction I have installed but where I can place these files

i.e XIsericelist, Moniter.Pl files

could you please let me know where I can.

Many Thanks


kalabo :singapore: (BOB member since 2008-05-14)

The Guide mentions:
Make sure to include the following in the Path System Variable:
C:\Program Files\ActiveState Perl Dev Kit 6.0\bin;C:\Perl\bin;

The perl/w executable will kick off from bin and should automatically refer to C:\Perl\lib\ - so depending on your installation setup you can place them in the perl library (lib).


MikeD :south_africa: (BOB member since 2002-06-18)

Thanks Mike :slight_smile: for quick reply.

As per XiServiceMonitor_Guide I have installed Active perl and Komodo_ide and also I have created variables also(one i doubt on this … can I create variable name for Server or Laptop i.e Variable = Server?)
and the hostname in text file also.

after I am not understood remaining step could you please let me some details steps on this On this.
because I didn’t get Komdo_sreenshot as you mentioned I try to open the Komodo IDe but its not opening.

and where I can place Xi service.txt, XiserviceMonitor.pl and log files.

I am very poor on Admin side.

Many thanks for your help… :slight_smile: , actually I am very curious to how they works.

Many thanks

Kala


kalabo :singapore: (BOB member since 2008-05-14)

Yes - you can use a variable for the server.
Place all files in the Perl Library.
No - you don’t have to use Komodo - any IDE that has a Perl module can be used e.g. Eclipse.
You only need an IDE if you want to run the script step by step to see what it does. The alternative is to use display comments.


MikeD :south_africa: (BOB member since 2002-06-18)

Hi Mike,

is this script work for unix environment. Please let me know.

Thanks,
Venkat


venkata_somisetty (BOB member since 2009-08-12)

Nope - Unix uses daemons and windows uses services i.e. the perl script uses a windows function Win32::Service::GetStatus to evaluate the status of the services.


MikeD :south_africa: (BOB member since 2002-06-18)

Thanks for reply Mike. is there any script like this for unix?

Venkat


venkata_somisetty (BOB member since 2009-08-12)

I have not had a chance to rework this into the Unix environment as I’m rather considering upgrading this to handle the XI 3 environment which uses processes as opposed to services.
I’m sure it could be scripted pretty easily using a variety of scripting languages - best stick to the shell script that your OS uses.


MikeD :south_africa: (BOB member since 2002-06-18)

How’s the XI 3.1 upgrade for this coming? Any idea when you might release it?


Captspeed :us: (BOB member since 2006-10-03)

how nice it will be if there is a monitor for R3 services


sshanmug (BOB member since 2008-03-06)

Hi all,
can any one post the .bat script for deleting the log files on BO servers automatically

Thanks Inadvance


vk_0432 (BOB member since 2011-11-02)