Class: SystemdMon::Notifiers::Hipchat
- Defined in:
- lib/systemd_mon/notifiers/hipchat.rb
Instance Method Summary collapse
-
#initialize ⇒ Hipchat
constructor
A new instance of Hipchat.
- #notify!(notification) ⇒ Object
- #notify_start!(hostname) ⇒ Object
- #notify_stop!(hostname) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Hipchat
12 13 14 15 16 17 |
# File 'lib/systemd_mon/notifiers/hipchat.rb', line 12 def initialize(*) super self.client = ::HipChat::Client.new( ['token'], :api_version => 'v2') end |
Instance Method Details
#notify!(notification) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/systemd_mon/notifiers/hipchat.rb', line 29 def notify!(notification) unit = notification.unit = "#{notification.type_text}: systemd unit #{unit.name} on #{notification.hostname} #{unit.state_change.status_text}: #{unit.state.active} (#{unit.state.sub})" chat , color(notification.type) log "sent hipchat notification" end |
#notify_start!(hostname) ⇒ Object
19 20 21 22 |
# File 'lib/systemd_mon/notifiers/hipchat.rb', line 19 def notify_start!(hostname) chat "SystemdMon is starting on #{hostname}", 'green' end |
#notify_stop!(hostname) ⇒ Object
24 25 26 27 |
# File 'lib/systemd_mon/notifiers/hipchat.rb', line 24 def notify_stop!(hostname) chat "SystemdMon is stopping on #{hostname}", 'yellow' end |