launch IRB
irb
init flapjack-diner
require 'flapjack-diner'
Flapjack::Diner.base_uri('127.0.0.1:3081')
create ALL entity (if not created yet)
entity_all_data = {
:id => 'ALL',
:name => 'ALL'
}
unless Flapjack::Diner.entities(entity_all_data[:id])
puts "Creating entity: ALL"
Flapjack::Diner.create_entities([entity_all_data])
end
create contact
ada_data = {
:first_name => 'Yevgen',
:last_name => 'V',
:email => '[email protected]'
}
Flapjack::Diner.create_contacts([ada_data])
get the id of contact and fill in to create medium
ada_data = {
:id => '1a86e7a6-c0c3-49d4-8e1f-c472510b9b97'
}
medium = {
:type => 'jabber',
:address => '[email protected]',
:interval => 300,
:rollup_threshold => 0
}
ada = Flapjack::Diner.contacts(ada_data[:id]).first
if ada[:links][:media].empty?
puts "Creating Ada's media"
Flapjack::Diner.create_contact_media(ada_data[:id], [medium])
end
get the medium id and update rollup
Flapjack::Diner.update_media('1a86e7a6-c0c3-49d4-8e1f-c472510b9b97_jabber', :rollup_threshold => nil)
add contact to ALL entity
entity_all = Flapjack::Diner.entities(entity_all_data[:id]).first
unless entity_all[:links][:contacts].include?(ada_data[:id])
puts "Adding Ada to the ALL entity"
Flapjack::Diner.update_entities(entity_all_data[:id], :add_contact => ada_data[:id])
end
list contacts and get right contact id and notification rule id
syrup -r contact get
update notification rules to send only critical to certain media (i is default rule id)
syrup -r rule update -i 68b94377-13fe-40a5-9ad2-32703f0adb78 -u '' -w '' -c email,sms,sms_twilio,sms_nexmo,jabber,sns
create pagerduty rule with generalquarters tag (i is contact id)
syrup -r rule create -i dc1e0d76-1bfc-4f15-b574-dd073d4e142d -t generalquarters -u '' -w '' -c pagerduty,jabber
login to pagerduty, create account (ex. streamfury.pagerduty.com), create service (ex. streamfury), copy api key and login details for users, create pagerduty login for contact
syrup -r pagerduty create -i 4a5a7863-ae77-4048-af4c-b87221fa3e0f --service-key 1f49466e1a6a42f2b4e4479fc1d7d119 --subdomain streamfury --username [email protected] --password supersecretpassword