cookbook 'rackspace_monitoring', '= 1.0.5'
rackspace_monitoring (10) Versions 1.0.5 Follow1
Installs/Configures rackspace_monitoring
cookbook 'rackspace_monitoring', '= 1.0.5', :supermarket
knife supermarket install rackspace_monitoring
knife supermarket download rackspace_monitoring
rackspace_monitoring-cookbook
The Rackspace Cloud-monitoring cookbook provides resource primitives (LWRPs) for use in recipes.
The goal is to offer resources to configure Rackspace Cloud-monitoring
In scope
This cookbook focuses on installing the Rackspace monitoring agent and creating check/alarms. Future plans include to support non-cloud servers.
Out of scope
This cookbook has not been designed to directly call Rackspace API. Instead it relies on the Rackspace monitoring agent.
Supported Platforms
- Centos 6.5
- Ubuntu 12.04
- Ubuntu 14.04
Windows is not supported yet.
Usage
Place a dependency on the rackspace_monitoring cookbook in your cookbook's metadata.rb
depends 'rackspace_monitoring'
Then, in a recipe:
rackspace_monitoring_service 'default' do
cloud_credentials_username 'my_user'
cloud_credentials_api_key 'uc60892165188d7i786p833917a3v7613'
action [:create, :start]
end
rackspace_monitoring_check 'filesystem' do
type 'agent.filesystem'
target '/var'
alarm true
action :create
end
Resources
rackspace_monitoring_service
The rackspace_monitoring_service
resources manages the basic plumbing needed to get a rackspace-monitoring agent instance running with minimal configuration.
The :create action handles package installation. The internal configuration file contains just enough to get the service up and running, then loads extra configuration from a rackspace-monitoring-agent.conf.d directory.
Parameters
-
cloud_credentials_username
- Your cloud username -
cloud_credentials_api_key
- Your cloud api-key -
package_name
- Rackspace monitoring agent package name (default torackspace-monitoring-agent
) -
package_action
- Which action to run when:create
default toinstall
Actions
-
:create
- Configures everything but the underlying operating system service -
:delete
- Removes everything -
:start
- Starts the underlying operating system service -
:stop
- Stops the underlying operating system service -
:restart
- Restarts the underlying operating system service -
:reload
- Reloads the underlying operating system service -
:disable/:enable
Enables/Disables the underlying operating system service
rackspace_monitoring_check
The rackspace_monitoring_check
resources creates the agent configuration for a defined type.
The :create action handles package installation. The internal configuration file contains just enough to get the service up and running, then loads extra configuration from a rackspace-monitoring-agent.conf.d directory.
Parameters
Common to all checks
-
:label
- optional - A friendly label for a check - Default : Check for:type
-
:alarm
- optional - Enable or disable the alarm on a check - Default : false -
:alarm_criteria
- optional - Criteria used to trigger alarms - Default : agent specific./libaries/helpers.rb
=>parsed_alarm_criteria
-
:period
- optional - The period in seconds for a check. The value must be greater than the minimum period set on your account -Default : 90 -
:timeout
- optional - The timeout in seconds for a check. This has to be less than the period - Default : 30 -
:critical
- optional - Threshold for the default alarm criteria - Default : 95 -
:warning
- optional - Threshold for the default alarm criteria - Default : 90 -
:notification_plan_id
- optional - Notification plan for the alarms - Default : npTechnicalContactsEmail -
:variables
- optional - Additional variables you want to use in the template.variable_name => 'value'
. It will allow to add attributes to the agent configuration if you need more than the default ones. Here is an example forremote.http
. If you want to create your own:template
you can use all the:variables
with@variable_name
.
Used on some checks (filesystem/disk/network)
-
:target
- used for filesystem/disk/network only-
disk
: The disk to check (eg '/dev/xvda1') String/Array - Default : Create one file per /dev/(sd|vd|xvd|hd) -
filesystem
: The mount point to check (eg '/var' or 'C:') String/Array - Default : Create one file per filesystem -
network
: The network device to check (eg 'eth0') - Default : Fallback to the default interface
-
-
:target_hostname
- required for http only - Server to request for the HTTP check -
:send_warning
- required for network only - Threshold for the default send alarm criteria - Default : 18350080 -
:send_critical
- required for network only - Threshold for the default send alarm criteria - Default : 24903680 -
:recv_warning
- required for network only - Threshold for the default receive alarm criteria - Default : 18350080 -
:recv_critical
- required for network only - Threshold for the default send alarm criteria - Default : 24903680
Plugins attributes
-
:plugin_url
- optional if:plugin_filename
has been provided - Url from where to download a plugin. i.e https://raw.githubusercontent.com/racker/rackspace-monitoring-agent-plugins-contrib/master/chef_node_checkin.py -
:plugin_args
- optional - Arguments to pass to the plugin (Array) -
:plugin_filename
- optional if:plugin_url
has been provided, mandatory otherwise. -
:plugin_timeout
- optional - The timeout for the plugin execution - Default : 30
Template config
-
:cookbook
- optional - Where to look for the agent yaml template - Default : 'rackspace_monitoring' -
:template
- optional - Where to look for the agent yaml template - Default : ':type
.conf.erb' orcustom_check.conf.erb
-
:type
- required - Which kind of agent to configure. Supported agents :- agent.memory
- agent.cpu
- agent.load
- agent.filesystem
- agent.disk
- agent.network
- agent.plugin
- remote.http
- anything else will load
custom_check.conf.erb
and all the parameters and variables will be available in the template. Rackspace check types
Actions
-
:create
- Create an agent configuration -
:delete
- Removes an agent configuration (will not remove the check) -
:disable/:enable
Disable/enable the agent check.
Examples
CPU agent with alarm enabled
rackspace_monitoring_check 'Cpu check' do
type 'agent.cpu'
alarm true
action :create
end
Create a new agent config from scratch
By example remote.ping
which is not a supported type
rackspace_monitoring_check 'custom' do
type 'remote.ping'
cookbook 'rackspace_monitoring_check_test'
template 'user_defined.conf.erb'
alarm true
variables 'count' => '10'
action :create
end
Then you can have your own template :
type: remote.ping
label: Remote ping check on <%= @target_hostname %>
disabled: <%= @disabled %>
period: <%= @period %>
timeout: <%= @timeout %>
target_hostname: <%= @target_hostname %>
monitoring_zones_poll:
- mzdfw
- mzord
- mziad
details:
<% @variables.each do |param,value| %>
<%= param -%>: <%= value %>
<% end %>
Create a http agent but add some variables not exposed by the resource as parameters
hostname = 'dummyhost.com'
rackspace_monitoring_check 'http' do
type 'remote.http'
target_hostname hostname
alarm true
variables 'url' => "http://#{hostname}/healthcheck",
'body' => 'Status OK'
action :create
end
Create a plugin check chef_node_checkin(rackspace-monitoring-agent-plugins-contrib)
rackspace_monitoring_check 'agent.plugin' do
type 'agent.plugin'
plugin_url 'https://raw.githubusercontent.com/racker/rackspace-monitoring-agent-plugins-contrib/master/chef_node_checkin.py'
plugin_args '--debug'
plugin_filename 'awesome_plugin.py'
alarm true
action :create
end
References
Contributing
- Fork the repository on Github
- Create a named feature branch (i.e.
add-new-recipe
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request
License and Authors
Authors:: Julien Berard (julien.berard@rackspace.co.uk)
rackspace_monitoring CHANGELOG
1.0.5
- Ensure a downloaded plugin is executable
1.0.4
- Handle parsing filename even if type is not agent.plugin
1.0.3
- Changed cookbook_name template variable to cookbook
- Fixed hard coded notification plan in remote.http check
1.0.2
- fixed missing { in memory alarm
1.0.1
- Updated some metadatas
1.0.0
- Rename cookbook
- First stable release
0.0.7
- more integration tests
- alarm criteria have their own templates
0.0.6
- Updated default threshold for Network check
0.0.5
- Fixed behavior on auto-target without alarm #10
0.0.4
- No default alarm_criteria for agent.disk, disable alarm if automatic target detection and no alarm_criteria
Foodcritic Metric
1.0.5 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/080c52b18cf571d0270d548c/rackspace_monitoring/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/080c52b18cf571d0270d548c/rackspace_monitoring/metadata.rb:1
1.0.5 failed this metric
FC045: Consider setting cookbook name in metadata: /tmp/cook/080c52b18cf571d0270d548c/rackspace_monitoring/metadata.rb:1