saltstack_grains

1.

[root@kylin1 grains]# cd /srv/salt/_grains/

[root@kylin1 _grains]# ls

cpu.py

[root@kylin1 _grains]# cat /srv/salt/_grains/cpu.py

#!/usr/bin/python

#coding:utf-8

import os

def cpu():

grains = {}

command = "top -b -n 1 | grep Cpu | awk -F'[:,]' '{print $5}'"

with os.popen(command) as file:

grains["cpu_id"] = file.read()

return grains

2.saltstack_grains

3.saltstack_grains

上一篇:vmware 两删除一清空


下一篇:新浪授权认证(不用SDK)