salt grains.get没法获取到productname

1、报错信息node

邮件收到CMDB发出的错误信息,“No value for productname”,经过salt '主机的salt-key' grains.get productname,发现返回值的确为空。python

找了两台主机,看了下productname究竟是什么返回值,经过如下判断,多是虚拟化类型。linux

# salt 'wanwan-test-sr1' grains.get productname
wanwan-test-sr1:
    Alibaba Cloud ECS
# salt 'exporthost' grains.get productname
exporthost:
    VMware Virtual Platform

2、处理过程ios

linux下安装下virt-what包:shell

# yum search virt-what
# yum -y install virt-what
# salt 'exporthost' grains.ls
exporthost:
    - SSDs
    - biosreleasedate
    - biosversion
    - cpu_flags
    - cpu_model
    - cpuarch
    - disks
    - dns
    - domain
    - fqdn
    - fqdn_ip4
    - fqdn_ip6
    - gid
    - gpus
    - groupname
    - 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
    - manufacturer
    - master
    - mdadm
    - mem_total
    - nodename
    - num_cpus
    - num_gpus
    - os
    - os_family
    - osarch
    - oscodename
    - osfinger
    - osfullname
    - osmajorrelease
    - osrelease
    - osrelease_info
    - path
    - pid
    - productname
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - selinux
    - serialnumber
    - server_id
    - shell
    - uid
    - username
    - uuid
    - virtual
    - zmqversion
# salt 'exporthost' grains.get productname
exporthost:
    VMware Virtual Platform

到此,问题获得解决。
bash

相关文章
相关标签/搜索