+# Since OpenVZ is container based, all guests see all the host's CPUs,
+# and would report the same data. So we disable CPU by default.
+my $enable_interface = 1;
+my $enable_cpu = 0;
+my $enable_df = 1;
+my $enable_load = 1;
+my $enable_processes = 1;
+my $enable_users = 1;
+
+sub interface_read($$) {
+ my $veid = shift;
+ my $name = shift;
+ my ($key, $val, @lines, @parts, @counters);
+ my @if_instances = ('if_octets', 'if_packets', 'if_errors');
+ my %v = _build_report_hash($name);
+
+ $v{'plugin'} = 'interface';
+ delete $v{'plugin_instance'};
+
+ @lines = split(/\n/, `$vzctl exec $veid cat /proc/net/dev`);
+ foreach (@lines) {
+ next if (!/:/);
+
+ @parts = split(/:/);
+ ($key = $parts[0]) =~ s/^\s*(.*?)\s*$/$1/;
+ ($val = $parts[1]) =~ s/^\s*(.*?)\s*$/$1/;
+ @counters = split(/ +/, $val);
+
+ $v{'type_instance'} = $key;
+ for ($key = 0; $key <= $#if_instances; ++$key) {
+ $v{'type'} = $if_instances[$key];
+ $v{'values'} = [ $counters[$key], $counters[$key + 8] ];
+ plugin_dispatch_values(\%v);
+ }
+}
+}