如何聚合 SaltStack 命令结果? [英] How can I aggregate SaltStack command results?

查看:38
本文介绍了如何聚合 SaltStack 命令结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以运行一个 SaltStack 命令来查看某个进程是否在一台机器上运行,并汇总在多个 Minion 上运行该命令的结果?

Is it possible to run a SaltStack command that, say, looks to see if a process is running on a machine, and aggregate the results of running that command on multiple minions?

本质上,我希望看到从 Minion 返回的所有结果显示在类似 ASCII 表中.是否有可能有一个等待所有结果返回的超级结果格式化程序,然后应用该格式?也许还有另一种方法?

Essentially, I'd like to see all the results that are returned from the minions displayed in something like an ASCII table. Is it possible to have an uber-result formatter that waits for all the results to come back, then applies the format? Perhaps there's another approach?

推荐答案

如果您想完全在 Salt 中执行此操作,我建议您创建一个输出器",以您想要的方式显示数据.

If you want to do this entirely within Salt, I would recommend creating an "outputter" that displays the data how you want.

最近创建了一个highstate"输出器,它可能会给你一个很好的起点.highstate 输出器创建一个返回数据的小汇总表.可以在这里找到:

A "highstate" outputter was recently created that might give you a good starting point. The highstate outputter creates a small summary table of the returned data. It can be found here:

https://github.com/saltstack/salt/blob/develop/salt/output/highstate.py

我建议您也仔细阅读其他输出器的代码.

I'd recommend perusing the code of the other outputters as well.

如果您想使用其他工具来创建此报告,我建议您在 cli 的命令中添加--out json".这将导致 Salt 以 json 格式返回数据,然后您可以将其通过管道传输到另一个应用程序进行处理.

If you want to use another tool to create this report, I would recommend adding "--out json" to your command at the cli. This will cause Salt to return the data in json format which you can then pipe to another application for processing.

这篇关于如何聚合 SaltStack 命令结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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