Change-Id: I59297736406469e5314236cb40851d9a6f94386epull/122/head
@@ -687,6 +687,18 @@ Stop and disable linux service: | |||
Possible status is dead (disable service by default), running (enable service by default), enabled, disabled. | |||
Linux with atop service: | |||
.. code-block:: yaml | |||
linux: | |||
system: | |||
atop: | |||
enabled: true | |||
interval: 20 | |||
logpath: "/var/log/atop" | |||
outfile: "/var/log/atop/daily.log" | |||
RHEL / CentOS | |||
^^^^^^^^^^^^^ | |||
@@ -0,0 +1,5 @@ | |||
{%- from "linux/map.jinja" import system with context -%} | |||
# This file /etc/default/atop is managed by Salt linux formula | |||
INTERVAL={{ system.atop.interval }} | |||
LOGPATH={{ system.atop.logpath }} | |||
OUTFILE={{ system.atop.outfile }} |
@@ -0,0 +1,16 @@ | |||
{%- from "linux/map.jinja" import system with context -%} | |||
[Unit] | |||
Description=atop - advanced interactive monitor | |||
After=syslog.target | |||
ConditionPathExists={{ config_file }} | |||
Documentation=man:atop(1) | |||
Documentation=https://atoptool.nl | |||
[Service] | |||
EnvironmentFile=-{{ config_file }} | |||
ExecStart=/usr/bin/atop -a -w ${LOGPATH}/daily.log ${INTERVAL} | |||
Restart=always | |||
RestartSec=10 | |||
[Install] | |||
WantedBy=multi-user.target |
@@ -18,6 +18,13 @@ | |||
}, | |||
'selinux': 'permissive', | |||
'ca_certs_dir': '/usr/local/share/ca-certificates', | |||
'atop': { | |||
'enabled': false, | |||
'interval': '20', | |||
'autostart': true, | |||
'logpath': '/var/log/atop', | |||
'outfile': '/var/log/atop/daily.log' | |||
}, | |||
}, | |||
'Debian': { | |||
'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'], | |||
@@ -38,6 +45,13 @@ | |||
}, | |||
'selinux': 'permissive', | |||
'ca_certs_dir': '/usr/local/share/ca-certificates', | |||
'atop': { | |||
'enabled': false, | |||
'interval': '20', | |||
'autostart': true, | |||
'logpath': '/var/log/atop', | |||
'outfile': '/var/log/atop/daily.log' | |||
}, | |||
}, | |||
'RedHat': { | |||
'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'], | |||
@@ -58,6 +72,13 @@ | |||
}, | |||
'selinux': 'permissive', | |||
'ca_certs_dir': '/usr/local/share/ca-certificates', | |||
'atop': { | |||
'enabled': false, | |||
'interval': '20', | |||
'autostart': true, | |||
'logpath': '/var/log/atop', | |||
'outfile': '/var/log/atop/daily.log' | |||
}, | |||
}, | |||
}, grain='os_family', merge=salt['pillar.get']('linux:system')) %} | |||
@@ -0,0 +1,20 @@ | |||
{%- from "linux/map.jinja" import system with context -%} | |||
{%- if system.atop.enabled %} | |||
job: | |||
atop: | |||
- files: | |||
- {{ system.atop.logpath }}/atop* | |||
- {{ system.atop.logpath }}/{{ system.atop.outfile }} | |||
options: | |||
- olddir {{ system.atop.logpath }}/old | |||
- compress | |||
- delaycompress | |||
- missingok | |||
- notifempty | |||
- rotate: 10 | |||
- daily | |||
- minsize: 20M | |||
- maxsize: 500M | |||
- postrotate: "if ! service atop status > /dev/null; then service atop restart > /dev/null; fi" | |||
{%- endif %} |
@@ -0,0 +1,76 @@ | |||
{%- from "linux/map.jinja" import system with context %} | |||
{%- if system.atop.enabled %} | |||
atop_packages: | |||
pkg.installed: | |||
- name: atop | |||
atop_defaults: | |||
file.managed: | |||
- name: /etc/default/atop | |||
- source: salt://linux/files/atop.conf | |||
- template: jinja | |||
- user: root | |||
- group: root | |||
- mode: 644 | |||
atop_logpath: | |||
file.directory: | |||
- name: {{ system.atop.logpath }} | |||
- user: root | |||
- group: root | |||
- mode: 750 | |||
- makedirs: true | |||
{%- if grains.get('init', None) == 'systemd' %} | |||
atop_systemd_file: | |||
file.managed: | |||
- name: /etc/systemd/system/atop.service | |||
- source: salt://linux/files/atop.service | |||
- user: root | |||
- mode: 644 | |||
- defaults: | |||
service_name: atop | |||
config_file: /etc/default/atop | |||
autostart: {{ system.atop.autostart }} | |||
- template: jinja | |||
- require_in: | |||
- service: atop_service | |||
{%- endif %} | |||
atop_service: | |||
service.running: | |||
- name: atop | |||
- enable: {{ system.atop.autostart }} | |||
- watch: | |||
- file: atop_defaults | |||
{%- if grains.get('noservices') %} | |||
- onlyif: /bin/false | |||
{%- endif %} | |||
{%- else %} | |||
atop_service_stop: | |||
service.dead: | |||
- name: atop | |||
- enable: false | |||
- require_in: | |||
- pkg: atop_pkg_purge | |||
{%- if grains.get('noservices') %} | |||
- onlyif: /bin/false | |||
{%- endif %} | |||
atop_defaults_purge: | |||
file.absent: | |||
- names: | |||
- /etc/default/atop | |||
- /etc/systemd/system/atop.service | |||
- require: | |||
- pkg: atop_pkg_purge | |||
atop_pkg_purge: | |||
pkg.purged: | |||
- name: atop | |||
{%- endif %} |
@@ -63,6 +63,9 @@ include: | |||
{%- if system.apparmor is defined %} | |||
- linux.system.apparmor | |||
{%- endif %} | |||
{%- if pillar.linux.system.atop is defined %} | |||
- linux.system.atop | |||
{%- endif %} | |||
{%- if system.console is defined %} | |||
- linux.system.console | |||
{%- endif %} |
@@ -346,3 +346,8 @@ linux: | |||
192.168.0.1: | |||
mac: "ff:ff:ff:ff:ff:ff" | |||
interface: bond0 | |||
atop: | |||
enabled: true | |||
interval: 20 | |||
logpath: "/var/mylog/atop" | |||
outfile: "/var/mylog/atop/daily.log" |