opts, args = parser.parse_args() if args: parser.error("Does not accept any argument.") # connection parameters port = opts.port hostname = opts.hostname or '' scheme = opts.scheme debug = opts.debug 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("--------------")
if opts.node_id is None: parser.error("You must speciffy a node id.") node_id = opts.node_id # Try to get numeic warning/critical values s_warning = opts.warning or DEFAULT_WARNING s_critical = opts.critical or DEFAULT_CRITICAL 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("--------------")
#sampling parameters sample_interval = opts.sample_interval max_sample = opts.max_sample # Try to get numeic warning/critical values s_warning = opts.warning or DEFAULT_WARNING s_critical = opts.critical or DEFAULT_CRITICAL 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("--------------")