aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/profile/base')
-rw-r--r--manifests/profile/base/metrics/collectd.pp111
-rw-r--r--manifests/profile/base/metrics/collectd/collectd_plugin.pp6
-rw-r--r--manifests/profile/base/metrics/collectd/collectd_service.pp11
3 files changed, 80 insertions, 48 deletions
diff --git a/manifests/profile/base/metrics/collectd.pp b/manifests/profile/base/metrics/collectd.pp
index 0f738d1..d8e6f89 100644
--- a/manifests/profile/base/metrics/collectd.pp
+++ b/manifests/profile/base/metrics/collectd.pp
@@ -1,13 +1,27 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
# == Class: tripleo::profile::base::metrics::collectd
#
# Collectd configuration for TripleO
#
# === Parameters
#
-# [*collectd_plugins*]
-# (Optional) List. A list of collectd plugins to configure (the
-# corresponding collectd::plugin::NAME class must exist in the
-# collectd package).
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
#
# [*collectd_server*]
# (Optional) String. The name or address of a collectd server to
@@ -28,61 +42,62 @@
# [*collectd_securitylevel*]
# (Optional) String.
#
-# [*collectd_interface*]
-# (Optional) String. Name of a network interface.
-#
-# [*collectd_graphite_server*]
-# (Optional) String. The name or address of a graphite server to
-# which we should send metrics.
-#
-# [*collectd_graphite_port*]
-# (Optional) Integer. This is the port to which we will connect on
-# the graphite server. Defaults to 2004.
-#
-# [*collectd_graphite_prefix*]
-# (Optional) String. Prefix to add to metric names. Defaults to
-# 'overcloud.'.
-#
-# [*collectd_graphite_protocol*]
-# (Optional) String. One of 'udp' or 'tcp'.
-#
+# [*service_names*]
+# (Optional) List of strings. A list of active services in this tripleo
+# deployment. This is used to look up service-specific plugins that
+# need to be installed.
class tripleo::profile::base::metrics::collectd (
- $collectd_plugins = [],
+ $step = hiera('step'),
$collectd_server = undef,
- $collectd_port = 25826,
+ $collectd_port = undef,
$collectd_username = undef,
$collectd_password = undef,
$collectd_securitylevel = undef,
-
- $collectd_graphite_server = undef,
- $collectd_graphite_port = 2004,
- $collectd_graphite_prefix = undef,
- $collectd_graphite_protocol = 'udp'
+ $service_names = hiera('service_names', [])
) {
- include ::collectd
- ::tripleo::profile::base::metrics::collectd::plugin_helper { $collectd_plugins: }
+ if $step >= 3 {
+ include ::collectd
- if ! ($collectd_graphite_protocol in ['udp', 'tcp']) {
- fail("collectd_graphite_protocol must be one of 'udp' or 'tcp'")
- }
+ if ! ($collectd_securitylevel in [undef, 'None', 'Sign', 'Encrypt']) {
+ fail('collectd_securitylevel must be one of (None, Sign, Encrypt).')
+ }
+
+ # Load per-service plugin configuration
+ ::tripleo::profile::base::metrics::collectd::collectd_service {
+ $service_names: }
+
+ # Because THT doesn't allow us to default values to undef, we need
+ # to perform a number of transformations here to avoid passing a bunch of
+ # empty strings to the collectd plugins.
- if $collectd_server {
- ::collectd::plugin::network::server { $collectd_server:
- username => $collectd_username,
- password => $collectd_password,
- port => $collectd_port,
- securitylevel => $collectd_securitylevel,
+ $_collectd_username = empty($collectd_username) ? {
+ true => undef,
+ default => $collectd_username
+ }
+
+ $_collectd_password = empty($collectd_password) ? {
+ true => undef,
+ default => $collectd_password
}
- }
- if $collectd_graphite_server {
- ::collectd::plugin::write_graphite::carbon { 'openstack_graphite':
- graphitehost => $collectd_graphite_server,
- graphiteport => $collectd_graphite_port,
- graphiteprefix => $collectd_graphite_prefix,
- protocol => $collectd_graphite_protocol,
+ $_collectd_port = empty($collectd_port) ? {
+ true => undef,
+ default => $collectd_port
+ }
+
+ $_collectd_securitylevel = empty($collectd_securitylevel) ? {
+ true => undef,
+ default => $collectd_securitylevel
+ }
+
+ if ! empty($collectd_server) {
+ ::collectd::plugin::network::server { $collectd_server:
+ username => $_collectd_username,
+ password => $_collectd_password,
+ port => $_collectd_port,
+ securitylevel => $_collectd_securitylevel,
+ }
}
}
}
-
diff --git a/manifests/profile/base/metrics/collectd/collectd_plugin.pp b/manifests/profile/base/metrics/collectd/collectd_plugin.pp
new file mode 100644
index 0000000..5ab940b
--- /dev/null
+++ b/manifests/profile/base/metrics/collectd/collectd_plugin.pp
@@ -0,0 +1,6 @@
+# We use this to transform a list of unqualified plugin names
+# (like ['disk', 'ntpd']) into the correct collectd plugin classes.
+define tripleo::profile::base::metrics::collectd::collectd_plugin (
+) {
+ include "collectd::plugin::${title}"
+}
diff --git a/manifests/profile/base/metrics/collectd/collectd_service.pp b/manifests/profile/base/metrics/collectd/collectd_service.pp
new file mode 100644
index 0000000..c1b3a60
--- /dev/null
+++ b/manifests/profile/base/metrics/collectd/collectd_service.pp
@@ -0,0 +1,11 @@
+# This is used to look up a list of service-specific collectd plugins
+# in the hiera data provided by THT.
+define tripleo::profile::base::metrics::collectd::collectd_service (
+) {
+ $plugins = hiera("tripleo.collectd.plugins.${title}", [])
+
+ if $plugins {
+ ::tripleo::profile::base::metrics::collectd::collectd_plugin {
+ $plugins: }
+ }
+}
f='#n445'>445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733