运行初始安装大约需要 20 分钟,运行salt-call state.highstate
大约需要 6 分钟。这不是不合理的,但我想加快速度,但我不确定如何找到最慢的状态。
用秒表看屏幕 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:
您可以捕获此内容进行处理:
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']