beacons & reactors with Windows

332 views
Skip to first unread message

Mosby Simmons

unread,
Aug 29, 2019, 5:29:38 PM8/29/19
to Salt-users
I'm semi-new to salt.  I have lots of salt states for installing applications, changing configurations, etc. but now I'm trying to learn beacons/reactors.

I can't seem to find any good documentation on beacons & reactors with a Windows environment.  My salt master is UNIX but minions are Windows.

Basic questions:
  • Where do I put beacon.conf on salt master? is it /srv/salt/master.d/beacon.conf?
  • Do I need to put beacon.conf in some type of configuration for the master so it knows it's there?
  • How do I tie reactor.conf to beacon.conf?  As in the beacon is listening and when it changes how do I have reactor know to react?
I've been playing around with a basic beacon.conf that I put directly on a windows minion but so far no luck.  I do restart the minion service after every change I try.

beacons:
  service:
    - BITS:
      - onchangeonly: True



If anyone has some examples other than what is provided by docs on saltstack webpage (which is strictly UNIX based) I would greatly appreciate it.

Phipps, Thomas

unread,
Aug 29, 2019, 7:34:23 PM8/29/19
to salt-...@googlegroups.com
Beacons and reactors are two separate concepts that work together. You don't put anything beacon related to the master. it all goes on the minion. and the beacon will send an event that the reactor on the master can respond to. 

simplest useless version.

on the windows minion named in this case Desktop

cat c:\salt\conf\minion.d\beacons.conf
beacons:
  status:
    - interval: 6

on the master
[root@salt00 salt]# cat /etc/salt/master.d/reactors.conf
reactor:
  - 'salt/beacon/*/status/*':
    - /srv/reactor/ping.sls
[root@salt00 salt]# cat /srv/reactor/ping.sls
ping beacon:
  local.test.ping:
    - tgt: {{data['id']}}


If you have info level logging on your master you should then see items like this starting to show up.
2019-08-29 14:51:44,674 [salt.master      :2345][INFO    ][11798] User root Published command test.ping with jid 20190829145144642877
2019-08-29 14:51:48,597 [salt.utils.job   :68  ][INFO    ][11818] Got return from Desktop for job 20190829145144642877


and if you look up the jid from that you will see that is was a test.ping that returned 
[root@salt00 salt]# salt-run jobs.lookup_jid 20190829145144642877
Desktop:
    True



Now, While the examples are Linux [not unix] The concept is exactly the same regardless of Os. just the beacon used in the description doesn't work on windows. 

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/e79bc4c8-d54b-43a4-8c57-fd09548ebc96%40googlegroups.com.

Phipps, Thomas

unread,
Aug 29, 2019, 7:36:58 PM8/29/19
to salt-...@googlegroups.com
you can use salt-run state.event pretty=true To watch the event bus to know what is being reacted to. Also, the service beacon with onchangeonly means the state of the service needs to change for the beacon to send an event. 

On Thu, Aug 29, 2019 at 2:29 PM Mosby Simmons <simmo...@gmail.com> wrote:
--

Mosby Simmons

unread,
Aug 30, 2019, 11:51:09 AM8/30/19
to Salt-users
Thomas,

Thanks very much for the quick response.

Yes, I'm familiar enough to know that beacons and reactors are different and independent.

So I have been running salt-run state.event pretty=true on my salt master and using the c:\salt\conf\minion.d\beacons.conf file looking at BITS and then turning on/off the BITS service but I haven't seen any additions in the log.  I have stopped/started the salt-minion service on the minion to "pick up" my changes to the beacons.conf file and the log shows that change successfully.  

I figured this would be a basic first step to test on how to use beacons but I can't even get this to work.  Next would be then to add reactor on the master once I get over this hurdle.

Any ideas?


On Thursday, August 29, 2019 at 4:36:58 PM UTC-7, Thomas Phipps wrote:
you can use salt-run state.event pretty=true To watch the event bus to know what is being reacted to. Also, the service beacon with onchangeonly means the state of the service needs to change for the beacon to send an event. 

On Thu, Aug 29, 2019 at 2:29 PM Mosby Simmons <simmo...@gmail.com> wrote:
I'm semi-new to salt.  I have lots of salt states for installing applications, changing configurations, etc. but now I'm trying to learn beacons/reactors.

I can't seem to find any good documentation on beacons & reactors with a Windows environment.  My salt master is UNIX but minions are Windows.

