Skip to content

Commit e54148e

Browse files
mtekelhenrytk
authored andcommitted
Add collectd to bosh
Add 0.4 release of our paas-collectd-boshrelease to BOSH. Send metrics to shared deployment graphite server. The initial reason why we used fork was that we could add custom tags and pin our deployment to these tags. Now, because bosh-init can only consume tarballs (you can't upload a release to bosh-init like you can to BOSH), I had to create a dev-release tarbal (using standard bosh-cli way bosh create release --with-tarball --force --version 0.4, more documentation about bosh releases: https://bosh.io/docs/create-release.html#dev-release-release). I have created the tarballs from the same code as is tagged. That is, 0.4 release is created from code that's tagged as 0.4. It seemed to me that a good place to put the release tarball was in github release. This practice is also used in some CF repositories (e.g. diego). We have a spike to analyse our situation with releases completely, but we did not want to block this story on it (#115142265 - see comments in the story). In the future, we can easily move the release location to elsewhere and we can change the way to build the releases. Because bosh-init currently uses template name as job name[1], it renders collectd config to say BOSH host is called `collectd`. Add a prefix that explicitly contains `bosh_` so that we can see which host are metrics coming from. [1] cloudfoundry-attic/bosh-init#87
1 parent de7017a commit e54148e

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

concourse/pipelines/create-bosh-cloudfoundry.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,7 @@ jobs:
754754
./bosh-CA-yml/bosh-ca-cert.yml
755755
./terraform-outputs/bosh.terraform-outputs.yml
756756
./terraform-outputs/vpc.terraform-outputs.yml
757+
./paas-cf/manifests/shared/deployments/collectd.yml
757758
run:
758759
path: sh
759760
args:
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
releases:
3+
- name: collectd
4+
sha1: 5e5c196f9c95fe12eb17bba0f40fdaecaddd6424
5+
url: https://github.com/alphagov/paas-collectd-boshrelease/releases/download/0.4/collectd-0.4.tgz
6+
7+
jobs:
8+
- name: bosh
9+
templates:
10+
- {name: collectd, release: collectd}
11+
12+
properties:
13+
collectd:
14+
hostname_prefix: bosh_
15+
interval: (( grab meta.collectd.interval ))
16+
config: (( grab meta.collectd.config ))

manifests/bosh-manifest/reference-bosh-manifest.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ jobs:
131131
release: bosh
132132
- name: health_monitor
133133
release: bosh
134+
- name: collectd
135+
release: collectd
134136
- name: registry
135137
release: bosh
136138
- name: aws_cpi
@@ -151,6 +153,51 @@ networks:
151153
- name: public
152154
type: vip
153155
properties:
156+
collectd:
157+
config: |
158+
LoadPlugin cpu
159+
LoadPlugin disk
160+
LoadPlugin entropy
161+
LoadPlugin interface
162+
LoadPlugin load
163+
LoadPlugin memory
164+
LoadPlugin swap
165+
LoadPlugin uptime
166+
167+
LoadPlugin df
168+
<Plugin df>
169+
ReportInodes true
170+
ReportReserved true
171+
</Plugin>
172+
173+
LoadPlugin syslog
174+
<Plugin syslog>
175+
LogLevel warning
176+
NotifyLevel WARNING
177+
</Plugin>
178+
179+
LoadPlugin vmem
180+
<Plugin vmem>
181+
Verbose false
182+
</Plugin>
183+
184+
LoadPlugin "write_graphite"
185+
<Plugin "write_graphite">
186+
<Node "myNode">
187+
#FIXME: hard coded static IP to be removed during #121602315
188+
# This address comes from 040-graphite.yml:31 and has been copied
189+
# as `grab` cannot interpolate in a multi-line string.
190+
Host "10.0.16.20"
191+
Port "2003"
192+
Prefix "collectd."
193+
EscapeCharacter "_"
194+
SeparateInstances true
195+
StoreRates false
196+
AlwaysAppendDS false
197+
</Node>
198+
</Plugin>
199+
hostname_prefix: bosh_
200+
interval: 10
154201
director:
155202
trusted_certs: |
156203
-----BEGIN RSA PRIVATE KEY-----
@@ -160,10 +207,14 @@ properties:
160207
0000000000000000000000000000000000000000000000000000000000000000
161208
0000000000000000000000000000000000000000000000000000000000000000
162209
-----END RSA PRIVATE KEY-----
210+
163211
releases:
164212
- name: bosh
165213
sha1: 6b12652650b87810dcef1be1f6a6d23f1c0c13a7
166214
url: https://bosh.io/d/github.com/cloudfoundry/bosh?v=255.8
215+
- name: collectd
216+
sha1: 5e5c196f9c95fe12eb17bba0f40fdaecaddd6424
217+
url: https://github.com/alphagov/paas-collectd-boshrelease/releases/download/0.4/collectd-0.4.tgz
167218
- name: bosh-aws-cpi
168219
sha1: dc4a0cca3b33dce291e4fbeb9e9948b6a7be3324
169220
url: https://bosh.io/d/github.com/cloudfoundry-incubator/bosh-aws-cpi-release?v=52
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
RSpec.describe "Bosh collectd properties" do
3+
let(:manifest) { manifest_with_defaults }
4+
5+
it "pulls from a shared config file" do
6+
expect(manifest.fetch("properties").fetch("collectd").fetch("interval")).to eq 10
7+
end
8+
end

manifests/bosh-manifest/spec/support/manifest_helpers.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def load_default_manifest
1717
File.expand_path("../../fixtures/bosh-secrets.yml", __FILE__),
1818
File.expand_path("../../fixtures/bosh-ssl-certificates.yml", __FILE__),
1919
File.expand_path("../../fixtures/bosh-terraform-outputs.yml", __FILE__),
20-
File.expand_path("../../fixtures/vpc-terraform-outputs.yml", __FILE__)
20+
File.expand_path("../../fixtures/vpc-terraform-outputs.yml", __FILE__),
21+
File.expand_path("../../../../shared/deployments/collectd.yml", __FILE__)
2122
].join(' ')
2223
)
2324
expect(status).to be_success, "build_manifest.sh exited #{status.exitstatus}, stderr:\n#{error}"

0 commit comments

Comments
 (0)