ceph-osd-list.pl: created.
This commit is contained in:
22
ceph-osd-list.pl
Normal file
22
ceph-osd-list.pl
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
use strict;
|
||||||
|
use warnings "all";
|
||||||
|
use JSON::PP;
|
||||||
|
|
||||||
|
my $jstr = `ceph osd tree --format=json`;
|
||||||
|
|
||||||
|
my $json = decode_json $jstr;
|
||||||
|
|
||||||
|
my @nodes = @{ $json->{'nodes'} };
|
||||||
|
|
||||||
|
foreach my $node (@nodes) {
|
||||||
|
if ($node->{'type'} eq 'host') {
|
||||||
|
print "Хост: $node->{'name'}\n";
|
||||||
|
my @children = @{ $node->{'children'} };
|
||||||
|
|
||||||
|
foreach my $child (@children) {
|
||||||
|
print "Диск: osd.$child\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user