try: #get stats stats = ElasticSearchStatsHelpers.node_statistics( scheme=scheme, hostname=hostname, port=port, node_id=node_id, debug=debug ) if debug: pprint(stats) #Get stats disk_io_op_temp = ElasticSearchStatsEvalHelpers.get_disk_io_op(stats) disk_io_op = disk_io_op_temp/8388608 if debug: print("Total disko io op") print("--------------") print(disk_io_op) print("--------------") #check logic status = 'OK' comment='within the limits' disk_io_op_comment_tempalte="Disk IOps {c} {v}Mb/s" disk_io_op_message_template="{s}: {m}" if disk_io_op >= s_warning: status = 'Warning'
try: #get stats stats = ElasticSearchStatsHelpers.sampled_cluster_statistics( scheme=scheme, hostname=hostname, port=port, sample_interval=sample_interval, nb_sample=max_sample, debug=debug ) if debug: pprint(stats) #Get stats nb_docs_sample = ElasticSearchStatsEvalHelpers.filter_nb_indexed_docs(stats) if debug: print("NB docs Sample") print("--------------") print(nb_docs_sample) print("--------------") #Process data measurement_time = max_sample * sample_interval first = nb_docs_sample[0] last = nb_docs_sample[-1] nb_docs_diff = last - first #check logic status = 'OK' nb_docs_message = "{l} docs indexed in {t}s ".format(
try: #get stats stats = ElasticSearchStatsHelpers.cluster_statistics( scheme=scheme, hostname=hostname, port=port, debug=debug ) if debug: print(stats) #Get stats cluster_status = ElasticSearchStatsEvalHelpers.get_cluster_status(stats) if debug: print("cluster status") print("--------------") print(cluster_status) print("--------------") #check logic status = 'OK' comment='green, super green' cluster_status_template="cluster status is {c} " if cluster_status != 'green': status = 'Critical' comment = 'not green'
try: #get stats stats = ElasticSearchStatsHelpers.node_statistics( scheme=scheme, hostname=hostname, port=port, node_id=node_id, debug=debug ) if debug: pprint(stats) #Get stats percentage_heap_used = ElasticSearchStatsEvalHelpers.get_heap_used_percent(stats) if debug: print("Percentage heap used") print("--------------") print(percentage_heap_used) print("--------------") #check logic status = 'OK' comment='within the limits' heap_used_comment_tempalte="Heap usage is {c} {v}%" heap_used_message_template="{s}: {m}" if percentage_heap_used >= s_warning: status = 'Warning' comment='too high'