mine_interval not work under pillar but under minion config it does

43 views
Skip to first unread message

Dave Macias

unread,
Nov 23, 2022, 2:18:40 PM11/23/22
to Salt-users
Hello,

We have a minion we mine data from every minute. There are no issues when configuring the /etc/salt/minion as so:

master: bla.domain.ne
ipv6: True
id: <hostname>
mine_enabled: True
multiprocessing: False
mine_interval: 1

If i move the mine_interval setting to the minion's pillar file and comment the one on the config file, it no longer works:

> salt minion pillar.items
...
    mine_functions:
        ----------
        get_data:
            |_
              ----------
              mine_function:
                  custom_mod.get_data
            |_
              ----------
              allow_tgt:
                  N @ group1
            |_
              ----------
              allow_tgt_type:
                  compound
    mine_interval:
        1

I dont see any reference in the documentation that the setting can go on the pillar files... but googling around has shown some people suggest it... so im confused as to if it is possible or not.

Did see this FR for setting the interval per function, which would be fantastic: https://github.com/saltstack/salt/issues/18098

Am i doing something wrong?
Any input is appreciated

Thanks,
Dave

Salt Version:
          Salt: 3004.2
 
Dependency Versions:
          cffi: 1.15.1
      cherrypy: unknown
      dateutil: 2.8.2
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.4
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.15.0
        pygit2: Not Installed
        Python: 3.9.15 (main, Nov 12 2022, 07:33:03)
  python-gnupg: Not Installed
        PyYAML: 6.0
         PyZMQ: 21.0.2
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
Salt Extensions:
   salt-nornir: 0.16.1
 
System Versions:
          dist: alpine 3.16.3
        locale: utf-8
       machine: x86_64
       release: 4.18.0-372.26.1.el8_6.x86_64
        system: Linux
       version: Alpine Linux 3.16.3


Phipps, Thomas

unread,
Nov 23, 2022, 2:38:01 PM11/23/22
to salt-...@googlegroups.com
the way mine_interval works it doesn't really lend itself to that that wel what you are asking. however you can get the exact functionality you are looking for.

the way mine_interval works is that al it does is setup a schedule to run mine.update.

```
root@salt00:~# salt-call schedule.list all
local:
    schedule:
      __mine_interval:
        enabled: true
        function: mine.update
        jid_include: true
        maxrunning: 2
        minutes: 60
        name: __mine_interval
        return_job: false
        run_on_start: true
        saved: true
```

You can set `mine_enabled: False` which will keep mine_interval from setting up the mine.update schedule and you can setup a bunch of mine.update schedules that take mine_functions that you want to update at different times.



--
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/f89bd7c1-af8a-4c5c-9f82-2b1d270b7e60n%40googlegroups.com.

Dave Macias

unread,
Nov 23, 2022, 3:28:28 PM11/23/22
to Salt-users
Thank you very much for the input
Ill give that a try

Dave Macias

unread,
Nov 23, 2022, 3:56:35 PM11/23/22
to Salt-users
Is there a way to make that mined data available to other minions like here? 

Should setting the `tgt_bla` settings be enough?

Phipps, Thomas

unread,
Nov 23, 2022, 4:51:15 PM11/23/22
to salt-...@googlegroups.com
mine data is available to all minions by default. Those settings are for if you want to restrict data.

Dave Macias

unread,
Nov 23, 2022, 8:21:57 PM11/23/22
to salt-...@googlegroups.com
Oh yes! Thats true. Forgot about that.
Thank you very much Thomas!

Just to update here:

Created two scheduled mines for testing. Both mine the same data but one every minute and another every two minutes. And data is available to all minions as expected.

schedule:
 mine_test1:
   enabled: true
   function: mine.update
   kwargs:
     mine_functions:
       mine_alias1:
         - mine_function: my_func.get_data
   jid_include: true
   maxrunning: 1
   minutes: 1
   return_job: true
   run_on_start: true
   saved: true

   mine_test2:
     enabled: true
     function: mine.update
     kwargs:
       mine_functions:
         mine_alias2:
           - mine_function: my_func.get_data
     maxrunning: 1
     minutes: 2
     return_job: true
     run_on_start: true
    saved: true

> salt \* mine.get mined_minion mine_alias1


Hope the format came out ok.

Best,
Dave
Reply all
Reply to author
Forward
0 new messages