龙虎赌博

This is the documentation page for an unsupported version of 龙虎赌博.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

6 メディアタイプ

概要

メディアタイプは、関连するすべてのオブジェクトやオブジェクトの関係性と一绪にエクスポートされます。

エクスポート

メディアタイプをエクスポートするには、次のようにします。

  • 管理メディアタイプ に移动します。
  • エクスポートするメディアタイプのチェックボックスにマークを付けます。
  • リストの下にあるエクスポートをクリックします。

选択された形式に応じて、メディアタイプはローカルファイルにデフォルトの名前でエクスポートされます。

  • zabbix_export_mediatypes.yaml - YAML形式の場合 (export の default option)
  • zabbix_export_mediatypes.xml - XML形式の場合
  • zabbix_export_mediatypes.json - JSON形式の場合

インポート

メディアタイプをインポートするには、次のようにします。

  • 管理メディアタイプ に移动します。
  • 右侧のインポートをクリックします。
  • インポートするファイルを选択します。
  • インポートルールの必要なオプションにマークを付けます。
  • インポートをクリックします。

インポートの成功または失败のメッセージが奥别产インターフェースに表示されます。

インポートルール:

ルール 説明
既存の设定を上書Update existing 既存の要素は、import ファイルから取得したデータで更新されます。そうでない場合は、更新されません。
新规作成 import ファイルのデータを使用して新しい要素を追加します。そうでない場合は、追加されません。
存在しない场合に削除 インポートファイルに存在しない既存の要素を削除します。そうでない场合は、削除されません。

エクスポートフォーマット

YAML形式の export:

