[elk@node01 api]$ curl http://192.168.137.2:9200/_cat/nodes?v
host ip heap.percent ram.percent load node.role master name
192.168.137.2 192.168.137.2 13 64 0.00 d * node01
[elk@node01 api]$ cat a2.pl
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");
my $host = "http://192.168.137.2:9200/_cat/nodes?v";
my $response = $ua->get($host);
$ua->default_headers;
if ($response->is_success) {
print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
}
[elk@node01 api]$ perl a2.pl
host ip heap.percent ram.percent load node.role master name
192.168.137.2 192.168.137.2 8 65 0.00 d * node01