How to define beacon in pillar?

347 views
Skip to first unread message

Fredrik Averpil

unread,
May 24, 2016, 9:49:19 AM5/24/16
to Salt-users

Hi,

I’d like to get a disk space warning in my event bus from my minions and I’d like to define this centrally, in once place. So I’ve opted for defining this in the pillar:

# /srv/pillar/top.sls

base:
  '*':
    - schedule.sls
    - beacons.sls
# /srv/pillar/beacons.sls

beacons:
  diskusage:
    /: 5%

I’m using 5% so that I can see this event get triggered in the event bus to verify that it works (all my minions should be above 5% in disk usage), which I’m viewing with salt-run state.event pretty=True. And I know that the docs says you should use a different syntax for the diskusage, although this issue says that generates an error and so you should use the syntax I’m now using.

…but I can’t see anything in my event bus. Nothing. When I check for the beacons I get this:

# salt 'bs02*' beacons.list
bs02gen04:
    ----------
    beacons:
        ----------

What am doing wrong?

I haven’t created/enabled beacons using any commands or anything. I’ve just defined the beacons like above. The schedule.sls is executed perfectly, so I know my pillar top.sls is working.

I’ve also changed the beacon into the load beacon, using both suggested syntaxes outlined in the same issue as mentioned above. But to me it seems beacons doesn’t work at all here.

Any ideas?

Versions report:

Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: Not Installed
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.2
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: 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-gnupg: Not Installed
          smmap: 0.9.0
        timelib: Not Installed

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-123.el7.x86_64
         system: CentOS Linux 7.2.1511 Core

Regards,
Fredrik

Fredrik Averpil

unread,
May 24, 2016, 10:15:24 AM5/24/16
to Salt-users

Here’s also the two errors I get depending on which syntax I use for diskusage.beacon: https://github.com/saltstack/salt/issues/29451#issuecomment-221282710

To me it seems that diskusage is broken.

Regards,
Fredrik

Mike Place

unread,
May 24, 2016, 10:34:02 AM5/24/16
to salt-...@googlegroups.com
Yup, it was broken all right. Now fixed: https://github.com/saltstack/salt/pull/33474

Apologies for that.

-mp

--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fredrik Averpil

unread,
May 24, 2016, 11:00:53 AM5/24/16
to salt-...@googlegroups.com

Hi Mike,

Ah, that’s awesome.

I downloaded the new file into /etc/srv/_beacons/diskusage.py and ran a salt '*' saltutil.sync_all. I saw that this file was being synced. I then also restarted the salt-minion service everywhere.

Using the config from the example in that file, I still get an error:

beacons:
  diskusage:
    - /: 5%
2016-05-24 16:55:01,775 [salt.minion      ][CRITICAL][14648] The beacon errored:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/minion.py", line 1750, in handle_beacons
    beacons = self.process_beacons(self.functions)
  File "/usr/lib/python2.7/site-packages/salt/minion.py", line 364, in process_beacons
    return self.beacons.process(b_conf)
  File "/usr/lib/python2.7/site-packages/salt/beacons/__init__.py", line 55, in process
    interval = self._determine_beacon_config(mod, 'interval', b_config)
  File "/usr/lib/python2.7/site-packages/salt/beacons/__init__.py", line 105, in _determine_beacon_config
    config = config_mod[mod].get(val, False)
AttributeError: 'list' object has no attribute 'get'

Is there anything else I need to do to get this to work?
Do I also need the beacons/__init__.py?

Regards,
Fredrik

Mike Place

unread,
May 24, 2016, 11:03:50 AM5/24/16
to salt-...@googlegroups.com
Hrm, well that's odd. That's the only beacon entry you have in your minion config file, right?

-mp

--

Fredrik Averpil

unread,
May 24, 2016, 11:07:07 AM5/24/16
to salt-...@googlegroups.com
I define the beacon in the pillar on the master, and that's all, yes.

Mike Place

unread,
May 24, 2016, 11:09:36 AM5/24/16
to salt-...@googlegroups.com
Ahhh. So, while the diskusage beacon itself is now fixed you're still hitting the bug in https://github.com/saltstack/salt/issues/29451

I will try to get some time to look at this today.

-mp

Fredrik Averpil

unread,
May 24, 2016, 11:13:20 AM5/24/16
to salt-...@googlegroups.com
Ahhh... I see now. Yes, that must be it.

It would be wonderful if you were able to look at it. I've been wanting to implement diskusage since January :)

I'll add my traceback to that issue.

Best Regards,
Fredrik

Reply all
Reply to author
Forward
0 new messages