Search code examples
salt-project

Salt stack targeting with respect to absence of user input for some time


Is it possible in salt stack to only select minions with no user input for some time? For instance, I want to only run command on the minions that have no mouse and keyboard events for at least half an hour.


Solution

  • Looking at the concepts available in Salt this could be done as Beacon, Mine or Schedule.

    Salt Beacon instructs your minions to send events on special situations. You can use them as part of Salt's Reactor to trigger events. The ps beacon or the sh beacon might be what you are looking for.

    Salt Mine allows you to collect information periodically (default once per hour, but you can also trigger it manually) and use it with mine.get in your scripts.

    Salt Schedule allows you to trigger command autonomously on the minions.

    But I am afraid that there is no predefined functionality to check for user input or inactivity.