1 heat_template_version: 2013-05-23
4 Test template using Cloud Monitoring
11 image: Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)
12 flavor: 2 GB Performance
13 name: { get_param: "OS::stack_name" }
20 echo "deb http://stable.packages.cloudmonitoring.rackspace.com/ubuntu-14.04-x86_64 cloudmonitoring main" > /etc/apt/sources.list.d/rackspace-monitoring-agent.list
21 curl https://monitoring.api.rackspacecloud.com/pki/agent/linux.asc | sudo apt-key add -
23 apt-get -y install rackspace-monitoring-agent apache2
24 echo "monitoring_token {{token}}" > /etc/rackspace-monitoring-agent.cfg
25 service rackspace-monitoring-agent restart
27 "{{token}}": { get_resource: token }
29 rax-heat: { get_param: "OS::stack_id" }
30 stack-name: { get_param: "OS::stack_name" }
32 ######################################################################################
33 # THIS TEMPLATE USES THE SERVERMILL CREATED ENTITY FOR CHECKS AND STUFF. JUST CREATE #
34 # THIS ENTITY TO ENSURE THAT THE ENTITY RESOURCE WORKS. #
35 ######################################################################################
37 type: Rackspace::CloudMonitoring::Entity
39 label: { get_param: "OS::stack_name" }
41 rax-heat: { get_param: "OS::stack_id" }
42 stack-name: { get_param: "OS::stack_name" }
44 web_server: { get_attr: [ server, accessIPv4 ] }
47 type: Rackspace::CloudMonitoring::AgentToken
49 label: { get_param: "OS::stack_name" }
52 type: Rackspace::CloudMonitoring::Check
54 entity: { get_resource: server }
59 template: http://server_ip/
61 server_ip: { get_attr: [ server, accessIPv4 ] }
64 rax-heat: { get_param: "OS::stack_id" }
65 stack-name: { get_param: "OS::stack_name" }
68 monitoring_zones_poll:
69 - Northern Virginia (IAD)
71 target_hostname: { get_attr: [ server, accessIPv4 ] }
75 type: Rackspace::CloudMonitoring::Check
77 entity: { get_resource: server }
82 rax-heat: { get_param: "OS::stack_id" }
83 stack-name: { get_param: "OS::stack_name" }
88 type: Rackspace::CloudMonitoring::Notification
90 label: email_heat_team
93 address: "admin@example.com"
96 type: Rackspace::CloudMonitoring::Notification
98 label: email_heat_team_2
101 address: "allclear@example.com"
104 type: Rackspace::CloudMonitoring::NotificationPlan
106 label: { get_param: "OS::stack_name" }
108 - { get_resource: email_notification }
110 - { get_resource: email_notification }
113 type: Rackspace::CloudMonitoring::PlanNotifications
115 plan: { get_resource: notify_heat_team }
117 - { get_resource: email_notification_2 }
120 type: Rackspace::CloudMonitoring::Alarm
122 label: test_cpu_alarm
123 check: { get_resource: cpucheck }
124 plan: { get_resource: notify_heat_team }
126 :set consecutiveCount=5
127 if (metric['usage_average'] > 95) {
128 return new AlarmStatus(CRITICAL, 'CPU usage is #{usage_average}%');
130 if (metric['usage_average'] > 85) {
131 return new AlarmStatus(WARNING, 'CPU usage is #{usage_average}%');
133 return new AlarmStatus(OK);
135 rax-heat: { get_param: "OS::stack_id" }
136 stack-name: { get_param: "OS::stack_name" }