查看当前已经定义的监控项:
[root@master ~]# salt "192.168.75.135" grains.items
192.168.75.135:
----------
SSDs:
biosreleasedate:
05/19/2017
biosversion:
6.00
cpu_flags:
- fpu
- vme
- de
- pse
- tsc
- msr
- pae
- mce
- cx8
- apic
- sep
- mtrr
- pge
- mca
- cmov
- pat
- pse36
- clflush
- mmx
- fxsr
- sse
- sse2
- ss
- ht
- syscall
- nx
- pdpe1gb
- rdtscp
- lm
- constant_tsc
- arch_perfmon
- nopl
- xtopology
- tsc_reliable
- nonstop_tsc
- eagerfpu
- pni
- pclmulqdq
- ssse3
- fma
- cx16
- pcid
- sse4_1
- sse4_2
- x2apic
- movbe
- popcnt
- tsc_deadline_timer
- aes
- xsave
- avx
- f16c
- rdrand
- hypervisor
- lahf_lm
- abm
- arat
- fsgsbase
- tsc_adjust
- bmi1
- avx2
- smep
- bmi2
- invpcid
- xsaveopt
cpu_model:
Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
cpuarch:
x86_64
domain:
sishen.cn
fqdn:
master.sishen.cn
fqdn_ip4:
- 192.168.75.135
fqdn_ip6:
gpus:
|_
----------
model:
SVGA II Adapter
vendor:
unknown
host:
master
hwaddr_interfaces:
----------
eno16777736:
00:0c:29:04:49:5d
lo:
00:00:00:00:00:00
id:
192.168.75.135
init:
systemd
ip4_interfaces:
----------
eno16777736:
- 192.168.75.135
lo:
- 127.0.0.1
ip6_interfaces:
----------
eno16777736:
- fe80::20c:29ff:fe04:495d
lo:
- ::1
ip_interfaces:
----------
eno16777736:
- 192.168.75.135
- fe80::20c:29ff:fe04:495d
lo:
- 127.0.0.1
- ::1
ipv4:
- 127.0.0.1
- 192.168.75.135
ipv6:
- ::1
- fe80::20c:29ff:fe04:495d
kernel:
Linux
kernelrelease:
3.10.0-327.el7.x86_64
locale_info:
----------
defaultencoding:
UTF-8
defaultlanguage:
en_US
detectedencoding:
UTF-8
localhost:
master.sishen.cn
lsb_distrib_id:
Red Hat Enterprise Linux Server
machine_id:
9e6df21df731416598ba4fb3e8aba4cd
manufacturer:
VMware, Inc.
master:
192.168.75.135
mdadm:
mem_total:
1985
nodename:
master.sishen.cn
num_cpus:
2
num_gpus:
1
os:
RedHat
os_family:
RedHat
osarch:
x86_64
oscodename:
Maipo
osfinger:
Red Hat Enterprise Linux Server-7
osfullname:
Red Hat Enterprise Linux Server
osmajorrelease:
7
osrelease:
7.2
osrelease_info:
- 7
- 2
path:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
productname:
VMware Virtual Platform
ps:
ps -efH
pythonexecutable:
/usr/bin/python
pythonpath:
- /usr/bin
- /usr/lib64/python27.zip
- /usr/lib64/python2.7
- /usr/lib64/python2.7/plat-linux2
- /usr/lib64/python2.7/lib-tk
- /usr/lib64/python2.7/lib-old
- /usr/lib64/python2.7/lib-dynload
- /usr/lib64/python2.7/site-packages
- /usr/lib64/python2.7/site-packages/gtk-2.0
- /usr/lib/python2.7/site-packages
pythonversion:
- 2
- 7
- 5
- final
- 0
saltpath:
/usr/lib/python2.7/site-packages/salt
saltversion:
2015.5.10
saltversioninfo:
- 2015
- 5
- 10
- 0
selinux:
----------
enabled:
False
enforced:
Disabled
serialnumber:
VMware-56 4d 80 cc 16 29 1f 8f-48 e7 f5 e0 ee 04 49 5d
server_id:
13814108
shell:
/bin/sh
systemd:
----------
features:
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN
version:
219
virtual:
VMware
zmqversion:
3.2.5
查看指定参数数据:
[root@master ~]# salt "192.168.75.135" grains.items os
192.168.75.135:
----------
os:
RedHat
查看多个监控项
[root@master ~]# salt "192.168.75.135" grains.item cpu_model os
192.168.75.135:
----------
cpu_model:
Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz
os:
RedHat
上述亦可用python实现