zabbix_export:
         version: '6.0'
         date: '2021-08-31T13:34:17Z'
         media_types:
           -
             name: Pushover
             type: WEBHOOK
             parameters:
               8:
                 name: endpoint
                 value: 'https://api.pushover.net/1/messages.json'
               6:
                 name: eventid
                 value: '{EVENT.ID}'
               11:
                 name: event_nseverity
                 value: '{EVENT.NSEVERITY}'
               12:
                 name: event_source
                 value: '{EVENT.SOURCE}'
               13:
                 name: event_value
                 value: '{EVENT.VALUE}'
               10:
                 name: expire
                 value: '1200'
               2:
                 name: message
                 value: '{ALERT.MESSAGE}'
               14:
                 name: priority_average
                 value: '0'
               15:
                 name: priority_default
                 value: '0'
               16:
                 name: priority_disaster
                 value: '0'
               17:
                 name: priority_high
                 value: '0'
               18:
                 name: priority_information
                 value: '0'
               19:
                 name: priority_not_classified
                 value: '0'
               20:
                 name: priority_warning
                 value: '0'
               9:
                 name: retry
                 value: '60'
               3:
                 name: title
                 value: '{ALERT.SUBJECT}'
               0:
                 name: token
                 value: '<PUSHOVER TOKEN HERE>'
               7:
                 name: triggerid
                 value: '{TRIGGER.ID}'
               4:
                 name: url
                 value: '{$ZABBIX.URL}'
               5:
                 name: url_title
                 value: 龙虎赌博
               1:
                 name: user
                 value: '{ALERT.SENDTO}'
             max_sessions: '0'
             script: |
               try {
                   var params = JSON.parse(value),
                       request = new HttpRequest(),
                       data,
                       response,
                       severities = [
                           {name: 'not_classified', color: '#97AAB3'},
                           {name: 'information', color: '#7499FF'},
                           {name: 'warning', color: '#FFC859'},
                           {name: 'average', color: '#FFA059'},
                           {name: 'high', color: '#E97659'},
                           {name: 'disaster', color: '#E45959'},
                           {name: 'resolved', color: '#009900'},
                           {name: 'default', color: '#000000'}
                       ],
                       priority;
               
                   if (typeof params.HTTPProxy === 'string' && params.HTTPProxy.trim() !== '') {
                       request.setProxy(params.HTTPProxy);
                   }
               
                   if ([0, 1, 2, 3].indexOf(parseInt(params.event_source)) === -1) {
                       throw 'Incorrect "event_source" parameter given: "' + params.event_source + '".\nMust be 0-3.';
                   }
               
                   if (params.event_value !== '0' && params.event_value !== '1'
                       && (params.event_source === '0' || params.event_source === '3')) {
                       throw 'Incorrect "event_value" parameter given: ' + params.event_value + '\nMust be 0 or 1.';
                   }
               
                   if ([0, 1, 2, 3, 4, 5].indexOf(parseInt(params.event_nseverity)) === -1) {
                       params.event_nseverity = '7';
                   }
               
                   if (params.event_value === '0') {
                       params.event_nseverity = '6';
                   }
               
                   priority = params['priority_' + severities[params.event_nseverity].name] || params.priority_default;
               
                   if (isNaN(priority) || priority < -2 || priority > 2) {
                       throw '"priority" should be -2..2';
                   }
               
                   if (params.event_source === '0' && isNaN(params.triggerid)) {
                       throw 'field "triggerid" is not a number';
                   }
               
                   if (isNaN(params.eventid)) {
                       throw 'field "eventid" is not a number';
                   }
               
                   if (typeof params.message !== 'string' || params.message.trim() === '') {
                       throw 'field "message" cannot be empty';
                   }
               
                   data = {
                       token: params.token,
                       user: params.user,
                       title: params.title,
                       message: params.message,
                       url: (params.event_source === '0') 
                           ? params.url + '/tr_events.php?triggerid=' + params.triggerid + '&eventid=' + params.eventid
                           : params.url,
                       url_title: params.url_title,
                       priority: priority
                   };
               
                   if (priority == 2) {
                       if (isNaN(params.retry) || params.retry < 30) {
                           throw 'field "retry" should be a number with value of at least 30 if "priority" is set to 2';
                       }
               
                       if (isNaN(params.expire) || params.expire > 10800) {
                           throw 'field "expire" should be a number with value of at most 10800 if "priority" is set to 2';
                       }
               
                       data.retry = params.retry;
                       data.expire = params.expire;
                   }
               
                   data = JSON.stringify(data);
                   龙虎赌博.log(4, '[ Pushover Webhook ] Sending request: ' + params.endpoint + '\n' + data);
               
                   request.addHeader('Content-Type: application/json');
                   response = request.post(params.endpoint, data);
               
                   龙虎赌博.log(4, '[ Pushover Webhook ] Received response with status code ' + request.getStatus() + '\n' + response);
               
                   if (response !== null) {
                       try {
                           response = JSON.parse(response);
                       }
                       catch (error) {
                           龙虎赌博.log(4, '[ Pushover Webhook ] Failed to parse response received from Pushover');
                           response = null;
                       }
                   }
               
                   if (request.getStatus() != 200 || response === null || typeof response !== 'object' || response.status !== 1) {
                       if (response !== null && typeof response === 'object' && typeof response.errors === 'object'
                               && typeof response.errors[0] === 'string') {
                           throw response.errors[0];
                       }
                       else {
                           throw 'Unknown error. Check debug log for more information.';
                       }
                   }
               
                   return 'OK';
               }
               catch (error) {
                   龙虎赌博.log(4, '[ Pushover Webhook ] Pushover notification failed: ' + error);
                   throw 'Pushover notification failed: ' + error;
               }
             description: |
               Please refer to setup guide here: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/templates/media/pushover
               
               Set token parameter with to your Pushover application key.
               When assigning Pushover media to the 龙虎赌博 user - add user key into send to field.
             message_templates:
               -
                 event_source: TRIGGERS
                 operation_mode: PROBLEM
                 subject: 'Problem: {EVENT.NAME}'
                 message: |
                   Problem started at {EVENT.TIME} on {EVENT.DATE}
                   Problem name: {EVENT.NAME}
                   Host: {HOST.NAME}
                   Severity: {EVENT.SEVERITY}
                   Operational data: {EVENT.OPDATA}
                   Original problem ID: {EVENT.ID}
                   {TRIGGER.URL}
               -
                 event_source: TRIGGERS
                 operation_mode: RECOVERY
                 subject: 'Resolved in {EVENT.DURATION}: {EVENT.NAME}'
                 message: |
                   Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
                   Problem name: {EVENT.NAME}
                   Problem duration: {EVENT.DURATION}
                   Host: {HOST.NAME}
                   Severity: {EVENT.SEVERITY}
                   Original problem ID: {EVENT.ID}
                   {TRIGGER.URL}
               -
                 event_source: TRIGGERS
                 operation_mode: UPDATE
                 subject: 'Updated problem in {EVENT.AGE}: {EVENT.NAME}'
                 message: |
                   {USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
                   {EVENT.UPDATE.MESSAGE}
                   
                   Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.
               -
                 event_source: DISCOVERY
                 operation_mode: PROBLEM
                 subject: 'Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}'
                 message: |
                   Discovery rule: {DISCOVERY.RULE.NAME}
                   
                   Device IP: {DISCOVERY.DEVICE.IPADDRESS}
                   Device DNS: {DISCOVERY.DEVICE.DNS}
                   Device status: {DISCOVERY.DEVICE.STATUS}
                   Device uptime: {DISCOVERY.DEVICE.UPTIME}
                   
                   Device service name: {DISCOVERY.SERVICE.NAME}
                   Device service port: {DISCOVERY.SERVICE.PORT}
                   Device service status: {DISCOVERY.SERVICE.STATUS}
                   Device service uptime: {DISCOVERY.SERVICE.UPTIME}
               -
                 event_source: AUTOREGISTRATION
                 operation_mode: PROBLEM
                 subject: 'Autoregistration: {HOST.HOST}'
                 message: |
                   Host name: {HOST.HOST}
                   Host IP: {HOST.IP}
                   Agent port: {HOST.PORT}

要素のタグ

要素のタグの値は下表のとおりです。

Element Element プロパティ 必须 レンジ1 説明
media_types - Root element for media_types.
name x string Media type name.
type x string 0 - EMAIL
1 - SMS
2 - SCRIPT
4 - WEBHOOK
Transport used by the media type.
status - string 0 - ENABLED (default)
1 - DISABLED
Whether the media type is enabled.
max_sessions - integer Possible values for SMS: 1 - (default)

Possible values for other media types: 0-100, 0 - unlimited
The maximum number of alerts that can be processed in parallel.
attempts - integer 1-10 (default: 3) The maximum number of attempts to send an alert.
attempt_interval - string 0-60s (default: 10s) The interval between retry attempts.

Accepts seconds and time unit with suffix.
description - string Media type description.
message_templates - Root element for media type message templates.
event_source x string 0 - TRIGGERS
1 - DISCOVERY
2 - AUTOREGISTRATION
3 - INTERNAL
Event source.
operation_mode x string 0 - PROBLEM
1 - RECOVERY
2 - UPDATE
Operation mode.
subject - string Message subject.
message - string Message body.
Used only by e-mail media type
smtp_server x string SMTP server.
smtp_port - integer Default: 25 SMTP server port to connect to.
smtp_helo x string SMTP helo.
smtp_email x string Email address from which notifications will be sent.
smtp_security - string 0 - NONE (default)
1 - STARTTLS
2 - SSL_OR_TLS
SMTP connection security level to use.
smtp_verify_host - string 0 - NO (default)
1 - YES
SSL verify host for SMTP. Optional if smtp_security is STARTTLS or SSL_OR_TLS.
smtp_verify_peer - string 0 - NO (default)
1 - YES
SSL verify peer for SMTP. Optional if smtp_security is STARTTLS or SSL_OR_TLS.
smtp_authentication - string 0 - NONE (default)
1 - PASSWORD
SMTP authentication method to use.
username - string Username.
password - string Authentication password.
content_type - string 0 - TEXT
1 - HTML (default)
Message format.
Used only by SMS media type
gsm_modem x string Serial device name of the GSM modem.
Used only by script media type
script name x string Script name.
parameters - Root element for script parameters.
Used only by webhook media type
script x string Script.
timeout - string 1-60s (default: 30s) Javascript script HTTP request timeout interval.
process_tags - string 0 - NO (default)
1 - YES
Whether to process returned tags.
show_event_menu - string 0 - NO (default)
1 - YES
If {EVENT.TAGS.*} were successfully resolved in event_menu_url and event_menu_name fields, this field indicates presence of entry in the event menu.
event_menu_url - string URL of the event menu entry. Supports {EVENT.TAGS.*} macro.
event_menu_name - string Name of the event menu entry. Supports {EVENT.TAGS.*} macro.
parameters - Root element for webhook media type parameters.
name x string Webhook parameter name.
value - string Webhook parameter value.
脚注

1 文字列値については、文字列のみがエクスポートされ(例:"EMAIL "など) 、この表で使用される番号付けは行われません。
このテーブルの范囲値(础笔滨値に対応)の番号は、顺序付けのためにのみ使用されます。