真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

saltstackgrains-創(chuàng)新互聯(lián)

1、什么是Grains

成都創(chuàng)新互聯(lián)公司成立與2013年,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目做網(wǎng)站、網(wǎng)站設(shè)計(jì)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元門源做網(wǎng)站,已為上家服務(wù),為門源各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220

 Grains是SaltStack的一個(gè)組件,存放著minion啟動(dòng)時(shí)收集的底層系統(tǒng)的靜態(tài)信息。Grains是存儲(chǔ)在minion端的,當(dāng)minion啟動(dòng)時(shí),會(huì)進(jìn)行Grains的采集工作,然后保存下來。在以后的生命周期(再次重啟minion,會(huì)重新收集)是不會(huì)發(fā)生變化的,所以是靜態(tài)數(shù)據(jù)。Grains中包含諸如運(yùn)行的內(nèi)核版本、操作系統(tǒng)、CPU個(gè)數(shù)、內(nèi)存、物理設(shè)備型號(hào)等信息。

 數(shù)據(jù)采集更新方式:Minion啟動(dòng)時(shí)收集,也可以使用saltutil.sync_grains

2、Grains的應(yīng)用場(chǎng)景

Grains可以在state系統(tǒng)中使用,用于配置管理模塊。

Grains可以target中使用,在用來匹配Minion,比如匹配操作系統(tǒng),使用-G選項(xiàng)。

Grains可以用于信息查詢,Grains保存著收集到的客戶端的詳細(xì)信息。

3、Grains常用操作

a、列出Minion上所有可用的grains的名稱

[root@master ~]# salt '*' grains.ls
node02.saltstack.com:
    - SSDs
    - biosreleasedate
    - biosversion
    - cpu_flags
    - cpu_model
    - cpuarch
    - domain
    - fqdn
    - fqdn_ip4
    - fqdn_ip6
    - gpus
    - host
    - hwaddr_interfaces
    - id
    - init
    - ip4_interfaces
    - ip6_interfaces
    - ip_interfaces
    - ipv4
    - ipv6
    - kernel
    - kernelrelease
    - locale_info
    - localhost
    - lsb_distrib_codename
    - lsb_distrib_id
    - lsb_distrib_release
    - machine_id
    - manufacturer
    - master
    - mdadm
    - mem_total
    - nodename
    - num_cpus
    - num_gpus
    - os
    - os_family
    - osarch
    - oscodename
    - osfinger
    - osfullname
    - osmajorrelease
    - osrelease
    - osrelease_info
    - path
    - productname
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - selinux
    - serialnumber
    - server_id
    - shell
    - virtual
    - zmqversion
node01.saltstack.com:
    - SSDs
    - biosreleasedate
    - biosversion
    - cpu_flags
    - cpu_model
    - cpuarch
    - domain
    - fqdn
    - fqdn_ip4
    - fqdn_ip6
    - gpus
    - host
    - hwaddr_interfaces
    - id
    - init
    - ip4_interfaces
    - ip6_interfaces
    - ip_interfaces
    - ipv4
    - ipv6
    - kernel
    - kernelrelease
    - locale_info
    - localhost
    - lsb_distrib_codename
    - lsb_distrib_id
    - lsb_distrib_release
    - machine_id
    - manufacturer
    - master
    - mdadm
    - mem_total
    - nodename
    - num_cpus
    - num_gpus
    - os
    - os_family
    - osarch
    - oscodename
    - osfinger
    - osfullname
    - osmajorrelease
    - osrelease
    - osrelease_info
    - path
    - productname
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - selinux
    - serialnumber
    - server_id
    - shell
    - virtual
    - zmqversion

b、列出Minion上所有g(shù)rains的的名稱及內(nèi)容

