Service Desk Practitioners Forum
cancel

Creating a Service call automatically with sd_event

SOLVED
Go to solution
Highlighted
Alberto Ocaña d
Respected Contributor.

Creating a Service call automatically with sd_event

Hi.

I have SD 4.5 SP14 in my server. I have installed the events module in it. I want to create a ServiceCall with sd_event.

If I open a command line and type:
sd_event.exe -f sd_event.ini -v Clasificacion=1 SourceID=1

(the folder where sd_event is in the path variable). Everything works fine. Service call is created.

Then I want to put that in a DB rule when some item had change. In DB rule form I fill:

Rule Name: Something
Host in which will be executed: localhost (I've tried the server name too)
Command line: sd_event.exe (I've tried with complete path too)
Parameters: -f sd_event.ini -v Clasificacion=1 SourceID=1

When the rule is fired (I received a mail for testing too) Service call isn´t created and nothing is created on log.

¿Any clue?

Thanks in advance.
30 REPLIES
Tim Schmitt_4
Honored Contributor.

Re: Creating a Service call automatically with sd_event

I haven't done what you are trying before, but I think that you need the agent software installed on the host in order to send commands. SD_Event can create and modify items but does not "listen" for commands to come from the server.

For what I understand, when you say that you want to execute something in a rule, the Service Desk server tries to contact the agent software on the host and the agent software is responsible for running the command.

As I've said, I could be completely off as I've never really looked into the agent software but that's how I understand it to function.
Mark O'Loughlin
Acclaimed Contributor.

Re: Creating a Service call automatically with sd_event

Hi,

as above use sd_event with the agent installed. Check the data exchange guide out for more details. If you dont have a copy we can post up the link to the manuals site (I dont have it right now)
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

Thanks for the answer.

I forgot to install agent on Server. But it still doesn't work.

I want to create a Service Call from the SD Server. I have created a DB rule and that rule fires the sd_event in the Server itself for creating the Service Call.

Is this a problem? Or did I miss something?

Thanks again

Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

Hello Alberto,

The command line can depend on the platform you are using.
Could you tell me on which platform you're working and send me a screen-shot of your DB Rule containing the sd_event command line.

If you're on Windows you should use
C:\\HP\\Openview\\SD\\Event\\bin\\sd_event.exe for your command line...
But attach a screen shot of it on your next post so that I can have a look on it.

Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

I'm using Windows as platform.

I send the screenshot. I hope you can see it.
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

In Command Line field you can see only sd_event.exe

I've tried to add the path but the field is too short to enter.

For that, I set the path of sd_event in the Path variable.
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

So ...
1. Copy the sd_event.ini under the Agent folder [c:\Archivos de programa\Hewlett-Packard\OpenView\service desk 4.5\agent]
2. Command line: [c:\\Archivos de programa\\Hewlett-Packard\\OpenView\\service desk 4.5\\event\\bin\\sd_event.exe]
3. Parameters: [-f sd_event.ini -v Clasificacion=1 "SourceID=[ID]$DATETIME$"]

NB: do not use (") for the first parameter(value; -v)!

Save and try!

;o)

Hope this helps,
Rgds,
Michel
Simone Grandine
Honored Contributor.
Solution

Re: Creating a Service call automatically with sd_event

Hi,
you can simply create a .bat or .cmd file in Agent\bin directory

Write in all you need to start sd_event (like path, cd command, parameters, etc..)

Put in your DBRule yourcommand.bat

And enjoy it ;-)

bye bye,
Simone
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

Thank you for the answer.

Now it works fine. Now I have another problem. I need to map a "Customer" Field.

In import mapping form I set "Cliente" property assigned to Cliente (Organization). I want to pass to sd_event a reference to Customer ID, so I put in "A reference to Item" the "Code" field.

My sd_event.bat is:
sd_event.exe -f sd_event.ini -v Clasificacion=1 SourceID=%1

Then I add the "Cliente" field in the sd_event.bat:
sd_event.exe -f sd_event.ini -v Clasificacion=1 SourceID=%1 Cliente=%2


* Previous parameters to sd_event.bat in DB rule (This works fine): [ID]$DATETIME$

* Adding new parameter: [ID]$DATETIME$ [Cliente;Codigo]

When I fire the rule in sd_event_error.log appears that "Cliente" is a needed field.

Simone Grandine
Honored Contributor.

Re: Creating a Service call automatically with sd_event

Hi Alberto,
it seems that Cliente yor're putting in hasn't Codigo attribute...or your external entity hasn't Cliente value

or...if you can give us more explications or sending attachment

hope this help

bye bye,
Simone
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

The value has to be put between ("")
"SourceID=[ID]$DATETIME$ [Cliente;Codigo]"

Hope this helps,
Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

The "" aren't needed.

I'm calling a batch file that needs two parameters.

In command line you would type: sd_event.bat param1 param2

In parameters field of DB Rule you would type param1 and param2 (with a blank between them).

Thanks for the answer.
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

So could it be an issue to have a space between $DATETIME$ and [Cliente;Codigo]?

"SourceID=[ID]$DATETIME$_[Cliente;Codigo]"

Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

I post three screenshots:

1. Import mapping form
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

2. Import mapping options
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

3. DB Rule form

When DB Rule is fired it tells me that * Cliente is a needed parameter
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

evento.bat is:
sd_event.exe -f sd_event.ini -v Clasificacion=1 SourceID=%1 Cliente=%2

In DB Rule form [ID]$DATETIME$ is the first parameter (%1) and [Cliente;Codigo] is the second one(%2).
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

Hello Alberto,
does it work when you enter this in your command line?

Neverthe less since DB_Rules are a little bit tricky I would try with "" any way. Should not harm! ;o)

Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

As I said above this worked when I had only one parameter (SourceID). With two parameters (SourceID and Cliente) doesn't work.

Error log is:
(Server response translation: For Service Call the next fields are needed: * cliente)

[EVENT_924]
VALUE_LIST="username=system#password=servicedesk#mapping=external_event#className=ServiceCall#modus=INSERT#Clasificacion=1#SourceID=102007.1.15.15.51.13#Cliente=SAP00001#"
SERVER=sgpilotosd
PORT=30980
SERVER_RESPONSE=ERROR: Para llamada de servicio los siguentes campos son obligatorios: * cliente.
LANGUAGE=GB
TRY=1
LOGFILE=sd_event.log
ERROR_LOGFILE=sd_event_error.log
TIMESTAMP= 1/15/2007 16:51:13
SEND=true
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

ERROR: Para llamada de servicio los siguentes campos son obligatorios: * cliente.


This means that the second parameter is not passed as argument. Maybe the "$" symbol confuses the bat file...

Put the second parameter as first and the first as second, so that the line finish wiht the $DATETIME$ statement.

Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

I think that's not the problem. Think that Service Desk is going to pass the variable content to the batch file, not the $DATETIME$ variable.

I think that the batch file will never see the $.

Thanks anyway
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

This means that the batch tries to interpret the $ symbols try with /$DATETIME/$ or any batch caracter that tels the execution to not interpret the $ Symbols...

I can't remember exacty the caracter for batch files to make it possible to not interpret the $.

The other way to make it work is to by pass the batch and create the sd_event directly on the DB Rule as I proposed at the beginning...

Rgds,
Michel
Alberto Ocaña d
Respected Contributor.

Re: Creating a Service call automatically with sd_event

I Think that we don't understand ourselves.

I put $DATETIME$ from within the Service Desk, not in command line.

Then, Service Desk will pass to batch file the CONTENT of $DATETIME$, so the '$' will never arrive to the batch file.

I hope that you can understand me now.

But thanks for all your effort!
Michel SILVA SO
Outstanding Contributor.

Re: Creating a Service call automatically with sd_event

Alberto,
The point is that, in the command line you are calling the batch file and not sd_event.exe!

So my suggestion was to uncentralize the batch file and put the sd_event command completely in the DB Rule instead of using the batch.
Why!?
-> Try the sd_event on the ms-dos Command prompt and the batch file on the Command prompt and I assume the sd_event works fine and not the batch.

So go back to the roots and define sd_event on the DB Rule.

That's just a suggestion...personaly I prefer to work directely with sd_event.

:o)

Rgds,
Michel.