Tool

robwillcox318's picture
tool
Reads:

5438

Score:
4.666665
4.7
3
 
Comments:

3

IDM Driver Status Script

Author Info

31 August 2011 - 4:36pm
Submitted by: robwillcox318

(View Disclaimer)

license: 
None

I am working towards implementing IDM 4 into my environment. I found that on one of my servers, the driver had stopped without my knowledge. So I decided to write a bash script to check the status of the driver, restart it if needed, and email whenever the status of the driver changes.

Create the folder /var/opt/novell/scripts Copy the chkdriver.sh script into the directory, edit the variables as indicated in the script (#edit me comment) and set the permissions so it can be executed.

On line 7, that is a reminder note to add the ip address of your SMTP server to the /etc/mail.rc file so the script can send notifications...

#!/bin/bash

admin="admin.tree"    #edit me
password="secret"   #edit me
dxml_driver="driver-name.context.tree"   #edit me

#add "set smtp=smtp.ip.add.ress" to /etc/mail.rc file so the script can send email

email_to="network.admin@mydomain.com"    #edit me
email_body="/var/opt/novell/scripts/idm_driver_status.msg"    #edit me

dxcmd_output=`/opt/novell/eDirectory/bin/dxcmd -user $admin -password $password -getstate $dxml_driver`
dxml_drvstate=$?
case $dxml_drvstate in
	0) #stopped
		echo -n "Driver state 0 - Stopped"
		email_subj="IDM Driver $dxml_driver has STOPPED"
		echo `! date` " - IDM Driver $dxml_driver status: Stopped...  Attempting to restart driver $dxml_driver" >$email_body
		dxcmd_output=`/opt/novell/eDirectory/bin/dxcmd -user $admin -password $password -start $dxml_driver`
		/bin/mail -s "$email_subj" "$email_to" < $email_body
		;;
	1) #starting
		echo -n "Driver state 1 - Starting"
		email_subj="IDM Driver $dxml_driver is STARTING"
		echo `! date` " - IDM Driver $dxml_driver status: Starting...  Please check the server" >$email_body
		/bin/mail -s "$email_subj" "$email_to" < $email_body
		;;
	2) #running
		if grep -q -i running /var/opt/novell/scripts/idm_driver_status.msg
		then
			echo -n "No Change in Driver state 2 - Running"
			echo ""
		else
			echo -n "Driver state 2 - Running"
			email_subj="IDM Driver $dxml_driver is RUNNING"
			echo `! date` " - IDM Driver $dxml_driver status: Running" >$email_body
			/bin/mail -s "$email_subj" "$email_to" < $email_body
		fi
		;;
	3) #stopping
		echo -n "Driver state 3 - Stopping"
		email_subj="IDM Driver $dxml_driver is STOPPING"
		echo `! date` " - IDM Driver $dxml_driver status: Stopping...  Please check the server" >$email_body
		/bin/mail -s "$email_subj" "$email_to" < $email_body
		;;
esac

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

LNyiri's picture

nice script except why not to use health job

Submitted by LNyiri on 8 September 2011 - 1:25am.

quite a long time IDM has support for driver health monitoring. See:
http://www.novell.com/documentation/idm401/idm_com...

LNyiri's picture

why not to use health job for dirver status monitoring?

Submitted by LNyiri on 8 September 2011 - 1:45am.

I suggest to use health job for driver monitoring. See
http://www.novell.com/documentation/idm401/idm_com...

Best regards

Ladislav

geoffc's picture

Health job vs Script

Submitted by geoffc on 8 September 2011 - 11:17am.

LNyiri asks, why not just use the Health Monitoring Job?

Well for one thing, the Job runs inside the IDM process space. If the IDM process goes down, the Job is down. The IDM process runs inside the ndsd process space. If ndsd goes done, you lose IDM and you lose Jobs.

I would recommend both. Health job can do more things, and have more insight into the driver health.

The script is useful to catch driver stoppage from outside the IDM system.

You should do both.

© 2013 Novell