盐堆运行历史的Web界面

时间:2016-03-23 07:31:23

标签: salt-stack

如何可视化旧stalt-stack运行的历史?

我找到了如何在外部系统中存储作业缓存的文档:externa-job-cache,但是如何获得简单的Web界面?

我的目标:我想在2015-12-24的日子回答诸如“盐对主人做了什么”这样的问题?

2 个答案:

答案 0 :(得分:2)

Lothiraldan/saltpad可能符合您的需求。

请注意 - 它在不久之前被完全重写,并且new version is not ready将与稳定版本的salt一起使用。 old version现在可能符合您的需求。

据我所知,显示在salt-master上执行的所有作业的结果,但是显示使用saltpad本身执行的作业的结果。

如果saltpad不能满足您的需求,应该可以通过一点点努力来使用REST API salt提供的解决您的需求。看看这个REST URI

答案 1 :(得分:0)

这可能过于简单,但如果您的查询总是关于主机" foo",那么您可以从minion日志中获取此信息,前提是您将loglevel设置为info(警告是默认值) 。如果您有权访问仆从,您可以在那里搜索:

# grep -v DEBUG /var/log/salt/minion | grep -v utils.schedule | grep -v salt.loaded.int.module | grep -v salt.fileclient | grep 2016-03-13
2016-03-13 03:42:26,347 [salt.minion      ][INFO    ][16771] User root Executing command state.highstate with jid 20160313034226341724
2016-03-13 03:42:26,371 [salt.minion      ][INFO    ][17877] Starting a new job with PID 17877
2016-03-13 03:42:27,688 [salt.state       ][INFO    ][17877] Loading fresh modules for state activity
2016-03-13 03:42:28,438 [salt.state       ][INFO    ][17877] Loading fresh modules for state activity
2016-03-13 03:42:28,712 [salt.state       ][INFO    ][17877] Loading fresh modules for state activity
2016-03-13 03:42:29,181 [salt.state       ][INFO    ][17877] Running state [/etc/yum.repos.d/bak] at time 03:42:29.180461
2016-03-13 03:42:29,181 [salt.state       ][INFO    ][17877] Executing state file.directory for /etc/yum.repos.d/bak
2016-03-13 03:42:29,183 [salt.state       ][INFO    ][17877] The directory /etc/yum.repos.d/bak is in the correct state
2016-03-13 03:42:29,189 [salt.state       ][INFO    ][17877] Completed state [/etc/yum.repos.d/bak] at time 03:42:29.183182
2016-03-13 03:42:29,287 [salt.state       ][INFO    ][17877] Running state [devops-20160304T0944-centos-7-salt] at time 03:42:29.286499
2016-03-13 03:42:29,287 [salt.state       ][INFO    ][17877] Executing state pkgrepo.managed for devops-20160304T0944-centos-7-salt
2016-03-13 03:42:29,295 [salt.state       ][INFO    ][17877] Package repo 'devops-20160304T0944-centos-7-salt' already configured
2016-03-13 03:42:29,295 [salt.state       ][INFO    ][17877] Completed state [devops-20160304T0944-centos-7-salt] at time 03:42:29.295372
2016-03-13 03:42:29,804 [salt.state       ][INFO    ][17877] Running state [salt-minion] at time 03:42:29.804021
2016-03-13 03:42:29,804 [salt.state       ][INFO    ][17877] Executing state pkg.installed for salt-minion
2016-03-13 03:42:30,326 [salt.state       ][INFO    ][17877] Package salt-minion is already installed
2016-03-13 03:42:30,327 [salt.state       ][INFO    ][17877] Completed state [salt-minion] at time 03:42:30.326808
2016-03-13 03:42:30,327 [salt.state       ][INFO    ][17877] Running state [/etc/salt/minion] at time 03:42:30.327101
2016-03-13 03:42:30,328 [salt.state       ][INFO    ][17877] Executing state file.managed for /etc/salt/minion
2016-03-13 03:42:30,344 [salt.state       ][INFO    ][17877] The file /etc/salt/minion is in the correct state
2016-03-13 03:42:30,345 [salt.state       ][INFO    ][17877] Completed state [/etc/salt/minion] at time 03:42:30.344459
2016-03-13 03:42:30,346 [salt.state       ][INFO    ][17877] Running state [salt-minion] at time 03:42:30.345981
2016-03-13 03:42:30,346 [salt.state       ][INFO    ][17877] Executing state service.running for salt-minion
2016-03-13 03:42:30,506 [salt.state       ][INFO    ][17877] The service salt-minion is already running
2016-03-13 03:42:30,507 [salt.state       ][INFO    ][17877] Completed state [salt-minion] at time 03:42:30.506926
2016-03-13 03:42:30,507 [salt.state       ][INFO    ][17877] Running state [ntp] at time 03:42:30.507251
2016-03-13 03:42:30,508 [salt.state       ][INFO    ][17877] Executing state pkg.installed for ntp
2016-03-13 03:42:30,508 [salt.state       ][INFO    ][17877] Package ntp is already installed
2016-03-13 03:42:30,508 [salt.state       ][INFO    ][17877] Completed state [ntp] at time 03:42:30.508308
2016-03-13 03:42:30,509 [salt.state       ][INFO    ][17877] Running state [ntpdate] at time 03:42:30.508561
2016-03-13 03:42:30,509 [salt.state       ][INFO    ][17877] Executing state pkg.installed for ntpdate
2016-03-13 03:42:30,509 [salt.state       ][INFO    ][17877] Package ntpdate is already installed
2016-03-13 03:42:30,509 [salt.state       ][INFO    ][17877] Completed state [ntpdate] at time 03:42:30.509431
2016-03-13 03:42:30,512 [salt.state       ][INFO    ][17877] Running state [/etc/ntp.conf] at time 03:42:30.511811
2016-03-13 03:42:30,539 [salt.state       ][INFO    ][17877] Running state [/etc/ntp.conf] at time 03:42:30.538741
2016-03-13 03:42:30,539 [salt.state       ][INFO    ][17877] Executing state file.managed for /etc/ntp.conf
2016-03-13 03:42:30,563 [salt.state       ][INFO    ][17877] The file /etc/ntp.conf is in the correct state
2016-03-13 03:42:30,563 [salt.state       ][INFO    ][17877] Completed state [/etc/ntp.conf] at time 03:42:30.563260
2016-03-13 03:42:30,564 [salt.state       ][INFO    ][17877] Running state [/etc/ntp/step-tickers] at time 03:42:30.563540
2016-03-13 03:42:30,564 [salt.state       ][INFO    ][17877] Executing state file.absent for /etc/ntp/step-tickers
2016-03-13 03:42:30,564 [salt.state       ][INFO    ][17877] File /etc/ntp/step-tickers is not present
2016-03-13 03:42:30,564 [salt.state       ][INFO    ][17877] Completed state [/etc/ntp/step-tickers] at time 03:42:30.564369
2016-03-13 03:42:30,566 [salt.state       ][INFO    ][17877] Running state [ntpdate] at time 03:42:30.565970
2016-03-13 03:42:30,566 [salt.state       ][INFO    ][17877] Executing state service.running for ntpdate
2016-03-13 03:42:30,707 [salt.state       ][INFO    ][17877] The service ntpdate is already running
2016-03-13 03:42:30,707 [salt.state       ][INFO    ][17877] Completed state [ntpdate] at time 03:42:30.707253
2016-03-13 03:42:30,708 [salt.state       ][INFO    ][17877] Running state [ntpd] at time 03:42:30.707981
2016-03-13 03:42:30,708 [salt.state       ][INFO    ][17877] Executing state service.running for ntpd
2016-03-13 03:42:30,852 [salt.state       ][INFO    ][17877] The service ntpd is already running
2016-03-13 03:42:30,852 [salt.state       ][INFO    ][17877] Completed state [ntpd] at time 03:42:30.852311
2016-03-13 03:42:30,853 [salt.state       ][INFO    ][17877] Running state [exec 0>&- # close stdin
2016-03-13 03:42:30,854 [salt.state       ][INFO    ][17877] Executing state cmd.wait for exec 0>&- # close stdin
2016-03-13 03:42:30,854 [salt.state       ][INFO    ][17877] No changes made for exec 0>&- # close stdin
2016-03-13 03:42:30,854 [salt.state       ][INFO    ][17877] Completed state [exec 0>&- # close stdin
2016-03-13 03:42:30,855 [salt.minion      ][INFO    ][17877] Returning information for job: 20160313034226341724

但是,是的,如果你想通过更好的搜索做一些事情,那么外部作业缓存是正确的。我们将工作结果转发给弹性搜索,但我还没有玩过。