集群健康检查api

[elk@node01 ~]$ curl  http://192.168.137.2:9200/_cat/health?v
epoch      timestamp cluster    status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 
1496001824 04:03:44  es_cluster yellow          1         1     38  38    0    0       33             0                  -                 53.5% 


[elk@node01 api]$ cat a1.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/health?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 a1.pl 
epoch      timestamp cluster    status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 
1496002292 04:11:32  es_cluster yellow          1         1     38  38    0    0       33             0                  -                 53.5% 
[elk@node01 api]$ 

原文地址:https://www.cnblogs.com/hzcya1995/p/13349698.html