cookbook 'zabbix-ruby-client', '= 0.0.11'
zabbix-ruby-client (5) Versions 0.0.11 Follow1
Installs/Configures Zabbix-ruby-client
cookbook 'zabbix-ruby-client', '= 0.0.11', :supermarket
knife supermarket install zabbix-ruby-client
knife supermarket download zabbix-ruby-client
Zabbix Ruby Client Cookbook
This cookbook is designed for installing zabbix-ruby-client on an Ubuntu server, with zabbix-sender v2.2. It's based on the version 0.1.0 of zabbix-ruby-client (called zrc for short).
The principle of it is to use the chef client embedded ruby from /opt/chef/embedded/bin so there is no need to install a system or versionned ruby on all servers just for that.
Tested in the kitchen on
- Ubuntu 12.04
- Ubuntu 14.04
- CentOs 5.10
- CentOs 6.5
It should also work on RHEL 5 and 6, Oracle Linux 5 and 6, Debian 6 and 7.
It will install:
- the zabbix source list for ubuntu
- the zabbix-sender package
- the zabbix-ruby-client from rubygems (or from github if node.zrc.development = true) using the chef embedded
gemcommand - a
/etc/default/zrcwith a flag to run it or not - config.yml and tasks (minutely.yml) in
/etc/zrc/ - a
zrcsystem user with a home in/var/lib/zrc - a data dir at
/var/cache/zrc - a log dir at
/var/log/zrc - a rotatelog config to rotate the logs every week
- a bash wrapper in
/usr/bin/zrc_sendthat launches zrc using the chef embedded ruby version - a cronfile gathering the triggering of all tasks at
/etc/cron.d/zabbix
Attributes
| Attribute | Default | Description |
|---|---|---|
| zrc.version | "0.1.0" | Version of the zabbix-ruby-client to install (if development is false) |
| zrc.enabled | true | If not enabled the cronjob is disabled |
| zrc.admin_email | "root" | email or unix account used in the .forward in the home of the zrc user |
| zrc.ruby_bin | "/opt/chef/embedded/bin/ruby" | path to the ruby used by zrc |
| zrc.gem_bin | "/opt/chef/embedded/bin/gem" | path to the gem command used to install zrc |
| zrc.binpath | "/opt/chef/embedded/bin/zrc" | path where the zrc command will be installed |
| zrc.zrc_send | "1" | if set to "0" disables the sending of data |
| zrc.development | false | if set to true, use github master branch rather than the published gem version |
| zrc.repo_url | "https://github.com/eduvo/zabbix-ruby-client.git" | if zrc.development is true, this repo will be used for getting the gem source |
| zrc.repo_branch | "master" | if zrc.development is true, this branch will be used for getting the gem source |
| zrc.server.host | "localhost" | url of the zabbix server |
| zrc.server.port | "10051" | port of the trapper daemon on the zabbix server |
| zrc.schedule | see below | schedule object used to build the tasks files and cron file |
Default schedule
{
"minutely": {
"cron": "* * * * *",
"tasks": [
{ "name": "load" },
{ "name": "memory" },
{ "name": "cpu" }
]
},
"hourly": {
"cron": "0 * * * *",
"tasks": [
{ "name": "apt" }
]
},
"monthly": {
"cron": "0 0 1 * *",
"tasks": [
{ "name": "sysinfo" }
]
}
}
if you want to add values to the schedule, use default_attribute in a role file. For example I have a zrc-linode.json, which adds disk and network interface to the minutely task role with:
{
"name": "zrc-linode",
"chef_type": "role",
"json_class": "Chef::Role",
"description": "ZRC linode eth and disks",
"default_attributes": {
"zrc": {
"schedule": {
"minutely": {
"tasks": [
{ "name": "disk", "args": "[ xvda, /, xvda ]" },
{ "name": "network", "args": "[ eth0 ]" }
]
}
}
}
}
}
If you need to overwrite the default values, you can use overwrite_attributes.
Debugging
By setting zrc.zrc_send to '0', the cronjobs still run but they are not passed to zabbix_sender, they are sent to output, then sent to the admin_email, so you can check if the values are collected properly.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Contributors
- @mose - author
License
Copyright 2013 Faria Systems - MIT license - created by mose at mose.com
Dependent cookbooks
| logrotate ~> 1.6.0 |
| git ~> 4.0.2 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Zabbix Ruby Client Cookbook CHANGELOG
0.0.11 - 2014-08-25
- [mose] transform tasks list from array to hash to it can be merged easier
- [mose] fix kitchen tests
0.0.10 - 2014-08-24
- [mose] fix on the
zrc.enablesyntax
0.0.9 - 2014-08-24
- [mose] add a
zrc.enabledattribute to inhibit cron job - [mose] ass a
zrc.repo_urlfor development so a fork can be used for zabbix-ruby-client - [mose] ass a
zrc.repo_branchfor development so an arbitrary branch can be used for zabbix-ruby-client
0.0.8 - 2014-08-23
- [mose] write tests using kitchen-docker
- [mose] make tests work on mac when using docker-osx
- [mose] refactor for centos compatibility
- [mose] first publication on the Supermarket
0.0.1 - 2014-08-20
- [mose] Initial preparation of the cookbook