Configure the scanning schedule

Configure the scanning schedule

By default, the Janitor service scans your MCP cluster for unused resources once every hour from 11:00 a.m. to 11:59 p.m. in the Pacific Time Zone (PT) on week days. Though, you can easily override the default schedule by defining the simianarmy.properties environment variables depending on the needs of your environment.

The Janitor service schedule parameters
Parameter Default Description
simianarmy.scheduler.frequency 1 The parameter is connected to the frequencyUnit parameter determining the scanning cycle. The 1 frequency together with the HOURS frequencyUnit means that the scanning will be performed once every hour.
simianarmy.scheduler.frequencyUnit HOURS The available values include the java.util.concurrent.TimeUnit enum values.
simianarmy.calendar.openHour 11 Sets the time when the service starts performing any action (scheduling, deleting) on week days.
simianarmy.calendar.closeHour 11 Sets the time when the service stops performing any action (scheduling, deleting) on week days.
simianarmy.calendar.timezone America/Los_Angeles The time zone which the Janitor service operates in.

To configure the scanning schedule:

  1. Log in to the Salt Master node.

  2. In the classes/cluster/${_param:cluster_name}/oss/client.yml file of the Reclass model, define the Cleanup service schedule parameters as required. For example:

    docker:
      client:
        stack:
          janitor_monkey:
            environment:
              simianarmy.scheduler.frequency: 3
              simianarmy.scheduler.frequencyUnit: MINUTES
    
  3. To apply the changes, recreate the stack:

    salt -C 'I@docker:swarm:role:master' cmd.run 'docker stack rm janitor_monkey'
    salt '*' saltutil.refresh_pillar
    salt -C 'I@docker:swarm:role:master' state.sls docker.client