For monitoring Elasticsearch health status scripts in Nagios

Source: Internet
Author: User

A script for monitoring the Elasticsearch index was found in the Nagios community, and then modified to use the listening IP that is normally used for incoming elasticsearch for using a script that monitors the Elasticsearch health state in Nagios

#!/bin/bash#check_elasticsearch_health.sh#memo for nagios outputsstate_ok=0state_warning=1state _critical=2state_unknown=3#position parameter judgmentif [ $# -lt 1 ];then     echo  "Please enter host address"     echo  "Ex> $0 host_address"     exit  $STATE _unknownfiif [ $# -gt  1 ]; then        echo  "The input host  address are too much "    echo " Ex> $0 localhost "     exit  $STATE _unknownfitype curl >/dev/null 2>&1 | |  { echo >&2  "This plugin require curl but it ' S not  installed. ";  exit  $STATE _unknown; } #检查是否有安装curlHOST =$1status=$ (curl -s  $HOST: 9200/_cluster/health ? pretty | grep status | awk  ' {print $3} '  | cut -d\ " -f2) # Single-node health detection, usually can monitor the content according to need to modify the API to get the corresponding value if [[  $STATUS  &&  "$STATUS"  !=  "green"  ]]; thenecho  "critical - status is  $STATUS" exit  $STATE _criticalfiif  [[  "$STATUS"  ==  "green"  ]]; thenecho  "ok - status is $ STATUS "exit  $STATE _okfiecho " unknow - no data were returned by  elastisearch on host  $HOST "exit  $STATE _unknown


This article from "Jim's Technical Essay" blog, declined to reprint!

For monitoring Elasticsearch health status scripts in Nagios

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.