- Execute the configured functions and send the data back up to the master The functions to be executed are merged from the master config,
- pillar and minion config under the option "function_cache": mine_functions: network.ip_addrs:
配置起来很简单,跑到 minion 端,配置下文件,开启几个模块的检测。
[root@vm-10-154-252-46 utils]# tail /etc/salt/minion
mine_functions:
test.ping: []
network.dig:
- www.naver.com
network.usage: []
mine_interval: 1
然后咱们跑到 master 端去抓数据。
[root@vm-10-154-252-82 ~/clusterops/templates]$salt '10.154.252.46' mine.get '*' network.dig
10.154.252.46:
----------
10.154.252.46:
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.10.rc1.el6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5279
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 5, ADDITIONAL: 2
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 186 IN CNAME www.a.shifen.com.
www.a.shifen.com. 149 IN A 220.181.111.188
www.a.shifen.com. 149 IN A 220.181.112.244
;; AUTHORITY SECTION:
a.shifen.com. 186 IN NS ns3.a.shifen.com.
a.shifen.com. 186 IN NS ns1.a.shifen.com.
a.shifen.com. 186 IN NS ns5.a.shifen.com.
a.shifen.com. 186 IN NS ns2.a.shifen.com.
a.shifen.com. 186 IN NS ns4.a.shifen.com.
;; ADDITIONAL SECTION:
ns5.a.shifen.com. 70 IN A 119.75.219.43
ns2.a.shifen.com. 186 IN A 180.149.133.241
;; Query time: 1 msec
;; SERVER: 10.150.0.253#53(10.150.0.253)
;; WHEN: Wed Jul 2 14:42:55 2014
;; MSG SIZE rcvd: 212
来源: http://it.taocms.org/07/3924.htm