Skip to content

Instantly share code, notes, and snippets.

@sky-joker
Created August 21, 2016 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sky-joker/3daac595e1f2c4f8a84f085c9401786b to your computer and use it in GitHub Desktop.
Save sky-joker/3daac595e1f2c4f8a84f085c9401786b to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use VMware::VIRuntime;
Opts::parse();
Opts::validate();
# connect server.
Util::connect();
# To get the perfCounterInfo.
my $perfmgr_view = Vim::get_view(mo_ref => Vim::get_service_content()->perfManager);
my $perfCounterInfo = $perfmgr_view->perfCounter;
# Column Name.
print "group" . "," . "counter" . "," . "rolleup type" . "," . "key number" . "," . "unit" . "," . "description", "\n";
# Outputs the result.
foreach(@$perfCounterInfo) {
my $rolleup_type = $_->rollupType->val;
my $groupInfo_key = $_->groupInfo->key;
my $unit = $_->unitInfo->summary;
my $unit_label = $_->unitInfo->label;
my $name_info_summary = $_->nameInfo->summary;
my $name_info_key = $_->nameInfo->key;
my $key_num = $_->key;
print $groupInfo_key . "," . $name_info_key . "," . $rolleup_type . "," . $key_num . "," . $unit . "($unit_label)" . "," . $name_info_summary, "\n";
}
# disconnect server.
Util::disconnect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment