2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #414 from tsaavik/master

Updated to work without using deprecated hadoop command and allows setting of hadoop admin user via plugin-conf
This commit is contained in:
Steve Schnepp 2014-01-02 03:45:27 -08:00
commit a30e9ddcc9

View File

@ -9,17 +9,26 @@
# Symlink this file to hadoop_hdfs_block or hadoop_hdfs_capacity to get block # Symlink this file to hadoop_hdfs_block or hadoop_hdfs_capacity to get block
# or capacity informations about the DFS. # or capacity informations about the DFS.
# #
#
# Needs following minimal configuration in plugin-conf.d/munin-node:
# [hadoop_hdfs_block]
# user hdfs
#
# [hadoop_hdfs_capacity]
# user hdfs
#
# Author: KARASZI Istvan <muninexchange@spam.raszi.hu> # Author: KARASZI Istvan <muninexchange@spam.raszi.hu>
# #
use strict; use strict;
use File::Basename qw(basename); use File::Basename qw(basename);
use Munin::Plugin;
my $type = &getType($0);
# #
# main # main
# #
my $type = &getType($0);
if ($ARGV[0]) { if ($ARGV[0]) {
if ($ARGV[0] eq "autoconf") { if ($ARGV[0] eq "autoconf") {
print "yes\n"; print "yes\n";
@ -95,9 +104,12 @@ sub getCapacity {
} }
sub getStatistics { sub getStatistics {
open(DFSADMIN, "hadoop dfsadmin -report|") || die("Cannot open dfsadmin: $!"); open(DFSADMIN, "hdfs dfsadmin -report|") || die("Cannot open dfsadmin: $!");
while(defined(my $line = <DFSADMIN>)) { while(defined(my $line = <DFSADMIN>)) {
chomp($line); chomp($line);
if ($line =~ /-------------------------------------------------/) {
last
}
if ($type eq "block") { if ($type eq "block") {
&getBlock($line); &getBlock($line);