1833341 Members
3799 Online
110051 Solutions
New Discussion

Java / Openview

 
SOLVED
Go to solution
Juergen Nagel_1
Frequent Advisor

Java / Openview

Hello,

I want to send a message from my java program to Openview. For testing I inserted the following commands in the java program.
rt.exec("opcmsg severity=warning application=URLRespondTime object=Exception msg_text=xxx");
Result: The message text was xxx.
rt.exec("opcmsg severity=warning application=URLRespondTime object=Exception msg_text=\"xxx\"");
Result: The message text was ???xxx???.
rt.exec("opcmsg severity=warning application=URLRespondTime object=Exception msg_text=\"xx x\"");
Result: no message, not happened, return code 2

I want to send error messages to Openview. These messages contains more than one word and of course spaces. In the UNIX shell I use the ???-character but how can I solve this problem in java? How can I quote the ???-character?
Thanks for help.
2 REPLIES 2
Michael Armbrecht
Frequent Advisor
Solution

Re: Java / Openview

Hi J??rgen,

what about:

...msg_text="\"xx x\"""); ?

Blanks only work if the string is quoted, if you want the inside quotes be part of the message, they have to be escaped.

Hope it helps
Michael
Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic.
Juergen Nagel_1
Frequent Advisor

Re: Java / Openview

Hi Michael,

Thanks for your help. I will test your suggestion as soon as possible.

For the moment I found a solution.
rt.exec(new String[]{"opcmsg","severity=warning","application=URLRespondTime","object=Exception thrown","msg_text="The program has been stopped!"});

This works good.

Regards