Basic questions:
  • Where do I put beacon.conf on salt master? is it /srv/salt/master.d/beacon.conf?
  • Do I need to put beacon.conf in some type of configuration for the master so it knows it's there?
  • How do I tie reactor.conf to beacon.conf?  As in the beacon is listening and when it changes how do I have reactor know to react?
I've been playing around with a basic beacon.conf that I put directly on a windows minion but so far no luck.  I do restart the minion service after every change I try.

beacons:
  service:
    - BITS:
      - onchangeonly: True



If anyone has some examples other than what is provided by docs on saltstack webpage (which is strictly UNIX based) I would greatly appreciate it.

--
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-...@googlegroups.com.

Phipps, Thomas

unread,
Aug 30, 2019, 12:52:42 PM8/30/19
to salt-...@googlegroups.com
Well first things first what version of salt is the minion. Beacons have changed configs so many times that knowing if the config is write is one of the first steps. 

After that would be to put the minion into trace mode. this will show you the beacon loop [happens about once a second] which will let you know how the beacon is being interpreted.


To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/0faac788-c558-4133-ad58-591f11dd1024%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 1:28:43 PM8/30/19
to Salt-users
I'm running 2018.3.4 for Windows minions.

Phipps, Thomas

unread,
Aug 30, 2019, 1:36:20 PM8/30/19
to salt-...@googlegroups.com
okay, then you want 

beacons:
  service:
    - services:
        BITS:
          onchangeonly: true


Once that change is done you can add log_level_logfile: trace to the minion config also so that you can see the beacon reaction in the logfile. to see if ti is updating. 



To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/e862a95c-e665-466f-a571-0e8435b95603%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 4:48:52 PM8/30/19
to Salt-users
Thomas,

Thanks again.  This is really helpful.

So I'm seeing these 3 lines over and over in the log:

2019-08-30 13:44:40,141 [salt.beacons     :35  ][TRACE   ][3980] Beacon processing: service
2019-08-30 13:44:40,141 [salt.beacons     :108 ][INFO    ][3980] Beacon service configuration invalid, not running.
Configuration for service beacon requires services.

I know how it's very particular about spacing so I re-typed it twice to be sure.

Phipps, Thomas

unread,
Aug 30, 2019, 5:38:15 PM8/30/19
to salt-...@googlegroups.com
Opps, just noticed that i didn't have enough spaces on the onchangeonly.

beacons:
  service:
    - services:
        BITS:
            onchangeonly: true

That should fix the error. 



The event would look like 

salt/beacon/Desktop/service/BITS        {
    "BITS": {
        "running": false
    },
    "_stamp": "2019-08-30T21:30:49.948996",
    "id": "Desktop",
    "service_name": "BITS"
}



To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/cc9f8340-2cc9-4cf7-a8d3-977fb7ce7f2a%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 6:24:03 PM8/30/19
to Salt-users
Hmmm...I'm not having much luck.  I've increased the space on that line one at a time until it's about 8 spaces more and no luck after restarting the service on the minion.

And when you show the event - this would show up in c:\salt\var\log\salt\minion correct?  Would it also show up on the master with the "sudo salt-run state.event pretty=true" command running?


Phipps, Thomas

unread,
Aug 30, 2019, 6:34:44 PM8/30/19
to salt-...@googlegroups.com
The event will show up in salt-run state.event tagmatch='salt/beacon/minionid/*' pretty=true
On the minion you would only see the loop and if there is an error in the config. It doesn't show the event info there. 

c:\salt\salt-call config.get beacons
local:
    ----------
    service:
        |_
          ----------
          services:
              ----------
              BITS:
                  ----------
                  onchangeonly:
                      True



To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/8f0ce5b8-56f9-4bc9-8f7b-4edaec9251b7%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 6:46:21 PM8/30/19
to salt-...@googlegroups.com
well the event bus is working because when I ran the salt-call it saw that.


C:\Users\Administrator>salt-call config.get beacons

local:
    ----------
    service:
        |_
          ----------
          services:
              ----------
              BITS:
                  ----------
                  onchangeonly:
                      True

C:\Users\Administrator>

Phipps, Thomas

unread,
Aug 30, 2019, 6:50:29 PM8/30/19
to salt-...@googlegroups.com
That salt-call only tells you that the config looks right. Check the eventbus with the salt-run state.event line.

Also try changing the state of the BITS service multiple times.

Mosby Simmons

unread,
Aug 30, 2019, 6:50:31 PM8/30/19
to Salt-users
hmm... my copy/paste didn't really come thru well.

