Ad Widget

Collapse

Email Notifcation Spiceworks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #1

    Email Notifcation Spiceworks

    i would like to send email-notification from zabbix to Spiceworks..

    in Spiceworks it gives an example for nagios.. but how is it for zabbix? can somebody help me?

    Code:
    # This is the built-in example external alert email parser. It supports parsing emails from
    # the Nagios system, but could also be changed to parse email from other systems.
    # three variables are passed into this function:
    # - email_from: the sender, email_subject: the subject, and email_body: the email text
    
    data = nil
    # comment out if you want to create alert for a reply that contains nagios alert text instead of creating a ticket
    return nil if email_subject =~ /^Re:/i
    
    # Tweak regex to match string present in Nagios alert email.
    if email_body =~ /\*{5}\s+Nagios\s.*\*{5}/
      # this email is sent from Nagios, parse alert tokens
      data = {}
      data[:notif_type] = email_body[/^Notification Type:\s*(\w+)/, 1]
      data[:hostname] = email_body[/^Host:\s*(.*)/, 1]
      data[:ip] = email_body[/^Address:\s*(.*)/, 1]
      data[:alerttype] = email_body[/^State:\s*(.*)/, 1]
      data[:title] = (email_body[/^Service:\s*(.*)/, 1] || "Host #{data[:hostname]} is #{data[:alerttype].to_s.downcase}") + "#{' at ' + site_name if site_name}"
      data[:created_at] = email_body[/^Date\/Time: *(.*)/, 1]
      data[:message] = email_body[/^Info:\s*(.*)/, 1]
      data[:ainfo] = email_body[/^Additional Info:\s*\n+(.*)/m, 1]
      data.each_key{|k| data[k].strip! if data[k]}
    end
    return data # an external alert is created with returned key/value pairs
    Debian-User

    Sorry for my bad english
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    has nobody an idea?
    Debian-User

    Sorry for my bad english

    Comment

    Working...