automatron (Ah-Tom-a-tron) 是一个自治的IT系统监控和修复框架

网友投稿 753 2022-11-03

automatron (Ah-Tom-a-tron) 是一个自治的IT系统监控和修复框架

automatron (Ah-Tom-a-tron) 是一个自治的IT系统监控和修复框架

Automatron (Ah-Tom-a-tron) is an open source framework designed to detect and remediate IT systems issues. Meaning, it can be used to monitor systems and when it detects issues; correct them.

Features

Automatically detect and add new systems to monitorMonitoring is executed over SSH and completely agent-lessPolicy based Runbooks allow for monitoring policies rather than server specific configurationsSupports Nagios compliant health check scriptsAllows arbitrary shell commands for both checks and actionsRunbook flexibility with Jinja2 templating supportPluggable Architecture that simplifies customization

Runbooks

Automatron's actions are driven by policies called Runbooks. These runbooks are used to define what health checks should be executed on a target host and what to do about those health checks when they fail.

A simple Runbook

The below example is a Runbook that will execute a monitoring plugin to determine the amount of free space on /var/log and based on the results execute a corrective action.

name: Verify /var/logschedule: "*/2 * * * *"nodes: - "*"checks: mem_free: # Check for the % of disk free create warning with 20% free and critical for 10% free execute_from: ontarget type: plugin plugin: systems/disk_free.py args: --warn=20 --critical=10 --filesystem=/var/logactions: logrotate_nicely: execute_from: ontarget trigger: 0 frequency: 300 call_on: - WARNING type: cmd cmd: bash /etc/cron.daily/logrotate logrotate_forced: execute_from: ontarget trigger: 5 frequency: 300 call_on: - CRITICAL type: cmd cmd: bash /etc/cron.daily/logrotate --force

A Runbook with Jinja2

Jinja2 support was added to Runbooks to allow for extensive customization. The below example shows using Jinja2 to determine which cmd to execute based on Automatron's facts system.

This example will detect if nginx is running and if not, restart it.

name: Verify nginx is runningschedule: "*/5 * * * *"nodes: - "*web*"checks: nginx_is_running: # Check if nginx is running execute_from: ontarget type: cmd {% if "Linux" in facts['os'] %} cmd: service nginx status {% else %} cmd: /usr/local/etc/rc.d/nginx status {% endif %}actions: restart_nginx: execute_from: ontarget trigger: 2 frequency: 300 call_on: - WARNING - CRITICAL type: cmd {% if "Linux" in facts['os'] %} cmd: service nginx restart {% else %} cmd: /usr/local/etc/rc.d/nginx restart {% endif %}

For more examples and information on getting started checkout the Automatron wiki.

Deploying with docker

Deploying Automatron within Docker is quick and easy. Since Automatron by default uses redis as a datastore we must first start a redis instance.

$ sudo docker run -d --restart=always --name redis redis

Once redis is up and running you can start an Automatron instance.

$ sudo docker run -d --link redis:redis -v /path/to/config:/config --restart=always --name automatron madflojo/automatron

Stay in the loop

Follow @Automatronio on Twitter for the latest Automatron news and join the community in #Automatron on Gitter.

License

Copyright 2016 Benjamin Cane

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://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.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:#yyds干货盘点# 解决名企真题:最大差值
下一篇:SpringBoot实现启动类的存放位置
相关文章

 发表评论

暂时没有评论,来抢沙发吧~