saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

[BUG] interval not being respected by diskusage beacons. #65495

Open whytewolf opened 1 year ago

whytewolf commented 1 year ago

Description diskusage beacons are firing every other interval instead of the interval count.

Setup

2023-10-31 17:56:57,276 [salt.utils.schedule:32  ][TRACE   ][218313] ==== evaluating schedule now None =====
2023-10-31 17:56:58,275 [salt.beacons     :32  ][TRACE   ][218313] Beacon processing: diskusage
2023-10-31 17:56:58,275 [salt.beacons     :32  ][TRACE   ][218313] Processing interval 120 for beacon mod diskusage
2023-10-31 17:56:58,275 [salt.beacons     :32  ][TRACE   ][218313] Processing interval in map
2023-10-31 17:56:58,276 [salt.beacons     :32  ][TRACE   ][218313] Interval counter: 2
2023-10-31 17:56:58,277 [salt.utils.event :315 ][DEBUG   ][218313] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_a54894fdec_pub.ipc
2023-10-31 17:56:58,277 [salt.utils.event :316 ][DEBUG   ][218313] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_a54894fdec_pull.ipc
2023-10-31 17:56:58,278 [salt.transport.ipc:32  ][TRACE   ][218313] IPCClient: Connecting to socket: /var/run/salt/minion/minion_event_a54894fdec_pull.ipc
2023-10-31 17:56:58,278 [salt.utils.event :823 ][DEBUG   ][218313] Sending event: tag = __beacons_return; data = {'beacons': [{'tag': 'salt/beacon/salt00/diskusage/', 'data': {'diskusage': 18.1, 'mount': '/boot', 'random_label': 'zjpqc', 'id': 'salt00'}, 'beacon_name': 'diskusage'}], '_stamp': '2023-10-31T17:56:58.278662'}
2023-10-31 17:56:58,279 [salt.transport.ipc:372 ][DEBUG   ][218313] Closing IPCMessageClient instance

as can be seen in this log the interval counter is 2 but the beacon still fired.

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior setup diskusage beacon with an interval

Expected behavior the interval is respected.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ```yaml Salt Version: Salt: 3006.4 Python Version: Python: 3.10.13 (main, Oct 4 2023, 21:54:22) [GCC 11.2.0] Dependency Versions: cffi: 1.14.6 cherrypy: 18.6.1 dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.2 libgit2: 1.7.1 looseversion: 1.0.2 M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed packaging: 22.0 pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: 1.13.1 python-gnupg: 0.4.8 PyYAML: 6.0.1 PyZMQ: 23.2.0 relenv: 0.13.12 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: ubuntu 22.04.3 jammy locale: utf-8 machine: x86_64 release: 5.15.0-87-generic system: Linux version: Ubuntu 22.04.3 jammy ```

Additional context Add any other context about the problem here.

garethgreenaway commented 1 year ago

@whytewolf Unable to reproduce. What does the beacon configuration look like? The interval isn't specific to the diskusage beacon so an issue would affect all beacons.

whytewolf commented 1 year ago

@whytewolf Unable to reproduce. What does the beacon configuration look like? The interval isn't specific to the diskusage beacon so an issue would affect all beacons.

beacons:
  diskusage:
    - /boot: 10%
    - interval: 120

the setup is pretty basic. almost copied directly from the doc.

I did edit the beacon to add a random label but the behavior was the same before doing that.

in case it helps here is the disk usage on the system

Filesystem                         Size  Used Avail Use% Mounted on
tmpfs                              1.1G  1.7M  1.1G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  884G   15G  824G   2% /
tmpfs                              5.3G   29k  5.3G   1% /dev/shm
tmpfs                              5.3M     0  5.3M   0% /run/lock
/dev/sda2                          1.6G  263M  1.2G  19% /boot
tmpfs                              1.1G  4.1k  1.1G   1% /run/user/1000

so, while changing settings i think i found the cause.

loop_interval was set to 60. however it isn't actually ticking at 60 seconds... so that setting needs to be revisited.