opcmsg
The command opcmsg generates a message
for HP Operations Manager. Before the message is submitted, it is
interpreted by the HP Operations Message Interceptor on the local
managed node where the command is executed. Depending on how you
configure the message, the message can be:
- Discarded
- Locally logged
- Forwarded to the management server
- Forwarded to the management
server, with local logging.
The behavior of messages depends on the configuration of
interceptors (or opcmsg policies). A message may be created, or may
be suppressed. For example, you might have a suppress condition in
the opcmsg policy, which for example suppresses all messages with
application=Test.
If you have such a condition and submit the call:
opcmsg application=Test msg_text="Test message"
then you will not get a message in the browser (it has been
suppressed). The message interceptor must be configured with at
least one Open Message interface policy and be running on the
managed
node, otherwise the opcmsg command will fail.
Command synopsis
opcmsg [ -help ] [ -id ]
application=<application> object=<object name>
msg_text="<message_text>" [ severity=<severity
label> ] [ msg_grp=<message_group> ]
[ node=<node Name> ] [ service_id=<service
name> ] [ -option
variable=<value> ]*
Options
You can specify any unique prefix for the available options. Note
that the prefix for the option severity is s while the
prefix for the option service_id is ser.
- -help Print usage message of opcmsg. All other options
are ignored and no message is submitted.
- -id Return the message ID of the submitted message to
stdout. This option also sets the OPCDATA_REMARK_FOR_ACK flag of
the message, so that the manager information of the message is held
by the message agent.
- severity=<severity label> Specifies the severity
of the message. Following severities are supported: normal,
warning, minor, major, critical. By default severity normal is
applied.
- application=<application name> name of application
(or script/program) which is affected by or has detected the
event/problem.
- msg_grp=<message group> Default message group to
which the message belongs. By default, no message group is
assigned.
- object=<object name> Object which is affected by
or has detected the event/problem.
- msg_text=<message text> Descriptive text
explaining the event/problem in more detail.
- node=<node Name> System on which the event/problem
is detected. By default the node name of the current system is
applied.
- service_id=<service name> name of the service (as
defined in the Service Editor) to which the message is mapped.
- -option variable=<value> Sets the variable
$OPTION(variable) to value. Within the message conditions this
variable can be used to access the value passed with the opcmsg
call.
Special characters must be escaped.
Exit Values
This command exits with value zero after a message is successfully
generated; in case of an internal error, 1 is returned and an error
message displays. If a syntax or usage error is detected, 2 is
returned and an error message displays.
Restrictions
This command can be run by any user. The message group (msg_grp),
the object, and the application parameter should not be longer than
32 bytes, because this is the maximum size HP Operations can handle
with these parameters.
Example
To submit a normal message issued when a user logs onto the system,
you could set up the following scheduled task
opcmsg appl=ScheduledTask obj=login severity=normal
msg_g=Security msg_t="%USERNAME% logged onto system
%COMPUTERNAME%"
Related Topics: