salt-stack highstate - find slow states

跟風遠走 提交于 2019-12-05 08:52:51

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
     Changes:   

You can capture 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];'

[u'munin-node']
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!