GithubHelp home page GithubHelp logo

mackerelio / ansible-mackerel-agent Goto Github PK

View Code? Open in Web Editor NEW
33.0 14.0 21.0 91 KB

An Ansible role for mackerel-agent. (development version)

Home Page: https://galaxy.ansible.com/mackerelio/mackerel-agent/

License: Apache License 2.0

Makefile 23.91% Shell 22.94% Jinja 53.15%
mackerel

ansible-mackerel-agent's Introduction

ansible-mackerel-agent

An Ansible role for installing mackerel-agent and official plugins.

Official Plugins

Requirements & Dependencies

  • Tested on Ansible 2.4 or higher

Role Variables

mackerel_agent_apikey: "yourapikey"

# optional
mackerel_agent_pidfile: "/var/run/mackerel-agent.pid"
mackerel_agent_root: "/var/lib/mackerel-agent"
mackerel_agent_roles:
  - "My-Service:app"
  - "Another-Service:db"
mackerel_agent_display_name: "My host"
mackerel_use_plugins: yes # default: no
mackerel_install_mkr: yes # default: no
mackerel_agent_plugins:
  jvm: "/usr/bin/mackerel-plugin-jvm -javaname=NettyServer"
mackerel_agent_include: "/etc/mackerel-agent/conf.d/*.conf"

mackerel_check_plugins:
  check_cron: "/usr/bin/check-procs -p crond"
  uptime:
    command: "check-uptime --warning-under=600 --critical-under=120"
    notification_interval: 10
    max_check_attempts: 3
    check_interval: 5
    timeout_seconds: 45
    prevent_alert_auto_close: true
    action:
      command: "ruby /path/to/notify_something.rb"
    memo: "This check monitor is ..."

Example Playbook

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

-
  hosts: Hatena-Antenna2_backend
  vars:
    - mackerel_agent_apikey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    - mackerel_agent_roles:
      - "My-Service:app"
      - "Another-Service:db"
  roles:
    - mackerelio.mackerel-agent

How to test

Test cases are defined in test.yml. To add a new test:

  • Add a test case in tests/test.yml. The case name is defined in tags.
  • Run ./tests/run -w test_case_name. This command will generate tests/cases/test_case_name directory.
  • Check ./tests/run command to exit with 0.
  • Run git add tests/ and commit.

License

Copyright:: 2015 Hatena Co., Ltd.

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.

ansible-mackerel-agent's People

Contributors

astj avatar attakei avatar buzztaiki avatar hayajo avatar ikuwow avatar itchyny avatar kamicup avatar kuchitama avatar lufia avatar ne-sachirou avatar rmatsuoka avatar ryosms avatar shibayu36 avatar songmu avatar subaru365 avatar syou6162 avatar takeshinoda avatar tanakahisateru avatar xorphitus avatar yseto avatar yuichisatake avatar yukirii avatar yuuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-mackerel-agent's Issues

"check amazon linux 2" step don't work on Amazon Linux2 Japanese environment

I failed to install mackerel agent on Amazon Linux2 that is Japanese environment(LANG=ja_JP.UTF-8).

In Japanese environment, yum info returns Japanese message.
And the response has no Release, So it's judged Amazon Linux1.
at: https://github.com/mackerelio/ansible-mackerel-agent/blob/master/tasks/amazonlinux.yml#L3

$ yum info installed system-release
読み込んだプラグイン:extras_suggestions, langpacks, priorities, update-motd
インストール済みパッケージ
名前                : system-release
アーキテクチャー    : x86_64
エポック            : 1
バージョン          : 2
リリース            : 7.amzn2
容量                : 26 k
リポジトリー        : installed
要約                : Amazon Linux release files
URL                 : https://amazonlinux.com/
ライセンス          : GPLv2
説明                : Amazon Linux release file

thanks.

Check fails the first time when no repository is registered

Problems

  • If you run --check without registering the initial repository on each OS, Task will fail because it cannot find the package.
  • In case of the Amazon Linux, check_al2 will not return the result when you run --check, and subsequent tasks will fail.

Errors

e.g. on Amazon Linux 2

TASK [mackerelio.mackerel-agent : import mackerel GPG key] *********************
fatal: [localhost]: FAILED! => 
{ "msg": "The conditional check 'check_al2.rc != 0' failed. The error was: error while evaluating conditional (check_al2.rc != 0): 'dict object' has no attribute 'rc'\n\nThe error appears to be in '/workspace/roles/mackerelio.mackerel-agent/tasks/amazonlinux.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: import mackerel GPG key\n ^ here\n" }
TASK [mackerelio.mackerel-agent : install mackerel-agent] **********************
fatal: [localhost]: FAILED! => 
{ "changed": false, "msg": "No package matching 'mackerel-agent' found available, installed or updated", "rc": 126, "results": [ "No package matching 'mackerel-agent' found available, installed or updated" ] }

failed to download

I failed to install this role with below message. I'm using ansible version 1.9.2.

$ ansible-galaxy install mackerel.mackerel-agent 
- downloading role 'mackerel-agent', owned by mackerel
- downloading role from https://github.com/mackerelio/ansible-mackerel-agent/archive/v0.1.0.tar.gz
- error: failed to download the file.
- mackerel.mackerel-agent was NOT installed successfully.
- you can use --ignore-errors to skip failed roles.

Maybe you should add a tag v0.1.0 or other.
ansible-galaxy will download from github repository's archive.

see below.
https://github.com/ansible/ansible/blob/stable-1.9/bin/ansible-galaxy#L483

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.