2013-01-11 26 views

回答

11

Ohai每次運行時檢測節點的某些屬性。這些屬性被捕獲爲automatic attributes,並可作爲節點屬性使用。

屬性node ['filesystem']包含有關係統中每個設備的信息。爲了得到以kb可用的空間,用於特定設備:

node['filesystem']['/dev/xvda1']['kb_available'] 

以下是從Ohai文件系統屬性JSON的示例:

"filesystem": { 
    "/dev/xvda1": { 
    "kb_size": "521882300", 
    "kb_used": "119914572", 
    "kb_available": "375474240", 
    "percent_used": "25%", 
    "mount": "/", 
    "fs_type": "ext4", 
    "mount_options": [ 
     "rw" 
    ], 
    "uuid": "248b8180-f75f-48fc-a8be-e3ff3506c4d6" 
    }, 
    "tmpfs": { 
    "kb_size": "1987292", 
    "kb_used": "0", 
    "kb_available": "1987292", 
    "percent_used": "0%", 
    "mount": "/dev/shm", 
    "fs_type": "tmpfs", 
    "mount_options": [ 
     "rw", 
     "rootcontext=\"system_u:object_r:tmpfs_t:s0\"" 
    ] 
    } 
}