Skip to content

Commit

Permalink
Merge pull request #16 from pavel-shpilev/master
Browse files Browse the repository at this point in the history
Fixing elasticsearch and redis plugins. Adding memcahed plugin.
  • Loading branch information
dstockman committed Jul 1, 2014
2 parents fc8e630 + 0422108 commit 400738b
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ In chronological order:
* Hiera support
* Windows support

* Pav Shpilev <[email protected]>
* Code restructure & bugfixes
* Memcached plugin support

25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,24 @@ Values enclosed in () have an undef default and are optional.

### Redis

Configures the redis plugin on the local host running on port 6379. Note: this module requires hiredis-devel be available to the system.
Configures the redis plugin on the local host running on port 6379.
Note: this module requires hiredis-devel be available to the system.

```yaml
stackdriver::plugin::redis::host: 'localhost'
stackdriver::plugin::redis::port: '6379'
stackdriver::plugin::redis::timeout: '2000'
```

### Memcached

Configures the memcahed plugin on the local host running on port 11211.
All settings are optional.

```yaml
stackdriver::plugin::memcahed::host: 'localhost'
stackdriver::plugin::memcahed::port: '11211'
```

### MongoDB

Expand All @@ -144,7 +154,8 @@ stackdriver::plugin::mongo::port: '27017'

### Postgresql

Configures the Postgreqsql plugin on the local host using UNIX domain sockets. Prerequisites for this plugin are documented on Stackdriver's [support site](http://feedback.stackdriver.com/knowledgebase/articles/232555-postgresql-plugin).
Configures the Postgreqsql plugin on the local host using UNIX domain sockets.
Prerequisites for this plugin are documented on Stackdriver's [support site](http://feedback.stackdriver.com/knowledgebase/articles/232555-postgresql-plugin).

```yaml
stackdriver::plugin::postgres::user: 'stackdriver'
Expand Down Expand Up @@ -184,7 +195,14 @@ stackdriver::plugin::apache::url: 'http://127.0.0.1/mod_status?auto'

### Elasticsearch

Configures the Elasticsearch plugin on the local host using port 9200. Prerequisites for this plugin are documented on Stackdriver's [support site](http://feedback.stackdriver.com/knowledgebase/articles/268555-elasticsearch-plugin).
Configures the Elasticsearch plugin on the local host using port 9200.
Host and Port settings are optional.
Prerequisites for this plugin are documented on Stackdriver's [support site](http://support.stackdriver.com/customer/portal/articles/1491778-elasticsearch-plugin).

```yaml
stackdriver::plugin::elasticsearch::host: 'localhost'
stackdriver::plugin::elasticsearch::port: '9200'
```


### RabbitMQ
Expand Down Expand Up @@ -235,4 +253,3 @@ JAVA_OPTS="${JAVA_OPTS} -Djava.rmi.server.hostname=<%= @fqdn %>"
* Stackdriver Website: [http://www.stackdriver.com](http://www.stackdriver.com)
* Stackdriver Signup: [http://www.stackdriver.com/signup](http://www.stackdriver.com/signup)
11 changes: 11 additions & 0 deletions manifests/plugin/elasticsearch.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
# - Default - /opt/stackdriver/collectd/etc/collectd.d/elasticsearch.conf
# - Plugin configuration file
#
# [*host*]
# - Default - localhost
# - Target host
#
# [*port*]
# - Default - 6379
# - Target port
#
# === Usage
# ---
#
Expand All @@ -43,6 +51,9 @@

$config = '/opt/stackdriver/collectd/etc/collectd.d/elasticsearch.conf',

$host = 'localhost',
$port = 9200,

) {

if $pkg { validate_string ( $pkg ) }
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/elasticsearch/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

file { $config:
ensure => file,
source => "puppet:///modules/stackdriver/${::kernel}/${config}",
content => template("stackdriver/${::kernel}/${config}.erb"),
owner => 'root',
group => 'root',
mode => '0444',
Expand Down
2 changes: 1 addition & 1 deletion manifests/plugin/elasticsearch/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
fail("No package defined for OS ${::operatingsystem}")
}

ensure_packages($pkg)
ensure_packages([$pkg])

}
53 changes: 53 additions & 0 deletions manifests/plugin/memcached.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 foldmethod=marker
#
# == Class: stackdriver::plugin::memcached
#
# Enable Memcached Agent Plugin for Stackdriver Agent
#
# === Parameters
# ---
#
# [*conf*]
# - Default - /opt/stackdriver/collectd/etc/collectd.d/memcached.conf
# - Plugin configuration file
#
# [*host*]
# - Default - localhost
# - Target host
#
# [*port*]
# - Default - 11211
# - Target port
#
#
# === Usage
# ---
#
# ==== Puppet Code
#
# Enable Memcached plugin via Puppet CODE:
#
# include '::stackdriver::plugin::memcached'
#
# ==== Hiera
#
# Enable Memcached plugin via Hiera:
#
# stackdriver::plugins:
# - 'memcached'
#
class stackdriver::plugin::memcached(

$config = '/opt/stackdriver/collectd/etc/collectd.d/memcached.conf',
$host = 'localhost',
$port = 11211,

) {

validate_string ( $config )
validate_string ( $host )

contain "${name}::config"

}

19 changes: 19 additions & 0 deletions manifests/plugin/memcached/config.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2 foldmethod=marker
#
# == Class: stackdriver::plugin::memcached::config
#
# Configures Memcached Agent Plugin for Stackdriver Agent
#
class stackdriver::plugin::memcached::config inherits stackdriver::plugin::memcached {

file { $config:
ensure => file,
content => template("stackdriver/${::kernel}/${config}.erb"),
owner => 'root',
group => 'root',
mode => '0444',
notify => Service[$::stackdriver::svc],
}

}

2 changes: 1 addition & 1 deletion manifests/plugin/redis/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
fail("No package defined for OS ${::operatingsystem}")
}

ensure_packages($pkg)
ensure_packages([$pkg])

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LoadPlugin target_set

LoadPlugin "curl_json"
<Plugin curl_json>
<URL "http://localhost:9200/_cluster/nodes/_local/stats?all=true">
<URL "http://<%= @host %>:<%= @port %>/_nodes/_local/stats/">
Instance "elasticsearch"
<Key "nodes/*/indices/docs/count">
Type "gauge"
Expand All @@ -32,13 +32,13 @@ LoadPlugin "curl_json"
<Key "nodes/*/indices/indexing/index_time_in_millis">
Type "counter"
</Key>
<Key "nodes/*/indices/indexing/delete_total">
Type "counter"
</Key>
<Key "nodes/*/indices/indexing/delete_time_in_millis">
Type "counter"
</Key>
<Key "nodes/*/indices/get/total">
<Key "nodes/*/indices/indexing/delete_total">
Type "counter"
</Key>
<Key "nodes/*/indices/indexing/delete_time_in_millis">
Type "counter"
</Key>
<Key "nodes/*/indices/get/total">
Type "counter"
</Key>
<Key "nodes/*/indices/get/time_in_millis">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LoadPlugin "memcached"
<Plugin "memcached">
Host "<%= @host %>"
Port "<%= @port %>"
</Plugin>

0 comments on commit 400738b

Please sign in to comment.