[root@master ~]# salt 'node01.saltstack.com' grains.items
node01.saltstack.com:
    ----------
    SSDs:
    biosreleasedate:
        07/02/2015
    biosversion:
        6.00
    cpu_flags:
        - fpu
        - vme
        - de
        - pse
        - tsc
        - msr
        - pae
        - mce
        - cx8
        - apic
        - sep
        - mtrr
        - pge
        - mca
        - cmov
        - pat
        - pse36
        - clflush
        - dts
        - mmx
        - fxsr
        - sse
        - sse2
        - ss
        - syscall
        - nx
        - rdtscp
        - lm
        - constant_tsc
        - up
        - arch_perfmon
        - pebs
        - bts
        - xtopology
        - tsc_reliable
        - nonstop_tsc
        - aperfmperf
        - unfair_spinlock
        - pni
        - pclmulqdq
        - ssse3
        - cx16
        - pcid
        - sse4_1
        - sse4_2
        - x2apic
        - popcnt
        - tsc_deadline_timer
        - aes
        - xsave
        - avx
        - f16c
        - rdrand
        - hypervisor
        - lahf_lm
        - ida
        - arat
        - epb
        - pln
        - pts
        - dts
        - fsgsbase
        - smep
    cpu_model:
        Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    cpuarch:
        x86_64
    domain:
        saltstack.com
    fqdn:
        node01.saltstack.com
    fqdn_ip4:
        - 10.10.10.141
    fqdn_ip6:
    gpus:
        |_
          ----------
          model:
              SVGA II Adapter
          vendor:
              unknown
    host:
        node01
    hwaddr_interfaces:
        ----------
        eth0:
            00:0c:29:98:68:91
        lo:
            00:00:00:00:00:00
        pan0:
            f6:aa:1f:cb:87:f0
    id:
        node01.saltstack.com
    init:
        upstart
    ip4_interfaces:
        ----------
        eth0:
            - 10.10.10.141
        lo:
            - 127.0.0.1
        pan0:
    ip6_interfaces:
        ----------
        eth0:
            - fe80::20c:29ff:fe98:6891
        lo:
            - ::1
        pan0:
    ip_interfaces:
        ----------
        eth0:
            - 10.10.10.141
            - fe80::20c:29ff:fe98:6891
        lo:
            - 127.0.0.1
            - ::1
        pan0:
    ipv4:
        - 10.10.10.141
        - 127.0.0.1
    ipv6:
        - ::1
        - fe80::20c:29ff:fe98:6891
    kernel:
        Linux
    kernelrelease:
        2.6.32-573.el6.x86_64
    locale_info:
        ----------
        defaultencoding:
            UTF8
        defaultlanguage:
            en_US
        detectedencoding:
            UTF-8
    localhost:
        node01.saltstack.com
    lsb_distrib_codename:
        Final
    lsb_distrib_id:
        CentOS
    lsb_distrib_release:
        6.7
    machine_id:
        5bd0d598c3ad4f78b38c6e7600000020
    manufacturer:
        VMware, Inc.
    master:
        master.saltstack.com
    mdadm:
    mem_total:
        1863
    nodename:
        node01.saltstack.com
    num_cpus:
        1
    num_gpus:
        1
    os:
        CentOS
    os_family:
        RedHat
    osarch:
        x86_64
    oscodename:
        Final
    osfinger:
        CentOS-6
    osfullname:
        CentOS
    osmajorrelease:
        6
    osrelease:
        6.7
    osrelease_info:
        - 6
        - 7
    path:
        /sbin:/usr/sbin:/bin:/usr/bin
    productname:
        VMware Virtual Platform
    ps:
        ps -efH
    pythonexecutable:
        /usr/bin/python2.6
    pythonpath:
        - /usr/bin
        - /usr/lib64/python26.zip
        - /usr/lib64/python2.6
        - /usr/lib64/python2.6/plat-linux2
        - /usr/lib64/python2.6/lib-tk
        - /usr/lib64/python2.6/lib-old
        - /usr/lib64/python2.6/lib-dynload
        - /usr/lib64/python2.6/site-packages
        - /usr/lib64/python2.6/site-packages/PIL
        - /usr/lib64/python2.6/site-packages/gst-0.10
        - /usr/lib64/python2.6/site-packages/gtk-2.0
        - /usr/lib64/python2.6/site-packages/webkit-1.0
        - /usr/lib/python2.6/site-packages
        - /usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info
    pythonversion:
        - 2
        - 6
        - 6
        - final
        - 0
    saltpath:
        /usr/lib/python2.6/site-packages/salt
    saltversion:
        2015.5.10
    saltversioninfo:
        - 2015
        - 5
        - 10
        - 0
    selinux:
        ----------
        enabled:
            False
        enforced:
            Disabled
    serialnumber:
        VMware-56 4d e6 9b 20 1f b4 60-77 5d 03 1d 1d 98 68 91
    server_id:
        1356238538
    shell:
        /bin/sh
    virtual:
        VMware
    zmqversion:
        3.2.5

c、查看虛擬化的類型

[root@master ~]# salt '*' grains.get virtual
node01.saltstack.com:
    VMware
node02.saltstack.com:
    VMware

d、查詢eth0所有IP地址

[root@master ~]# salt '*' grains.get ip_interfaces
node01.saltstack.com:
    ----------
    eth0:
        - 10.10.10.141
        - fe80::20c:29ff:fe98:6891
    lo:
        - 127.0.0.1
        - ::1
    pan0:
node02.saltstack.com:
    ----------
    eth0:
        - 10.10.10.142
        - fe80::20c:29ff:fead:83d
    lo:
        - 127.0.0.1
        - ::1
    pan0:

e、查詢eth0所有IP地址

[root@master ~]# salt '*' grains.get ip_interfaces:eth0
node02.saltstack.com:
    - 10.10.10.142
    - fe80::20c:29ff:fead:83d
node01.saltstack.com:
    - 10.10.10.141
    - fe80::20c:29ff:fe98:6891

4、自定義grains

a)在minion上的/etc/salt/minion直接配置grains

[root@node01 ~]# vim /etc/salt/minion
grains:
  roles: IT
  dept: system
[root@master ~]# salt -G 'roles:IT' test.ping
node01.saltstack.com:
    True
[root@master ~]# salt -G 'dept:system' test.ping
node01.saltstack.com:
    True

b)通過/etc/salt/grains進(jìn)行定義

[root@node01 ~]# vim /etc/salt/grains 
virtual: openstack
[root@node01 ~]# /etc/init.d/salt-minion restart
Stopping salt-minion daemon:                               [確定]
Starting salt-minion daemon:                               [確定]
[root@node02 ~]# cat /etc/salt/grains 
virtual: xen
[root@node02 ~]# /etc/init.d/salt-minion restart
Stopping salt-minion daemon:                               [確定]
Starting salt-minion daemon:                               [確定]
[root@master ~]# salt -G 'virtual:xen' test.ping
node02.saltstack.com:
    True

在minion端添加一個(gè)mysqlversion的信息

[root@node01 ~]# cat /etc/salt/grains 
virtual: openstack
mysqlversion: 5.5
測(cè)試,發(fā)現(xiàn)存在報(bào)錯(cuò)信息
[root@master ~]# salt -G 'mysqlversion:5.5' test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
使用saltutil.sync_grains進(jìn)行刷新測(cè)試
[root@master ~]# salt '*' saltutil.sync_grains
node02.saltstack.com:
node01.saltstack.com:
[root@master ~]# salt -G 'mysqlversion:5.5' test.ping
node01.saltstack.com:
    True

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


新聞標(biāo)題:saltstackgrains-創(chuàng)新互聯(lián)
文章來源:http://weahome.cn/article/cddhoe.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部