the : on the BITS line has the --- directly under it and the onchangeonly: line is directly under the --- line.  if that makes sense.  It looks just like yours.

Phipps, Thomas

unread,
Aug 30, 2019, 7:01:02 PM8/30/19
to salt-...@googlegroups.com
That is good. that sounds like it should be at least configured right now. 

Also are you will getting the Beacon service configuration invalid, not running. error? And have you restarted the minion?

Once done, stop and start the BITS service has to actually stop for an iteration and start for an iteration. while watching the event bus on the master.

To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/1446b677-f503-4b53-86da-d97405e390a4%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 7:04:05 PM8/30/19
to Salt-users
The event bus is silent on the master.  The log on the minion is the same message its been getting.

I stopped/started BITS 4 or 5 times.

ugh frustrating.

--
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-...@googlegroups.com.

--
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-...@googlegroups.com.

Phipps, Thomas

unread,
Aug 30, 2019, 7:10:24 PM8/30/19
to salt-...@googlegroups.com
ok, try then, to at least see the event

beacons:
  service:
    - services:
        BITS: {}



To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/534b3b8a-fedd-40c0-b74d-409ff258b7bb%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 7:26:15 PM8/30/19
to Salt-users
I tried both 

sudo salt-run state.event pretty=true and

salt-run state.event tagmatch='salt/beacon/minionid/*' with the appropriate minionid and didn't see anything other than the restart of the salt-minion service.


In the minion log I'm still getting:


2019-08-30 16:23:31,079 [salt.beacons     :35  ][TRACE   ][4136] Beacon processing: service

2019-08-30 16:23:31,079 [salt.beacons     :108 ][INFO    ][4136] Beacon service configuration invalid, not running.

Configuration for service beacon requires services.




Phipps, Thomas

unread,
Aug 30, 2019, 7:29:45 PM8/30/19
to salt-...@googlegroups.com
ohhh, I just noticed this part  Configuration for service beacon requires services. After all these configuration changes. did you restart the minion?

That error is basically saying that the minion can't see the - services part of the config. which would indicate it still has the old config in memory.

To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/2c62268b-b559-4d71-afcc-ba8c46846632%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 7:35:27 PM8/30/19
to Salt-users
Yes, I've been restarting the minion service after each change in powershell using restart-service salt-minion.

Sorry, I thought you saw that.

Phipps, Thomas

unread,
Aug 30, 2019, 7:42:44 PM8/30/19
to salt-...@googlegroups.com
Just to be sure. Actually use salt to stop and start the process

c:\salt\salt-call service.stop salt-minion
c:\salt\salt-call service.start salt-minion

To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/2ff848ac-b90d-49ee-91c7-fa8220d15f28%40googlegroups.com.

Mosby Simmons

unread,
Aug 30, 2019, 7:48:39 PM8/30/19
to Salt-users
Yep same thing.

It's Friday before a 3-day weekend so I've got to head out.  I really appreciate your time.  I'll give it a go again on Tuesday.

It sounds like my conf file is still somehow not correct - I'll play around with that.

Have a good one!

Phipps, Thomas

unread,
Aug 30, 2019, 7:53:02 PM8/30/19
to salt-...@googlegroups.com
You as well. Have a great weekend. 

To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/b61c2a34-4c80-43ba-a6b0-e917b9703f55%40googlegroups.com.

Mosby Simmons

unread,
Sep 4, 2019, 12:44:37 PM9/4/19
to Salt-users
Well I'm back at it.  I hope you had a great weekend.

I haven't come up with anything new.  It's just very puzzling that a very basic beacon doesn't seem to work for me.

"Configuration for service beacon requires services." is not the best description.

For kicks I changed the service to WSearch (Windows Search) and restarted the salt-minion service but got same results.

Phipps, Thomas

unread,
Sep 4, 2019, 1:15:28 PM9/4/19
to salt-...@googlegroups.com
Actually that description is referring to the `- services` item that goes under the beacon name But i see that in the config.get output so I'm not sure why you are getting that error. And I'm testing on 2019.2.0 but that shouldn't make a difference because the service beacon didn't change between 2018.3.4 and 2019.2.0 here is the place in the code that refers to the error  https://github.com/saltstack/salt/blob/v2018.3.4/salt/beacons/service.py#L32






To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/salt-users/95a6868a-7c6c-4ddf-8eec-c93407c91ac4%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages