Trigger

Event objects

When a new event if fire the object item arrives to the trigger class and it can have different variables and values according to is type.

Variable

variable description
odbc_ prefix variable to get results from odbc query, usage in condition variable odbc_name; usage in action: ${odbc_name}
http_response_code prefix variable to get results from http action when the response is a code
http_response_body prefix variable to get results from http action when the response is a body
http_json prefix variable to get results from http action when the response is a json string, usage in condition variable http_json-name; usage in action: ${http_json-name}

Directory

variable description
class_name the class name where to fire the event
sensor_name the sensor name, for example, endpoint
event_name the event name fired
profile_name when a endpoint the SIP profile where the event was triggered
account_name the directory account name
account_description the directory account description
domain_name the directory domain name
network_ip the network ip from where the event was received
network_port the network port from where the event was received
user_agent the user agent from where the event was received

Line

variable description
class_name the class name where to fire the event
sensor_name the sensor name, for example, line
event_name the event name fired
line_name the line name
status the line status
status_txt the line status text

Line Fire Events

How to alert a line register/unregister/ping_up/ping_down: At the start you need to modify the default sip line template: Telephony → General → Line → default sip line

  • x – Register event; Trigger class: default; Events: x – Register x – Unregister x – Ping_up x - Ping_down
  • Click on Add

Then go to Monitor → Trigger → Add new class

  • Activation: x – Enabled
  • Name: Lines
  • Prioity: First
  • Conditions: x – Custom
  • Variable – Text Add
  • Name: sensor_name; Expression: ^(register|unregister|ping_up|ping_down)$
  • Action: x – Custom: Alarm
  • Severity: NOTICE
  • Name: ${line_name} ${event_name}
  • Message: ${line_name} ${event_name}
  • Clear: x – Timeout
  • Click on Add

Account Fire Events

How to alert an account register/unregister/expire:

You can create a trigger to be alerted of register, unregister and expire on SIP accounts. At the start you need to modify or create a SIP template:

Directory > Template > Endpoint (SIP) > Add

  • Name: SIP
  • x – Register event; Trigger class: default ; Events: x – Register x – Unregister x – Expire
  • Click on Add

Monitor > Trigger > Add a new rule

  • Activation: x – Enabled
  • Name: Register
  • Priority: First
  • Conditions: x – Custom
  • Variables: Variable Text – Add (x2)
  • Name: event_name; x – Expression : ^(register|unregister|expire)$
  • Name: sensor_name; x – Expression : ^endpoint$
  • Action: x – Custom: Alarm
  • x – Custom
  • Severity: NOTICE
  • Name: ${account_name}@${domain_name} ${event_name}
  • Message: ${account_name}@${domain_name} has ${event_name}ed
  • Clear: x – Timeout: 60 Minutes
  • Click on Add

Action

Configure the action to execute when the trigger condition is met.

Email

Adding a trigger rule that sends an automatic email, one per hour, if a ping type probe reports 100% packet loss:

  • Name: email
  • Trigger: Consecutive hits: 5; x - Reset; Timeout: 60
  • Conditions: x - custom; x - Sensor type: probe; x - Variable numeric; Name: sensor_packet_loss; Condition: equal: 100
  • Action: Email
    • From: triggers@commsmundi.com
    • To: support@wirelessmundi.com
    • Subject: “[COMMSMUNDI] Ping sensor: ${sensor_name}”
    • Body: “The destination server doesn't reply to icmp”

SMS

  • Name: SMS
  • Conditions: x - Custom; x - Sensor type: probe; x - Variable numeric; Name: sensor_packet_loss; Condition: equal: 100
  • Action: SMS
    • Number: Number1
    • Account: 100@commsmundi.com
    • Message: The destination server doesn’t reply to icmp.
  • Click on Add

HTTP

Alarm

  • Conditions: x - Custom; x - Sensor type: probe; x - Variable numeric; Name: sensor_packet_loss; Condition: equal: 100
  • Action: Alarm
    • Severity: NOTICE
    • Name: Packet loss
    • Message: The destination server doesn’t reply to icmp
  • Click on Add

Call

  • Conditions: x - Any
  • Action: Call
  • Destination: 1 @ outgoing
  • Action: x - Playback/transfer
  • Click on Add

Fax

  • Name: Fax
  • Conditions: x - Any
  • Action: Fax
    • Destination: Domain: commsmundi.com Account: example Number: 100
    • Subject: Example
    • Body: Automatic Fax
  • Click on Add

SIP

  • Name: SIP
  • Conditions: x - Any
  • Action: x - Custom; SIP
  • Type: x - NOTIFY
  • Destination: Domain: commsmundi.com Number: 100
  • Event string: message-summary
  • Content type: application/simple-message
  • x – Message:
    • Content- type: application/simple-message-summary
    • x – Message:
    Messages-Waiting: yes 
    Message-Account: sip:100@commsmundi.com
    Voice-Message: 3/0
  • Click on Add

UDP

  • Conditions: x - Any
  • Action: x - Custom; UDP
    • Server:Port 192.168.10.1:45672
    • Messagge: Testing
  • Click on Add

Ip list

  • Name: Ip list
  • Conditions: x - Any
  • Action: x - Custom; Ip list
    • IP x - Add 192.168.10.1/24
    • List: Example list
  • Click on Add

Snmptrap

  • Name: Snmptrap
  • Priority: First
  • Conditions: x - Any
  • Action: x - Custom
    • Destination: 192.168.10.1
    • Version: x - SNMP V1/SNMP V2/SNMP V3
    • Trap OID: <OID>
    • Community: public
    • Uptime: 60
  • x – OID: OID: <OID>

Odbc

Adding a trigger rule that check status as account 'example' in odbc query:

  • Name: odbc_query
  • Priority: First
  • Continue: Continue after rule
  • Conditions: x - Any
  • Action: x - Custom, odbc
    • ODBC: triggers.
    • SQL: select * from accounts where name = 'example';

Adding a trigger rule that check response of the query and send one email to responsable:

  • Name: check_odbc_query
  • Priority: After: odbc_query
  • Continue: Continue after rule
  • Conditions: x - custom
    • vairables main value:
      • name: odbc_status
      • Expresion: 'down'
  • Action: x - Custom, email
    • to: ${odbc_responsable}.
    • subject: ${odbc_name} account is down
    • body: check status of your account ${odbc_name} because is down

Attendance

  • Name: Attendance
  • Priority: First
  • Conditions: x - custom
    • x - Sensor name: Expression: in
  • Action: x - Custom Attendance control
    • type: IN
    • Account: domain: commsmundi number: ${account}
  • Click Add

Check if this class has custom event key enabled, for example 123. Then use a URL like this with your respective data: 192.168.10.156:1080/mon/event.php?sensor_name=in&key=123&account=304

/home/www/wiki/data/pages/configuration/monitoring/trigger.txt · Last modified: 2022/09/23 16:58 by admin
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki