Posting URL alerts to a HipChat room 

Post URL alerts to one or more HipChat rooms.

Post URL alerts to one or more HipChat rooms using the HipChat API v2. The HipChat event plugin posts an event message as customized in the message field to the HipChat room using the identity provided by the authorization token.

Multiple instances of the config_locationhipchat_posturl.conf file results in multiple instances of the event plugin. The HipChat configuration file can have any name provided the file has the .conf file extension, contains the valid event plugin identifier [posturl], and resides in the event-plugins directory location. All configuration files are loaded, so differentiate the file names such as hipchat_posturl1.conf, hipchat_posturl2.conf, and so on. Multiple plugin instances facilitate flexibility when setting up alerts to different HipChat rooms for development and production clusters. All OpsCenter event plugins support multiple configurations files and subsequent plugin instances.

Prerequisites

  1. Create an authorization token with send notification (scope) privileges to the HipChat API.
  2. Ensure Notifications are enabled for the appropriate HipChat user profiles.
  3. Obtain the room_id for the HipChat rooms you intend to send alerts to. To locate a list of room IDs for your organization, hit this endpoint with your auth token that has the View Room scope: https://api.hipchat.com/v2/room?max-results=1000&auth_token=your_auth_token.

Procedure

  1. In a terminal, open hipchat_posturl.conf for editing.
  2. In the [posturl] section, set enabled=1.
  3. Specify the levels and clusters for which the alert configuration will run if you do not want alerts called for all levels and clusters.
  4. Enter your auth_token (API key) to access the HipChat API.
  5. Enter the ID of the HipChat room to post to in the room_id option.
  6. Save hipchat_posturl.conf and restart the OpsCenter daemon.
  7. Verify that the expected HipChat room received notifications of OpsCenter starting up.

Example

Example hipchat_posturl.conf:

[posturl] 
enabled=1

# levels can be comma-delimited list of any of the following:
# DEBUG,INFO,WARN,ERROR,CRITICAL,ALERT
# If left empty, all levels will be posted
levels=CRITICAL,ALERT

# clusters is a comma-delimited list of cluster names for which
# this alert config will be eligible to run.
# If left empty, this alert will be called for events on all clusters
clusters=prod1,prod2,prod3

# You can learn more about how to get authentication tokens at
# https://www.hipchat.com/docs/apiv2/auth
auth_token=your_hipchat_auth_token

# You can find a list of room IDs for your organization at
# https://api.hipchat.com/v2/room?max-results=1000&auth_token=<your auth token>
room_id=123

# You may use tokens found within the default event data for or in
# values. For example, some available keys are:
# cluster, time, level_str, message, target_node, event_source, success, api_source_ip, user, source_node
# Keys must be encapsulated in {brackets}.
message=<b>{level_string} from {cluster}</b>:  {message}

# Background color of the message posted in the HipChat room. 
# Valid values: yellow (default), green, red, purple, gray, random.
color=purple

# Determines how the message is treated by HipChat applications
#   html:
#     Message is rendered as HTML and receives no special treatment.
#     Must be valid HTML and entities must be escaped (e.g.: '&amp;' instead of
            '&').
#     May contain basic tags: a, b, i, strong, em, br, img, pre, code, lists,
            tables.
#   text:
#     Message is treated just like a message sent by a user.
#     Can include @mentions, emoticons, pastes, and auto-detected URLs (Twitter, YouTube, images, etc).
# Valid values: html (default), text.
format=html