0
솔트 스택에서 미니언을 메모리 크기로 필터링 할 수 있지만 메모리 크기가 같거나 작거나 같아야한다는 값을 나타낼 수 있습니까? 그래서이 대신 :메모리 크기별 미니언 필터
salt -C '[email protected]_total > 993' test.ping
솔트 스택에서 미니언을 메모리 크기로 필터링 할 수 있지만 메모리 크기가 같거나 작거나 같아야한다는 값을 나타낼 수 있습니까? 그래서이 대신 :메모리 크기별 미니언 필터
salt -C '[email protected]_total > 993' test.ping
난 두려워 당신이 실제로 할 수없는이 그대로 targeting feature를 사용하여 :
는salt -C '[email protected]_total:993' test.ping
이 같은 뭔가를해야만합니다.
내 마음에 오는 첫 번째 일은 custom grain입니다.
는 한 곳에서만이 필요한 경우 자주 변경되지 않는 값이 해결 될 수 있습니다 이후
#!/usr/bin/env python
from psutil import virtual_memory
def categorize_memory():
grains = {}
mem = virtual_memory()
total_mem = mem.total
if total_mem < 1024 * 999:
grains['memory_category'] = 'low_mem_minion'
else:
grains['memory_category'] = 'high_mem_minion'
return grains
그 salt -C '[email protected]_category:high_mem_minion' test.ping
검증되지 않은 예를
파이썬에서 메모리를 확인하는 코드는 Get total physical memory in Python
에서 가져 왔습니다.