salt-stack highstate - 找到缓慢的状态

Red*_*arf 5 salt-stack

运行初始安装大约需要20分钟,运行salt-call state.highstate大约需要6分钟.这不是不合理的,但我想加快速度,但我不确定如何找到最慢的状态.

除了用秒表观看我的屏幕6分钟之外,还有什么方法可以找到每个状态运行多长时间?

Dan*_*ite 6

sudo salt-call state.highstate 提供每个州的开始时间和持续时间.

----------
          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
     Changes:   
Run Code Online (Sandbox Code Playgroud)

您可以捕获此进行处理:

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];'

[u'munin-node']
Run Code Online (Sandbox Code Playgroud)