librato.librato

Ansible 角色: Librato

一个安装和配置 Librato Agent 及插件的 Ansible 角色

需求

依赖

快速开始

开始的最低要求是设置 emailtoken 变量,并包含该角色:

- hosts: all
  roles:
    - { role: librato.librato, librato_email: '你@域名.com', librato_token: '你的令牌' }

默认启用以下插件:cpudfdiskswapmemoryload

要包括一个插件,只需设置它所需的任何变量,然后将其添加到 librato_enabled_plugins 变量中:

- hosts: all
  vars:
    librato_apache_path: '/my-status-endpoint'
    librato_enabled_plugins: ['apache']

支持的插件

  • cpu
  • df
  • memory
  • load
  • disk
  • swap
  • apache
  • nginx
  • nginx_plus
  • jvm
  • memcached
  • varnish
  • zookeeper
  • docker
  • elasticsearch
  • mongodb
  • postgresql
  • mysql
  • redis
  • haproxy

使用

使用自定义或上游 collectd 插件

要使用自己的自定义或上游 collectd 插件,只需让其他模块将配置放入 /opt/collectd/etc/collectd.conf.d/ 中,将任何自定义插件放入 /opt/collectd/share/collectd/ 中。

参考

插件: apache

  • librato_apache_protocol

    类型: 字符串

    要使用的协议。默认为 http。如果需要 SSL,请将其更改为 https

  • librato_apache_host

    类型: 字符串

    使用的主机名。默认为 localhost

  • librato.apace.path

    类型: 字符串

    状态页面的路径。默认为 /server-status?auto 会自动添加,因此无需包含。

  • librato_apache_user

    类型: 字符串

    用于受密码保护的状态页面的用户名。默认为空。

  • librato_apache_password

    类型: 字符串

    用于受密码保护的状态页面的密码。默认为空。

插件: docker

  • librato_docker_protocol

    类型: 字符串

    要使用的协议。默认为 http。如果需要 SSL,请将其更改为 https

  • librato_docker_host

    类型: 字符串

    Docker 主机名。默认为 localhost

  • librato_docker_port

    类型: 字符串

    Docker 端口。默认为 2735

插件: elasticsearch

  • librato_elasticsearch_protocol

    类型: 字符串

    要使用的协议。默认为 http。如果需要 SSL,请将其更改为 https

  • librato_elasticsearch_host

    类型: 字符串

    ElasticSearch 主机名。默认为 localhost

  • librato_elasticsearch_port

    类型: 字符串

    ElasticSearch 端口。默认为 9200

  • librato_elasticsearch_cluster_name

    类型: 字符串

    ElasticSearch 集群名称(如果设置)。默认为 nil

  • librato_elasticsearch_verbose

    类型: true/false

    插件的详细触发器。默认为 true

插件: haproxy

  • librato_haproxy_socket_file

    类型: 字符串

    HAProxy 套接字文件。默认为 /run/haproxy/admin.sock

  • librato_haproxy_proxies

    类型: 数组

    收集的默认代理。默认为 serverfrontendbackend

插件: jvm

  • librato_jvm_host

    类型: 字符串

    JVM 主机。默认为 localhost

  • librato_jvm_service_url

    类型: 字符串

    要查询的 JVM 服务 URL。默认为 service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi

  • librato_jvm_mbeans

    类型: 映射

    要收集的其他 mbeans。默认为空。

    映射格式为:

    librato_jvm_mbeans: [
      {
        name: 'mbean 名称'
        object_name: '对象名称'
        instance_prefix: '实例前缀(可选)',
        instance_from: '实例来源(可选)',
        values: [
          {
            type: '值类型',
            table: true|false,
            attribute: '属性'
            instance_prefix: '实例前缀(可选)',
            instance_from: '实例来源(可选)'
          }
        ]
      }
    ]
    

插件: memcached

  • librato_memcached_host

    类型: 字符串

    memcached 主机名。默认为 localhost

  • librato_memcached_port

    类型: 字符串

    memcached 端口。默认为 11211

插件: mongodb

  • librato_mongodb_host

    类型: 字符串

    MongoDB 主机名。默认为 localhost

  • librato_mongodb_port

    类型: 字符串

    MongoDB 端口。默认为 27017

  • librato_mongodb_user

    类型: 字符串

    用于连接的 MongoDB 用户名。默认为 nil

  • librato_mongodb_password

    类型: 字符串

    用于连接的 MongoDB 密码。默认为 nil

  • librato_mongodb_databases

    类型: 数组

    收集指标的数据库。默认为空。admin 数据库会自动包含在数组中。

  • librato_mongodb_name

    类型: 字符串

    设置插件实例的名称。默认为 mongodb

插件: mysql

  • librato_mysql_databases

    类型: 映射

    收集指标的数据库。默认为空。

    哈希格式为:

    databases: [
      {
        name: 'mydb'
        host: 'localhost'
        port: 3306
        user: ''
        password: ''
        innodb_stats: true
        slave_stats: false
      }
    ]
    

插件: nginx

  • librato_nginx_protocol

    类型: 字符串

    要使用的协议。默认为 http。如果需要 SSL,请将其更改为 https

  • librato_nginx_host

    类型: 字符串

    使用的主机名。默认为 localhost

  • librato_nginx_path

    类型: 字符串

    状态页面的路径。默认为 /basic_status

