VMware パフォ`マンス カウンタ` パスのフォ`マットはgroup/counter[rollup]
です。
group
- cpu などのパフォ`マンス カウンタ` グル`プcounter
- usagemhz などのパフォ`マンス カウンタ`兆rollup
- averageなどのパフォ`マンス カウンタ` ロ`ルアップのN貧の箭では肝のカウンタ` パスが誼られます: cpu/usagemhz[average]
パフォ`マンス カウンタ` グル`プのh苧、カウンタ`兆、およびロ`ルアップのNについては、を歌孚してください。
霜拶仰鴬 のスクリプト アイテムを聞喘して、坪何兆を函誼し、カスタム パフォ`マンス カウンタ`兆を恬撹することもできます。
try {
霜拶仰鴬.log(4, 'vmware metrics script');
var result, resp,
req = new HttpRequest();
req.addHeader('Content-Type: application/xml');
req.addHeader('SOAPAction: "urn:vim25/6.0"');
login = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">\
<soapenv:Header/>\
<soapenv:Body>\
<urn:Login>\
<urn:_this type="SessionManager">SessionManager</urn:_this>\
<urn:userName>{$VMWARE.USERNAME}</urn:userName>\
<urn:password>{$VMWARE.PASSWORD}</urn:password>\
</urn:Login>\
</soapenv:Body>\
</soapenv:Envelope>'
resp = req.post("{$VMWARE.URL}", login);
if (req.getStatus() != 200) {
throw 'Response code: '+req.getStatus();
}
query = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">\
<soapenv:Header/>\
<soapenv:Body>\
<urn:RetrieveProperties>\
<urn:_this type="PropertyCollector">propertyCollector</urn:_this>\
<urn:specSet>\
<urn:propSet>\
<urn:type>PerformanceManager</urn:type>\
<urn:pathSet>perfCounter</urn:pathSet>\
</urn:propSet>\
<urn:objectSet>\
<urn:obj type="PerformanceManager">PerfMgr</urn:obj>\
</urn:objectSet>\
</urn:specSet>\
</urn:RetrieveProperties>\
</soapenv:Body>\
</soapenv:Envelope>'
resp = req.post("{$VMWARE.URL}", query);
if (req.getStatus() != 200) {
throw 'Response code: '+req.getStatus();
}
霜拶仰鴬.log(4, 'vmware metrics=' + resp);
result = resp;
logout = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">\
<soapenv:Header/>\
<soapenv:Body>\
<urn:Logout>\
<urn:_this type="SessionManager">SessionManager</urn:_this>\
</urn:Logout>\
</soapenv:Body>\
</soapenv:Envelope>'
resp = req.post("{$VMWARE.URL}",logout);
if (req.getStatus() != 200) {
throw 'Response code: '+req.getStatus();
}
} catch (error) {
霜拶仰鴬.log(4, 'vmware call failed : '+error);
result = {};
}
return result;
朕を譜協瘁、テスト ボタンを兀して、、糧ゝ を兀します。
鞭佚した XML を販吭の XML フォ`マッタ`にコピ`し、朕議のメトリックをつけます。
1 つのメトリックの XML の箭:
<PerfCounterInfo xsi:type="PerfCounterInfo">
<key>6</key>
<nameInfo>
<label>Usage in MHz</label>
<summary>CPU usage in megahertz during the interval</summary>
<key>usagemhz</key>
</nameInfo>
<groupInfo>
<label>CPU</label>
<summary>CPU</summary>
<key>cpu</key>
</groupInfo>
<unitInfo>
<label>MHz</label>
<summary>Megahertz</summary>
<key>megaHertz</key>
</unitInfo>
<rollupType>average</rollupType>
<statsType>rate</statsType>
<level>1</level>
<perDeviceLevel>3</perDeviceLevel>
</PerfCounterInfo>
XPath を聞喘して、鞭佚した XML からカウンタ` パスを渇竃します。 貧の箭では、XPath は肝のようになります:
フィ`ルド | xPath | |
---|---|---|
group | //groupInfo[../key=6]/key | cpu |
counter | //nameInfo[../key=6]/key | usagemhz |
rollup | //rollupType[../key=6] | average |
このY惚の栽のパフォ`マンス カウンタ` パスは肝のとおりです: cpu/usagemhz[average]