Creating a Custom Alert Handler that transmits alerts to an IRC server


Alert Handlers

The UnboundID Directory Server provides a mechanism to send alert notifications to Alert Handlers when certain events transpire during Directory Server processing. The server is shipped with useful Alert Handlers such as, but not limited to, an error logging alert handler, JMX alert handler, and SMTP alert handler.

Some examples of administrative alerts are:

  • access-control-change when access control configuration has been changed
  • config-change when a configuration item has been changed
  • server-starting when the server is beginning the start up cycle
  • server-shutting-down when the server starts the shutdown cycle
  • low-disk-space-warning when the amount of usable disk has dropped below a threshold

and many others.

Custom Alert Handlers

The UnboundID Server SDK makes it possible to create a custom alert handler and make it available to the server. I have seen some environments where IRC (Internet Relay Chat) is used by operations departments to exchange information about operational status, so I decided to write a custom alert handler that transmits alerts to an IRC server.

To create a custom Alert Handler, override the

 public void handleAlert(AlertNotification alertNotification) { }

method.

When the Alert Handler is complete, make code (jar file) available to the server and create
the alert handler with the dsconfig command line tool:

$ cp irc-alert-handler.jar ${directoryServerRoot}/lib/extensions
$ dsconfig create-alert-handler \
  --handler-name "IRC Alert Handler" \
  --type third-party \
  --set enabled:true \
  --set extension-class:com.unboundid.services.alerts.irc.IrcAlertHandler \
  --set extension-argument:hostname=irc.freenode.net \
  --set "extension-argument:channel=#slamd" \
  --set extension-argument:nick=adm-alerts \
  --set extension-argument:port=6667

The dsconfig command above configured the irc-alert-handler to connect to irc.freenode.net on port 6667, use nick "adm-alerts"
and join channel #slamd. Alerts appear in the specified channel.

About Terry Gardner

Terry Gardner was a leading directory services architect with experience with many large scale directory services installations and messaging server installations, and was a Subject Matter Expert in the field of Directory Services and Solaris (operating system) performance. Mr. Gardner also participated in the open-source software community. Mr. Gardner passed away in December, 2013.
This entry was posted in computing, Java, LDAP and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s