插件: nginx_plus

  • librato_nginx_plus_protocol

    类型: 字符串

    要使用的协议。默认为 http。如果需要 SSL,请将其更改为 https

  • librato_nginx_plus_host

    类型: 字符串

    使用的主机名。默认为 localhost

  • librato_nginx_plus_path

    类型: 字符串

    状态页面的路径。默认为 /status

  • librato_nginx_plus_verbose

    类型: 字符串

    插件的详细模式开/关。默认为 false

插件: postgresql

  • librato_postgresql_socket_file

    类型: 字符串

    PostgreSQL 套接字文件。默认为 /var/run/postgresql

  • librato_postgresql_user

    类型: 字符串

    作为连接的 PostgreSQL 用户。默认为 postgresql

  • librato_postgresql_databases

    类型: 映射

    收集指标的数据库。默认为空。

    哈希格式为:

    databases = [
      {
        name: 'mydb'
        instance: 'baz'
        host: 'localhost'
        port: 5432
        user: ''
        password: ''
        ssl_mode: 'prefer'
      }
    ]
    

插件: redis

  • librato_redis_host

    类型: 字符串

    Redis 主机名。默认为 localhost

  • librato_redis_port

    类型: 字符串

    Redis 端口。默认为 6379

  • librato_redis_timeout

    类型: 字符串

    连接到 Redis 的超时时间(毫秒)。默认为 2000

插件: varnish

Varnish 没有可配置的属性。

插件: zookeeper

  • librato_zookeeper_host

    类型: 字符串

    ZooKeeper 主机名。默认为 localhost

  • librato_zookeeper_port

    类型: 字符串

    ZooKeeper 端口。默认为 2181

全局变量

  • librato_email

    类型: 字符串

    用于发送指标的电子邮件。与 token 一起使用。此属性为必填,默认为空。

  • librato_token

    类型: 字符串

    用于发送指标的 API 令牌。与 email 一起使用。此属性为必填,默认为空。

  • librato_version

    类型: 字符串

    要安装的 Librato Agent 的版本。

  • librato_repo_url

    类型: 字符串

    软件包的基本 URL。默认为 Librato 的仓库 URL https://packagecloud.io/librato/

  • librato_repo_base

    类型: 字符串

    要使用的仓库基础。默认为 Librato 的仓库集合 librato-collectd

  • librato_config_base

    类型: 字符串

    collectd 配置文件的基本路径。默认为 /opt/collectd/etc

  • librato_plugin_config_path

    类型: 字符串

    collectd 插件配置的路径。默认为 /opt/collectd/etc/collectd.conf.d

  • librato_hostname

    类型: 字符串

    用于节点的主机名。默认为 nil,优先使用 FQDNLookup

  • librato_fqdn_lookup

    类型: true/false

    是否对主机名进行 FQDN 查找。默认为 true

  • librato_interval

    类型: 整数

    插件的全局轮询间隔(秒)。默认为 60

  • librato_use_log_file

    类型: true/false

    将 collectd 日志写入文件。默认为 true

  • librato_use_syslog

    类型: true/false

    将 collectd 日志写入 syslog。默认为 false

  • librato_use_logstash

    类型: true/false

    将 collectd 日志写入 logstash 格式的文件。默认为 false

  • librato_log_file_log_level

    类型: 字符串

    用于 log_file 的日志级别。默认为 info

  • librato_log_file_filename

    类型: 字符串

    用于 log_file 的文件名。默认为 /opt/collectd/var/log/collectd.log

  • librato_log_file_timestamp

    类型: true/false

    在日志文件中使用时间戳。默认为 true

  • librato_log_file_print_severity

    类型: true/false

    在日志文件中包含严重性级别。默认为 true

  • librato_syslog_log_level

    类型: 字符串

    用于 syslog 的日志级别。默认为 info

  • librato_logstash_log_level

    类型: 字符串

    用于 logstash 的日志级别。默认为 info

  • librato_logstash_filename

    类型: 字符串

    用于 logstash 的文件名。默认为 /opt/collectd/var/log/collectd.json.log

  • librato_default_plugins

    类型: 数组

    要包含的默认插件列表。默认为:cpudfdiskswapmemoryload

  • librato_enabled_plugins

    类型: 数组

    要启用的插件列表。这与默认插件分开,主要用于包含其他插件。默认为空。

支持的平台

  • RHEL 6 / CentOS 6
  • RHEL 7 / CentOS 7
  • Fedora 23
  • 亚马逊Linux 2016.03
  • Ubuntu 12.04
  • Ubuntu 14.04
  • Ubuntu 15.04
  • Ubuntu 15.10
  • Ubuntu 16.04
  • Debian 7
  • Debian 8

支持的 Ansible 版本

此角色需要 Ansible 2.2 或更高版本。

开发

测试

集成测试使用 kitchen-ansibleserverspec。要运行测试套件:

  1. 运行 bundle install
  2. 运行 kitchen test

测试亚马逊Linux

通过 test-kitchen 测试亚马逊 Linux 需要更多设置:

  1. 确保已安装 kitchen-ec2gem install kitchen-ec2
  2. 更新 .kitchen.yml 以具有您要使用的正确 AWS 密钥 ID
  3. 在驱动程序部分设置 security_group_ids,以包括可从您的笔记本电脑访问的安全组。如果不设置,将使用 default 安全组。
  4. 设置 transport.ssh_key 为您的 SSH 密钥的路径。默认情况下它查找 id_rsa

许可

MIT

作者和贡献者

Mike Julian (@mjulian)

关于项目

Install and configure the Librato Agent

安装
ansible-galaxy install librato.librato
许可证
Unknown
下载
651
拥有者
https://librato.com