cookbook 'zenoss_client', '~> 1.1.2'
zenoss_client (3) Versions 1.1.2 Follow0
Configures a node to be a Zenoss client/monitored node
cookbook 'zenoss_client', '~> 1.1.2', :supermarket
knife supermarket install zenoss_client
knife supermarket download zenoss_client
Zenoss Client Cookbook
The zenoss_client cookbook is intended to replace the functionality that used
to reside in the client recipe of the Zenoss cookbook.
In anticipation of updates to that cookbook to support Core 4, the client
logic is being split out to its own cookbook to help ease testing as well as
reduce dependencies. The updates to the Zenoss cookbook to support core 4 will
introduce a large number of dependencies, which most clients simply won't need.
Additionally by splitting out the client components, we are laying the
groundwork to later add some support for nodes to self-register using the
JSON API.
As of 1.1.0 a new LWRP was introduced which will allow nodes to register
themselves with a Zenoss server using the JSON API. Please see the details
on the LWRP below.
Requirements
This cookbook will need access to rubygems.org, or your node must be
pre-configured with a gem source that mirrors rubygems.org
Usage
Include the default recipe in node's run_list and it will be configured.
If you are an environment where creating a local user for Zenoss to use
is not desirable, be sure to set the value of
node['zenoss']['client']['create_local_user']
to false. Doing so will
prevent a local user from being created
Attributes
The attributes are documented in the default attributes file
(attributes/default.rb
). Please refer to that file for details about
the available attributes
Recipes
Currently the only recipe that exists is the default recipe
LWRP: zenoss_client
The Zenoss Client LWRP can be used to to register nodes on a Zenoss server.
The primary use case is for nodes to register themselves as part of the
bootstrap process, however the LWRP is constructed in such a way that you could
register other nodes as well (i.e. using nodes discovered via search on a
central node somewhere).
Usage
The LWRP makes use of the zenoss_client gem
to communicate with the JSON API. The default recipe in this cookbook will
handle installing the gem. It is important that you
include_recipe "zenoss_client"
before attempting to call the LWRP.
Alternatively you if don't want to run the default recipe for some reason you
will need to handle the chef_gem "zenoss_client"
installation yourself
somewhere in your run_list prior to calling the LWRP.
Actions
-
:add
- Add/register a node with a Zenoss Server. Default -
delete
- Delete a node from a Zenoss Server
Attributes
-
device_title
- The display name or title as displayed in the Zenoss UI- Type: String
- Default: Name Attribute of the Resource
-
api_host
- The host/ip of your Zenoss API. Generally this will be your Zenoss server name, however if you're running Zenoss behind a VIP or something along those lines, you could put that here
- Type: String
- Default:
node['zenoss']['client']['server']
-
api_port
- The HTTP port of your Zenoss API.- Type: Integer
- Default:
node['zenoss']['client']['server_port']
-
api_user
Required - The username to use for API authentication- Type: String
- Default: nil
-
api_password
Required - The password to use for API authentication- Type: String
- Default: nil
-
api_protocol
- The protocol/scheme to use for API communications. Must be either http or https- Type: String
- Default: http
-
wait_for
- The amount of time to wait for confirmation that the device has been added. When you add a device via the API, a background job is queued and Zenoss will try and collect some basic information about the node. Generally, this is a fairly fast operation, but depending on your network this might take longer. The default behavior of the LWRP will is to fire and forget. That means as soon as the JSON API responds that the background job has been queued, the run will continue. Setting a value for this will result in the run blocking until the node is registered or the amount of elapsed time exceeds this value- Type: Integer
- Default: 0
-
ip
- The IP that is to be set as the manage IP of the device- Type: String
- Default:
node['ipaddress']
-
collector
- The collector aka 'remote collector' that the device should be assigned to.- Type: String
- Default: "localhost"
-
device_class
- The Device Class that the node should get put in- Type: String
- Default: "/Devices/Server"
-
comments
- Comments to put on the Device- Type: default
- Default: ""
Examples
The testing recipe
used to test this cookbook is a good place to look for example usages, but here
are a couple of examples.
Example 1: Register this node
# Use the 'fire and forget' method, and don't wait for confirmation
zenoss_client node.name do
action :add
api_user "MyZenossAPIUser"
api_password "MyZenossAPIPassword"
end
Example 2: Register some other node
# Register a new node name 'TestDevice1'.
# Wait **up to** 120 seconds for the node to be registered
# Register the device with a management IP of 1.1.1.1
zenoss_client "TestDevice1" do
action :add
api_user "MyZenossAPIPassword"
api_password node['zenoss']['client']['test']['api_password']
wait_for 120
ip "1.1.1.1"
end
Example 3: Delete this node
# Delete *this* node
zenoss_client node.name do
action :delete
api_user "MyZenossAPIUser"
api_password "MyZenossAPIPassword"
end
Authors
Author:: David Petzel (davidpetzel@gmail.com)
Testing
This cookbook is setup to be tested using
test-kitchen and supporting tools.
You should ensure you have the following set of utilities on your machine:
You should refer to the Test Kitchen documentation for more in depth information
around running tests, however here is a quick rundown.
You can see the available test suites by running via the kitchen list
command.
This will show you each combination that is available for testing.
You can run all tests by running kitchen test
. Or if you only want to test
Centos 6.4, you could run kitchen test zenoss-client-centos-64
. You can also
use regular expression in place of the suite name to run a subset of all suites
Currently the platforms and suite(s) are configured to provide test coverage
of both Chef 10 and Chef 11.
Testing Setup
In order to properly test this cookbook it needs to interact with a remote Zenoss server. It is suggested that you use the Zenoss cookbook to create a fresh Zenoss instance for testing. Once you have a test Zenoss server in place you should set the following environment variables, which test-kitchen will use to populate some node attribute used for testing:
-
ZENOSS_CLIENT_SERVER
: This should be the IP for FQDN of the test Zenoss server you want to test against. If this is not set, test-kitchen will default to '127.0.0.1' -
ZENOSS_CLIENT_SERVER_PORT
: This is the port on which your test Zenoss server is running. If not set test-kitchen will default to 8080. -
ZENOSS_CLIENT_TEST_API_USER
: This is the user account that will be used to authenticate against the JSON API. If not set a default of 'admin' will be used. -
ZENOSS_CLIENT_TEST_API_PASSWORD
: This is the password that will be used to authenticate against the JSON API. If not set a default of 'zenoss' will be used
Releasing
This cookbook uses an 'even number' release strategy. The version number in master
will always be an odd number indicating development, and an even number will
be used when an official build is released.
Come release time here is the checklist:
- Ensure the
metadata.rb
reflects the proper even numbered release - Ensure there is a dated change log entry in
CHANGELOG.md
- Commit all the changes
- Ensure a git tag has applied in the format of v#.#.# (git tag -a v#.#.# -m 'v#.#.#')
- Commit and push including tags (
git push upstream master --tags
) - Share the cookbook to the community site
knife cookbook site share zenoss_client 'Monitoring & Trending' -o ../
- Bump the version in metadata.rb to the next patch level odd number
Contributors
- sfiggins stephen.figgins@gmail.com
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Collaborator Number Metric
1.1.2 failed this metric
Failure: Cookbook has 1 collaborators. A cookbook must have at least 2 collaborators to pass this metric.
Contributing File Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.2 failed this metric
FC009: Resource attribute not recognised: zenoss_client/recipes/default.rb:48
FC064: Ensure issues_url is set in metadata: zenoss_client/metadata.rb:1
FC065: Ensure source_url is set in metadata: zenoss_client/metadata.rb:1
FC066: Ensure chef_version is set in metadata: zenoss_client/metadata.rb:1
FC069: Ensure standardized license defined in metadata: zenoss_client/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: zenoss_client/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:48
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:82
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.1.2 passed this metric
Testing File Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.2 failed this metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file
Foodcritic Metric
1.1.2 failed this metric
FC009: Resource attribute not recognised: zenoss_client/recipes/default.rb:48
FC064: Ensure issues_url is set in metadata: zenoss_client/metadata.rb:1
FC065: Ensure source_url is set in metadata: zenoss_client/metadata.rb:1
FC066: Ensure chef_version is set in metadata: zenoss_client/metadata.rb:1
FC069: Ensure standardized license defined in metadata: zenoss_client/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: zenoss_client/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:48
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:82
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
No Binaries Metric
1.1.2 passed this metric
Testing File Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.2 failed this metric
FC064: Ensure issues_url is set in metadata: zenoss_client/metadata.rb:1
FC065: Ensure source_url is set in metadata: zenoss_client/metadata.rb:1
FC066: Ensure chef_version is set in metadata: zenoss_client/metadata.rb:1
FC069: Ensure standardized license defined in metadata: zenoss_client/metadata.rb:1
FC070: Ensure supports metadata defines valid platforms: zenoss_client/metadata.rb:1
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:48
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:54
FC085: Resource using new_resource.updated_by_last_action to converge resource: zenoss_client/providers/default.rb:82
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any
1.1.2 passed this metric
Testing File Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file
Version Tag Metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number
1.1.2 failed this metric
1.1.2 failed this metric
Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number