Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beacon: Usage in windows #49965

Open
nkrishnakishor opened this issue Oct 10, 2018 · 25 comments
Open

Beacon: Usage in windows #49965

nkrishnakishor opened this issue Oct 10, 2018 · 25 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior Question The issue is more of a question rather than a bug or a feature request severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Windows
Projects
Milestone

Comments

@nkrishnakishor
Copy link

Description of Issue/Question

Need help to setup Beacon in windows minion

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

salt --versions-report

salt --versions-report
Salt Version:
Salt: 2018.3.2

Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.28.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 2.7.5 (default, Jul 13 2018, 13:06:57)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: centos 7.5.1804 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-862.11.6.el7.x86_64
system: Linux
version: CentOS Linux 7.5.1804 Core

@Ch3LL
Copy link
Contributor

Ch3LL commented Oct 10, 2018

can you further elaborate what you need help with? Have you tried setting it up and its not working? If so can you include your conifgurations and errors

@Ch3LL Ch3LL added the info-needed waiting for more info label Oct 10, 2018
@Ch3LL Ch3LL added this to the Blocked milestone Oct 10, 2018
@nkrishnakishor
Copy link
Author

nkrishnakishor commented Oct 11, 2018

@Ch3LL Thanks for the reply.

Below are my config files.

# cat /srv/pillar/top.sls

base:
  'windows-minion':
     - disk.beacon

# cat /srv/pillar/disk/beacon.sls

beacons:
  diskusage:
    - interval: 5
    - 'c:\\': 50%
    - disable_during_state_run: True

# salt windows-minion saltutil.pillar_refresh

windows-minion:
    True

# salt windows-minion beacons.list

windows-minion:
    beacons:
      diskusage:
      - interval: 5
      - c:\\: 50%
      - disable_during_state_run: true

Due to wrong declaration in top file i had issue but rectified it.
When i run salt-run state.event i see the below event only only on my master event bus.

salt/job/20181011045055267854/ret/windows-minion  {
    "_stamp": "2018-10-11T08:50:59.266474",
    "cmd": "_return",
    "fun": "beacons.list",
    "fun_args": [],
    "id": "windows-minion",
    "jid": "20181011045055267854",
    "retcode": 0,
    "return": "beacons:\n  diskusage:\n  - interval: 5\n  - c:\\\\: 50%\n  - disable_during_state_run: true\n",
    "success": true
}

What does the interval signify in beacon module is it in seconds/minutes. If we modify beacon file do we need to restart the minion service ?

@Ch3LL
Copy link
Contributor

Ch3LL commented Oct 11, 2018

its in seconds as documented here: https://docs.saltstack.com/en/latest/topics/beacons/#beacon-monitoring-interval

If you modify the beacon file since you are using pillar you just need to refresh your pillar data.

@nkrishnakishor
Copy link
Author

@Ch3LL thanks for the reply.

I don't see any events on master event bus. Can you please let me know if there is any additional configuration to be performed on the master ?

My master config file is a below.

# cat /etc/salt/master | grep -v "#" | grep -v "^$"

file_roots:
  base:
    - /srv/salt
pillar_roots:
  base:
    - /srv/pillar
winrepo_dir_ng: '/srv/salt/win/repo-ng'

@Ch3LL
Copy link
Contributor

Ch3LL commented Oct 12, 2018

you should only see events if the diskusage has hit the limit you specified. Can you set it to a limit you know it should alert you?

i'm also wondering if the diskusage beacons is suppose to work with windows. ping @saltstack/team-windows do you know?

@morganwillcock
Copy link
Contributor

It should work, but it needs the psutils package to be installed.

@twangboy
Copy link
Contributor

psutil is part of the installation

@nkrishnakishor
Copy link
Author

you should only see events if the diskusage has hit the limit you specified. Can you set it to a limit you know it should alert you?

i'm also wondering if the diskusage beacons is suppose to work with windows. ping @saltstack/team-windows do you know?

windows minion c drive is 10GB free of 254GB. This has surpassed specified limit for beacon to hit.

@Ch3LL
Copy link
Contributor

Ch3LL commented Oct 16, 2018

is there any information in the minion log about the beacon?

@nkrishnakishor
Copy link
Author

@Ch3LL below is the output when i run salt-minion-debug.bat file in windows minion.

The salt-minion service is stopping.
The salt-minion service was stopped successfully.

[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\_schedule.conf'
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\_schedule.conf
[DEBUG   ] Using cached minion ID from c:\salt\conf\minion_id: windows-minion
[DEBUG   ] Multiprocessing queue logging configured for the process running under PID: 8984
[DEBUG   ] Marking 'is_ip' as a jinja filter
[DEBUG   ] Marking 'is_ipv4' as a jinja filter
[DEBUG   ] Marking 'is_ipv6' as a jinja filter
[DEBUG   ] Marking 'ipv4' as a jinja filter
[DEBUG   ] Marking 'ipv6' as a jinja filter
[DEBUG   ] Marking 'ipaddr' as a jinja filter
[DEBUG   ] Marking 'ip_host' as a jinja filter
[DEBUG   ] Marking 'network_hosts' as a jinja filter
[DEBUG   ] Marking 'network_size' as a jinja filter
[DEBUG   ] Marking 'gen_mac' as a jinja filter
[DEBUG   ] Marking 'mac_str_to_bytes' as a jinja filter
[DEBUG   ] Marking 'dns_check' as a jinja filter
[DEBUG   ] Multiprocessing queue logging configured for the process running under PID: 8984
[DEBUG   ] Configuration file path: c:\salt\conf\minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[INFO    ] Setting up the Salt Minion "windows-minion"
[DEBUG   ] Marking 'base64_encode' as a jinja filter
[DEBUG   ] Marking 'base64_decode' as a jinja filter
[DEBUG   ] Marking 'md5' as a jinja filter
[DEBUG   ] Marking 'sha256' as a jinja filter
[DEBUG   ] Marking 'sha512' as a jinja filter
[DEBUG   ] Marking 'hmac' as a jinja filter
[DEBUG   ] Marking 'random_hash' as a jinja filter
[DEBUG   ] Marking 'rand_str' as a jinja filter
[DEBUG   ] Marking 'file_hashsum' as a jinja filter
[DEBUG   ] Marking 'http_query' as a jinja filter
[DEBUG   ] Marking 'strftime' as a jinja filter
[DEBUG   ] Marking 'date_format' as a jinja filter
[DEBUG   ] Marking 'yaml_dquote' as a jinja filter
[DEBUG   ] Marking 'yaml_squote' as a jinja filter
[DEBUG   ] Marking 'yaml_encode' as a jinja filter
[DEBUG   ] Marking 'raise' as a jinja global
[DEBUG   ] Marking 'match' as a jinja test
[DEBUG   ] Marking 'equalto' as a jinja test
[DEBUG   ] Marking 'skip' as a jinja filter
[DEBUG   ] Marking 'sequence' as a jinja filter
[DEBUG   ] Marking 'to_bool' as a jinja filter
[DEBUG   ] Marking 'quote' as a jinja filter
[DEBUG   ] Marking 'regex_escape' as a jinja filter
[DEBUG   ] Marking 'regex_search' as a jinja filter
[DEBUG   ] Marking 'regex_match' as a jinja filter
[DEBUG   ] Marking 'regex_replace' as a jinja filter
[DEBUG   ] Marking 'uuid' as a jinja filter
[DEBUG   ] Marking 'unique' as a jinja filter
[DEBUG   ] Marking 'min' as a jinja filter
[DEBUG   ] Marking 'max' as a jinja filter
[DEBUG   ] Marking 'avg' as a jinja filter
[DEBUG   ] Marking 'union' as a jinja filter
[DEBUG   ] Marking 'intersect' as a jinja filter
[DEBUG   ] Marking 'difference' as a jinja filter
[DEBUG   ] Marking 'symmetric_difference' as a jinja filter
[DEBUG   ] Created pidfile: c:\salt\var\run\salt-minion.pid
[INFO    ] Starting up the Salt Minion
[DEBUG   ] AsyncEventPublisher PUB socket URI: 4510
[DEBUG   ] AsyncEventPublisher PULL socket URI: 4511
[INFO    ] Starting pull socket on 4511
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Initializing new IPCClient for path: 4510
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\_schedule.conf'
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\_schedule.conf
[INFO    ] Creating minion process manager
[DEBUG   ] Process Manager starting!
[DEBUG   ] Process Manager starting!
[DEBUG   ] Connecting to master. Attempt 1 (infinite attempts)
[DEBUG   ] Master URI: tcp://192.168.5.40:4506
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506')
[DEBUG   ] Generated random reconnect delay between '1000ms' and '11000ms' (6748)
[DEBUG   ] Setting zmq_reconnect_ivl to '6748ms'
[DEBUG   ] Setting zmq_reconnect_ivl_max to '11000ms'
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506', 'clear')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.5.40:4506
[DEBUG   ] Trying to connect to: tcp://192.168.5.40:4506
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key
[DEBUG   ] Decrypting the current master AES key
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] salt.crypt._get_key_with_evict: Loading private key
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
[DEBUG   ] salt.crypt.get_rsa_pub_key: Loading public key
[DEBUG   ] Connecting the Minion to the Master publish port, using the URI: tcp://192.168.5.40:4505
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506', u'aes')
[DEBUG   ] Re-using AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.5.40:4506
[DEBUG   ] Trying to connect to: tcp://192.168.5.40:4506
[DEBUG   ] salt.crypt.get_rsa_key: Loading private key
[DEBUG   ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
[DEBUG   ] Grains refresh requested. Refreshing grains.
[DEBUG   ] Reading configuration from c:\salt\conf\minion
[DEBUG   ] Including configuration from 'c:\salt\conf\minion.d\_schedule.conf'
[DEBUG   ] Reading configuration from c:\salt\conf\minion.d\_schedule.conf
[DEBUG   ] Initializing new Schedule
[DEBUG   ] LazyLoaded timezone.get_offset
[DEBUG   ] LazyLoaded cmd.run
[INFO    ] Executing command [u'tzutil', u'/g'] in directory 'C:\Users\user1'
[DEBUG   ] stdout: India Standard Time
[DEBUG   ] output: India Standard Time
[INFO    ] Executing command [u'tzutil', u'/l'] in directory 'C:\Users\user1'
[DEBUG   ] LazyLoaded config.merge
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Initializing new IPCClient for path: 4511
[DEBUG   ] Sending event: tag = /salt/minion/minion_schedule_delete_complete; data = {u'_stamp': '2018-10-17T10:14:05.090000', u'complete': True, u'schedule': {u'__mine_interval': {u'function': u'mine.update', u'return_job': False, u'enabled': True, u'jid_include': True, u'maxrunning': 2, u'minutes': 60}}}
[DEBUG   ] Persisting schedule
[DEBUG   ] LazyLoaded mine.update
[INFO    ] Updating job settings for scheduled job: __mine_interval
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Initializing new IPCClient for path: 4511
[DEBUG   ] Sending event: tag = /salt/minion/minion_schedule_add_complete; data= {u'_stamp': '2018-10-17T10:14:05.090000', u'complete': True, u'schedule': {u'__mine_interval': {u'function': u'mine.update', u'enabled': True, u'return_job':False, u'jid_include': True, u'maxrunning': 2, u'minutes': 60}}}
[DEBUG   ] Persisting schedule
[INFO    ] Added mine.update to scheduler
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Initializing new IPCClient for path: 4511
[DEBUG   ] Sending event: tag = /salt/minion/minion_schedule_delete_complete; data = {u'_stamp': '2018-10-17T10:14:05.090000', u'complete': True, u'schedule': {u'__mine_interval': {u'function': u'mine.update', u'enabled': True, u'return_job': False, u'jid_include': True, u'maxrunning': 2, u'minutes': 60}}}
[DEBUG   ] Persisting schedule
[DEBUG   ] SaltEvent PUB socket URI: 4510
[DEBUG   ] SaltEvent PULL socket URI: 4511
[DEBUG   ] Initializing new IPCClient for path: 4511
[DEBUG   ] Sending event: tag = /salt/minion/minion_schedule_delete_complete; data = {u'_stamp': '2018-10-17T10:14:05.090000', u'complete': True, u'schedule': {u'__mine_interval': {u'function': u'mine.update', u'enabled': True, u'return_job': False, u'jid_include': True, u'maxrunning': 2, u'minutes': 60}}}
[DEBUG   ] Persisting schedule
[INFO    ] Minion is starting as user 'domain\user1'
[DEBUG   ] Minion 'windows-minion' trying to tune in
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506', u'aes')
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.5.40:4506
[DEBUG   ] Trying to connect to: tcp://192.168.5.40:4506
[DEBUG   ] Initializing new AsyncZeroMQReqChannel for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506', u'aes')
[DEBUG   ] Initializing new AsyncAuth for (u'c:\\salt\\conf\\pki\\minion', u'windows-minion', u'tcp://192.168.5.40:4506')
[DEBUG   ] Connecting the Minion to the Master URI (for the return server): tcp://192.168.5.40:4506
[DEBUG   ] Trying to connect to: tcp://192.168.5.40:4506
[INFO    ] Minion is ready to receive requests!
[DEBUG   ] LazyLoaded diskusage.beacon

@nkrishnakishor
Copy link
Author

Any help please ?

1 similar comment
@nkrishnakishor
Copy link
Author

Any help please ?

@Ch3LL
Copy link
Contributor

Ch3LL commented Oct 22, 2018

so it looks like its loading the module but not firing off any events.

ping @garethgreenaway do you have any ideas here? Does the configuration setup look correct?

@garethgreenaway garethgreenaway added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around fixed-pls-verify fix is linked, bug author to confirm fix P2 Priority 2 and removed info-needed waiting for more info labels Oct 24, 2018
@garethgreenaway
Copy link
Contributor

I took a look at this one and found the issue. The configuration is correct but the drive letter in the configuration is used as the pattern for matching against the partition list returned from psutil. The driver letter requires two slashes to ensure properly escaping, but when the matching happens it appears as a single slash. The results returned from psutil also include the double slash, for proper escaping, which doesn't end up matching what is in the configuration. So this fix ensures that the pattern is properly escaped so we have match of what is returned from psutil.

@nkrishnakishor
Copy link
Author

@garethgreenaway I have updated salt version now it is 2018.3.3

salt --versions-report

Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          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.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.5 (default, Jul 13 2018, 13:06:57)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.3.1
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 3.2.5

System Versions:
           dist: centos 7.2.1511 Core
         locale: UTF-8
        machine: x86_64
        release: 3.10.0-327.el7.x86_64
         system: Linux
        version: CentOS Linux 7.2.1511 Core

But still i don't see any event on master event bus. Even checked by restarting minion service on windows machine.

@garethgreenaway
Copy link
Contributor

@nkrishnakishor The fix will be in 2018.3.4 and Fluorine.

@nkrishnakishor
Copy link
Author

@garethgreenaway thanks for the info. Waiting for it 🙂

@UtahDave
Copy link
Contributor

I'm not sure this is actually fixed yet. I tried deploying the beacon from the 2018.3.4 branch and I'm getting the attached error

diskusage_stacktrace

@garethgreenaway
Copy link
Contributor

Maybe I was wrong about it being in .4. Can try the one from the 2018.3 branch?

@UtahDave
Copy link
Contributor

Yeah, absolutely. Just a minute

@UtahDave
Copy link
Contributor

OK. So the beacon does appear to work, but it still gives the above stacktrace.

@garethgreenaway
Copy link
Contributor

garethgreenaway commented Jan 31, 2019

@UtahDave will take another look. Can you share your beacon config?

@UtahDave
Copy link
Contributor

Here you go:

ubuntu@server:~$ cat /srv/pillar/win_beacons.sls 
beacons:
  diskusage:
    - 'c:\\': 60%
    - interval: 5

@nkrishnakishor
Copy link
Author

@UtahDave thanks for the file but i don't see any events on the master bus.

cat /srv/pillar/beacon.sls | grep -v '#' | grep -v '^$'
beacons:
  diskusage:
    - 'c:\\': 5%
    - interval: 1
    - /: 50%
    - disable_during_state_run: True

@nkrishnakishor
Copy link
Author

Do we need to have any package installed on master for beacon to work on Windows ?

@sagetherage sagetherage added Question The issue is more of a question rather than a bug or a feature request Windows and removed fixed-pls-verify fix is linked, bug author to confirm fix labels Mar 25, 2020
@sagetherage sagetherage modified the milestones: Blocked, Approved Mar 25, 2020
@sagetherage sagetherage removed the P2 Priority 2 label Jun 3, 2020
@sagetherage sagetherage added this to To do in Windows via automation May 7, 2021
@sagetherage sagetherage assigned twangboy and xeacott and unassigned cmcmarrow May 7, 2021
@twangboy twangboy modified the milestones: Approved, Argon v3008 Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Question The issue is more of a question rather than a bug or a feature request severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Windows
Projects
Windows
  
To do
Development

No branches or pull requests

9 participants