Skip to content

Presence change events constantly reporting all minions as new in 2015.5 #23776

Closed

Description

@enblde

ISSUE: the salt/presence/change event in 2015.5 is always reporting the full list of connected minions as "newly connected", despite the fact that their connection wasn't disrupted.

As I can see in the master.py source file, the presence handling code has been moved into a separate function and now the old_present list is referenced and assigned in local scope, what makes it remain empty in every run of the main master maintenance loop.

Relevant code lines:
https://github.com/saltstack/salt/blob/v2015.5.0/salt/master.py#L260-275
and
https://github.com/saltstack/salt/blob/v2015.5.0/salt/master.py#L183

My master config:

presence_events: True

Event example:

# salt-run state.event pretty=True
salt/presence/change    {
    "_stamp": "2015-05-15T16:33:56.944705", 
    "lost": [], 
    "new": [
        <here goes every time the list of all currently connected minions>
    ]
}

Salt version:

# salt --versions-report
           Salt: 2015.5.0
         Python: 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
 msgpack-python: 0.4.6
   msgpack-pure: Not Installed
       pycrypto: 2.0.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.3.1
           RAET: Not Installed
            ZMQ: 3.2.5
           Mako: Not Installed

Activity

  1. rallytime commented on May 18, 2015

    @rallytime
    Contributor

    Thanks for the report @enblde.

  2. added
    bug
    severity-medium
    Core
    P1
    on May 18, 2015
  3. added this to the Approved milestone on May 18, 2015
  4. self-assigned this
    on May 20, 2015
  5. added
    Confirmed
    on May 20, 2015
  6. added a commit that references this issue on May 20, 2015
  7. msteed commented on May 21, 2015

    @msteed
    Contributor

    @enblde - thanks for the detective work!

  8. added a commit that references this issue on May 21, 2015
  9. added
    fixed-pls-verify
    on May 22, 2015
  10. msteed commented on Jun 2, 2015

    @msteed
    Contributor

    @enblde - We believe this is fixed by the above PR. If you still see the repeated presence events with that change in place, feel free to reopen & provide details here. Thanks!

  11. akimyonoglu commented on Jun 7, 2015

    @akimyonoglu

    applied 0b35f17 and works fine

  12. jfindlay commented on Jun 9, 2015

    @jfindlay
    Contributor
  13. sebw commented on Jun 23, 2016

    @sebw
    Contributor

    I'm facing the issue, it randomly reports all the minions as new (8 minutes, 3 minutes, every 1 minute sometimes, but never more than 10 minutes).

    Master:

    salt --versions-report
    Salt Version:
    Salt: 2016.3.0

    Dependency Versions:
    cffi: Not Installed
    cherrypy: Not Installed
    dateutil: 1.5
    gitdb: Not Installed
    gitpython: Not Installed
    ioflo: Not Installed
    Jinja2: 2.7.2
    libgit2: Not Installed
    libnacl: Not Installed
    M2Crypto: 0.21.1
    Mako: Not Installed
    msgpack-pure: Not Installed
    msgpack-python: 0.4.7
    mysql-python: Not Installed
    pycparser: Not Installed
    pycrypto: 2.6.1
    pygit2: Not Installed
    Python: 2.7.5 (default, Oct 11 2015, 17:47:16)
    python-gnupg: Not Installed
    PyYAML: 3.10
    PyZMQ: 14.7.0
    RAET: Not Installed
    smmap: Not Installed
    timelib: Not Installed
    Tornado: 4.2.1
    ZMQ: 4.0.5

    System Versions:
    dist: redhat 7.2 Maipo
    machine: x86_64
    release: 3.10.0-327.el7.x86_64
    system: Linux
    version: Red Hat Enterprise Linux Server 7.2 Maipo

    Most of the minions:

    salt-minion --versions-report

    Salt Version:
    Salt: 2016.3.0

    Dependency Versions:
    cffi: Not Installed
    cherrypy: Not Installed
    dateutil: 1.4.1
    gitdb: Not Installed
    gitpython: Not Installed
    ioflo: Not Installed
    Jinja2: unknown
    libgit2: Not Installed
    libnacl: Not Installed
    M2Crypto: 0.20.2
    Mako: Not Installed
    msgpack-pure: Not Installed
    msgpack-python: 0.4.6
    mysql-python: Not Installed
    pycparser: Not Installed
    pycrypto: 2.6.1
    pygit2: Not Installed
    Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)
    python-gnupg: Not Installed
    PyYAML: 3.10
    PyZMQ: 14.5.0
    RAET: Not Installed
    smmap: Not Installed
    timelib: Not Installed
    Tornado: 4.2.1
    ZMQ: 4.0.5

    System Versions:
    dist: redhat 6.4 Santiago
    machine: x86_64
    release: 2.6.32-358.23.2.el6.x86_64
    system: Linux
    version: Red Hat Enterprise Linux Server 6.4 Santiago

  14. stephanwiechert commented on Mar 12, 2024

    @stephanwiechert

    Hi there,

    it seems that this issue reoccurred, about every hour the event "presence new" is triggered for all minions, although there was no absent event before.

    Master:

    Salt Version:
    Salt: 3006.7

    Python Version:
    Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]

    Dependency Versions:
    cffi: 1.14.6
    cherrypy: unknown
    dateutil: 2.8.1
    docker-py: Not Installed
    gitdb: Not Installed
    gitpython: Not Installed
    Jinja2: 3.1.3
    libgit2: Not Installed
    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.19.1
    pygit2: Not Installed
    python-gnupg: 0.4.8
    PyYAML: 6.0.1
    PyZMQ: 23.2.0
    relenv: 0.15.1
    smmap: Not Installed
    timelib: 0.2.4
    Tornado: 4.5.3
    ZMQ: 4.3.4

    System Versions:
    dist: ubuntu 22.04.4 jammy
    locale: utf-8
    machine: x86_64
    release: 5.15.0-97-generic
    system: Linux
    version: Ubuntu 22.04.4 jammy

    Salt Minion:

    Salt Version:
    Salt: 3006.3

    Python Version:
    Python: 3.10.13 (main, Sep 6 2023, 02:11:27) [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: Not Installed
    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: Not Installed
    python-gnupg: 0.4.8
    PyYAML: 6.0.1
    PyZMQ: 23.2.0
    relenv: 0.13.10
    smmap: Not Installed
    timelib: 0.2.4
    Tornado: 4.5.3
    ZMQ: 4.3.4

    System Versions:
    dist: ubuntu 22.04.4 jammy
    locale: utf-8
    machine: x86_64
    release: 5.15.0-97-generic
    system: Linux
    version: Ubuntu 22.04.4 jammy

    We are using a script to alert if minions change there state, here it is:

    import salt.config
    import salt.utils.event
    from create_opsgenie_alert import create_opsgenie_alerts

    opts = salt.config.client_config("/etc/salt/master/")

    event = salt.utils.event.get_event("master", sock_dir=opts["sock_dir"], opts=opts)

    for data in event.iter_events(tag="salt/presence/change"):
    alertmsg = "Salt Minion Presence State changed..."
    message = "Minion presence changed:\n new: {},\n lost: {}".format(data.get('new'), data.get('lost'))
    print(message)
    # fire opsgenie alert
    create_opsgenie_alerts(alertmsg,'Message:\n {}'.format(message), "Salt Minion State Change Alert","P3")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ConfirmedCoreP1bugfixed-pls-verifyseverity-medium

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions