Salt Staple - Find Slow States

The initial installation takes about 20 minutes to start, and the startup salt-call state.highstate

takes about 6 minutes. It's not unreasonable, but I would like to speed it up, but I'm not sure how to find the slowest states.

Is there a way to find out how long it takes for each state other than watching my stopwatch screen for 6 minutes?


source to share

1 answer

sudo salt-call state.highstate

provides start time and duration for each state.

          ID: ntp-removed
    Function: pkg.removed
      Result: True
     Comment: None of the targeted packages are installed
     Started: 12:45:04.430901
    Duration: 0.955 ms


You can write this for processing:

salt-call state.highstate test=True --out json | tee output.json
python -c 'import json; j=json.load(open("output.json"))["local"];\
           print [x["name"] for x in j.values() if x["duration"] > 1000];'





All Articles