salt-stack highstate - 找到慢状态 [英] salt-stack highstate - find slow states

查看:37
本文介绍了salt-stack highstate - 找到慢状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Running an initial install takes about 20 minutes, running a salt-call state.highstate takes about 6 minutes. That's not unreasonable, but I'd like to speed it up, but I'm not sure how to find the slowest states.

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

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

推荐答案

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

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

这篇关于salt-stack highstate - 找到慢状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