简体   繁体   English

SaltStack - 信标不监控文件

[英]SaltStack - Beacons not monitoring the files

For some reason I can't get the beacons working.. I can send the event manually using this command from minion salt-call event.send salt/beacon/*/inotify//etc/hosts and I see the event in the master.出于某种原因,我无法让信标正常工作。我可以使用来自salt-call event.send salt/beacon/*/inotify//etc/hosts命令手动发送事件,我在 master 中看到了事件.

But if I modify the /etc/hosts or delete it the event doesn't fire automatically.但是,如果我修改/etc/hosts或删除它,事件不会自动触发。

I've installed python3-pyinotify on the minion.我已经在python3-pyinotify Any idea why beacons aren't monitoring the /etc/hosts file?知道为什么信标不监视/etc/hosts文件吗?

In the minion logs I see this:在 minion 日志中,我看到了这个:

2022-11-17 12:39:14,299 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:14,300 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify
2022-11-17 12:39:15,300 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:15,300 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify
2022-11-17 12:39:16,300 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:16,301 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify
2022-11-17 12:39:17,300 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:17,301 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify
2022-11-17 12:39:18,300 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:18,301 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify
2022-11-17 12:39:19,300 [salt.beacons     :89  ][WARNING ][14639] No validate function found for inotify, running basic beacon validation.
2022-11-17 12:39:19,301 [salt.beacons     :167 ][WARNING ][14639] Unable to process beacon inotify

/etc/salt/minion.d/beacons.conf:

beacons:
  inotify:
    - files:
        /etc/hosts:
          mask:
            - modify
    - disable_during_state_run: True

master reactor.conf:

reactor:
  - salt/beacon/*/inotify//etc/hosts:
      - /srv/salt/reactor/etc_hosts.sls

/srv/salt/reactor/etc_hosts.sls:

revert_etc_hosts:
  local.state.sls:
    - tgt: {{ data['id'] }}
    - arg:
      - formula.etc_hosts

Here is the minion conf:这是奴才会议:

grains:
  salt-cloud:
    driver: ec2
    profile: base_ec2_micro_ubuntu
    provider: ec2-ap-south-1-public:ec2
hash_type: sha256
id: dev-web
log_level: info
master: 10.10.10.10
default_include: minion.d/*.conf

The new "onedir" packages for Salt do no use the system python, so the system package python3-pyinotify will be ignored. Salt 的新“onedir”包不使用系统 python,因此系统 package python3-pyinotify将被忽略。

Either install it from the CLI:从 CLI 安装它:

salt-pip install pyinotify

or via a state:或通过 state:

pyinotify:
  pip.installed: []

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM