Introduction

  • JS7 - Notification - Configuration is performed from the Configuration->Notification sub-view of the JOC Cockpit and includes setting up the configuration for the JS7 - Monitor Service.

  • The CommandFragment element is used to execute operating system commands which are parameterized from JS7 - Notification - Configuration, Monitor Variables.
  • This fragment type is frequently used to implement passive checks with a System Monitor.
  • In addition this fragment type can be used, for example, to write individual log files which can be parsed more easily by Log Analyzer products such as Splunk®, AWS® Elastic Search etc.

CommandFragment

  • The CommandFragment requires two nested elements:
    • MessageRef: specifies a reference to the Message element that holds a string that is forwarded to the System Monitor.
    • Command: the operating system command that is executed and parameterized with the content of the Message element and which is available from the ${MESSAGE} Monitor Variable.

Examples

Nagios® / op5®

The following is an excerpt from an XML configuration for notification with passive checks for the Nagios® and op5® System Monitors using CommandFragment.

Nagios / op5 Example
... 
<!--
service_host               The host that executes the passive check. The name must match the corresponding setting in the System Monitor.
monitor_host               The hostname or IP address of System Monitor host.
${MON_O_CONTROLLER_ID}     The JS7 Controller ID, see Monitor Variables
${MON_N_STATUS}            0=success, 1=warning, 2=critical
${MON_N_TYPE}              SUCCESS, WARNING, ERROR, RECOVERED
...
Message example after substitution (error case):
<Message name="notify_on_error"><![CDATA["localhost\tJS7 Monitoring Errors\t2\tERROR controller id=jobscheduler, history id=123, workflow path=test/some_workflow, label=100, error=error occurred\n"]]></Message>
 
Message example after substitution (recovery case): 
<Message name="notify_on_error"><![CDATA["localhost\tJS7 Monitoring Errors\t0\tRECOVERED controller id=jobscheduler, history id=123, workflow path=test/some_workflow, label=100, error=error occurred\n"]]></Message>
 
Message example after substitution (success case):  
<Message name="notify_on_error"><![CDATA["localhost\tJS7 Monitoring Success\t0\tSUCCESS controller id=jobscheduler, history id=123, workflow path=test/some_workflow, label=100, error=\n"]]></Message>
-->
...
<Message name="notify_on_error"><![CDATA["service_host\tJS7 Monitoring Errors\t${MON_N_STATUS}\t${MON_N_TYPE} controller id=${MON_O_CONTROLLER_ID}, history id=${MON_O_HISTORY_ID}, workflow path=${MON_O_WORKFLOW_PATH}, order id=${MON_O_ORDER_ID}, status=${MON_OS_SEVERITY}, error=${MON_OS_ERROR_TEXT}\n"]]></Message>
...
<CommandFragment name="command_on_error">
  <MessageRef ref="notify_on_error"/>
  <Command><![CDATA[echo -e ${MESSAGE} | /usr/local/nagios/bin/send_nsca -H monitor_host -c /usr/local/nagios/etc/send_nsca.cfg]]></Command>
</CommandFragment>
...

Zabbix®

The following is an excerpt from an XML configuration for notification with passive checks for the Zabbix® Monitor using CommandFragment.

Zabbix Example
... 
<!--
zabbix_sender            Zabbix sender utility installed on the JS7 JOC Cockpit host
localhost                Hostname of the Zabbix server
zabbix_server            Hostname of the JS7 Agent that is registered with Zabbix
${MON_OS_JOB_NAME}       Job name for Item key in Zabbix, see Monitor Variables
${MON_OS_ERROR_TEXT}     Error message, see Monitor Variables
-->
<Message name="notify_on_error"><![CDATA[${MON_OS_ERROR_TEXT}]]></Message>
...
<CommandFragment name="zabbix_example">
  <MessageRef ref="notify_on_error"/>
  <Command><![CDATA[zabbix_sender -z localhost -s zabbix_server -k ${MON_OS_JOB_NAME} -o ${MESSAGE}]]></Command>
</CommandFragment>
...



  • No labels