Article

marklamont's picture
article
Reads:

3372

Score:
4
4
1
 
Comments:

1

Driver Errors Email Rule

Author Info

2 May 2008 - 4:04am
Submitted by: marklamont

(View Disclaimer)

I needed to get driver errors emailed to allow speedy troubleshooting. I found the rule by Jeff Johnson but it didn't quite do what we wanted.

I have modified it to produce an output like the one reproduced below;

&lti>alert level - "error"  has occurred on object "<---Object DN--->"
at time: 02.05.08,11:26:12
Error information;
event-id  <-event id from the trace---->
Event message "<--event message from the trace-->"
on the "<--Publisher or subscriber as appropriate-->" channel.&lt/i>

I put the rule in a library in each tree and linked it to the input transform of each driver that I wanted to monitor. This way it catches the status errors coming back. Two gcv's are refernced in this rule, one for email server and one for email destination.

Update;
To really get to the bottom of errors speedily it helps to have the original transaction in the email, especially with AD drivers which give a poor response. To achieve this do the following;

create a rule using the code here and set it as the last rule on your output transform

&lt?xml version="1.0" encoding="UTF-8"?>&lt!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\Program Files\Novell\Designer\eclipse\plugins\com.novell.idm.policybuilder_3.0.1.200811201116\DTD\dirxmlscript3.5.1.dtd">&ltpolicy>
	&ltdescription>To allow accurate error reporting it is necessary to add the whole transaction XML document to the operation property. This is then kept by the driver and added back to the  returned status document. this allows the error emails to contain the full transaction.
This rule needs to be applied to the output transform of the channel.
&lt/description>
	&ltrule>
		&ltdescription>set operation property&lt/description>
		&ltcomment xml:space="preserve">set operation property&lt/comment>
		&ltcomment name="author" xml:space="preserve">M Lamont with a bit of help from Jim goodall and Father Ramon&lt/comment>
		&ltcomment name="version" xml:space="preserve">1.0&lt/comment>
		&ltcomment name="lastchanged" xml:space="preserve">2 Feb 09&lt/comment>
		&ltconditions>
			&ltand/>
		&lt/conditions>
		&ltactions>
			&ltdo-set-op-property name="Document-Data-Sent">
				&ltarg-string>
					&lttoken-xml-serialize>
						&lttoken-xpath expression="."/>
					&lt/token-xml-serialize>
				&lt/arg-string>
			&lt/do-set-op-property>
		&lt/actions>
	&lt/rule>
&lt/policy>

This attaches the transaction to the event when the result returns.

Then use this code to generate the email, this needs to be on the input transform;

&lt?xml version="1.0" encoding="UTF-8"?>&lt!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\Program Files\Novell\Designer\eclipse\plugins\com.novell.idm.policybuilder_3.0.1.200811201116\DTD\dirxmlscript3.5.1.dtd">&ltpolicy>
	&ltrule>
		&ltdescription>Email on non success status&lt/description>
		&ltcomment xml:space="preserve">If the status level does not equal SUCCESS, send an email alert to IDMAdmin team.&lt/comment>
		&ltcomment name="author" xml:space="preserve">Jeff Johnson and Mark Lamont&lt/comment>
		&ltcomment name="version" xml:space="preserve">1.1&lt/comment>
		&ltcomment name="lastchanged" xml:space="preserve">01-05-08&lt/comment>
		&ltconditions>
			&ltand>
				&ltif-operation op="equal">status&lt/if-operation>
				&ltif-xpath op="true">@level!='success'&lt/if-xpath>
			&lt/and>
		&lt/conditions>
		&ltactions>
			&ltdo-if>
				&ltarg-conditions>
					&ltand>
						&ltif-xpath op="true"> text()="Code(-8017) Operation vetoed by object creation policy."&lt/if-xpath>
					&lt/and>
				&lt/arg-conditions>
				&ltarg-actions>
					&ltdo-break/>
				&lt/arg-actions>
				&ltarg-actions/>
			&lt/do-if>
			&ltdo-send-email server="~gcvEMailServer~" type="text">
				&ltarg-string name="from">
					&lttoken-text xml:space="preserve">noreply@xxxxxx&lt/token-text>
				&lt/arg-string>
				&ltarg-string name="to">
					&lttoken-global-variable name="gcvEMailDest"/>
				&lt/arg-string>
				&ltarg-string name="subject">
					&lttoken-text xml:space="preserve">IDM ALERT  - Error on &lt/token-text>
					&lttoken-global-variable name="ConnectedSystemName"/>
				&lt/arg-string>
				&ltarg-string name="message">
					&lttoken-text xml:space="preserve">alert level - "&lt/token-text>
					&lttoken-xpath expression="@level"/>
					&lttoken-text xml:space="preserve">"  has occurred on object "&lt/token-text>
					&lttoken-xpath expression="object-dn"/>
					&lttoken-text xml:space="preserve">"
at time: &lt/token-text>
					&lttoken-time format="dd.MM.yy,HH:mm:ss" lang="en-GB"/>
					&lttoken-text xml:space="preserve">
Error information; 
&lt/token-text>
					&lttoken-text xml:space="preserve">event-id  &lt/token-text>
					&lttoken-xpath expression="@event-id"/>
					&lttoken-text xml:space="preserve">
Event message "&lt/token-text>
					&lttoken-xpath expression="text()"/>
					&lttoken-text xml:space="preserve">"
on the &lt/token-text>
					&lttoken-xpath expression="component"/>
					&lttoken-text xml:space="preserve"> channel.&lt/token-text>
					&lttoken-text xml:space="preserve">

Original transaction document


&lt/token-text>
					&lttoken-xpath expression="self::status/operation-data/@*"/>
				&lt/arg-string>
			&lt/do-send-email>
		&lt/actions>
	&lt/rule>
&lt/policy>

note we ignore event vetoed by transaction policy events The last part of the email code (self::status/operation-data/@*"/) writes the previously set operation-data into the email.

AttachmentSize
email rule xml.txt2.14 KB

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

wildpitch's picture

Awesome, just what I was

Submitted by wildpitch on 26 June 2008 - 4:56am.

Awesome, just what I was looking for.

© 2013 Novell