Skip to content

Instantly share code, notes, and snippets.

@silviot
Last active February 16, 2016 12:38
Show Gist options
  • Save silviot/abd8b6624023a1b1c479 to your computer and use it in GitHub Desktop.
Save silviot/abd8b6624023a1b1c479 to your computer and use it in GitHub Desktop.
Elasticsearch zabbix External check script
#!/bin/bash
HOST=$1
METRIC=$2
if [ "x$HOST" = "x" ] || [ "x$METRIC" = "x" ]; then
exit 1
fi
curl "http://$HOST:9200/_cluster/health?format=yaml&pretty=1" 2> /dev/null | grep $METRIC | cut -f2 -d ' ' | sed -e 's/"//g'
exit 0
# Example of output from curl:
# ---
# cluster_name: "daclusta"
# status: "green"
# timed_out: false
# number_of_nodes: 152
# number_of_data_nodes: 140
# active_primary_shards: 1342
# active_shards: 4621
# relocating_shards: 0
# initializing_shards: 0
# unassigned_shards: 0
# delayed_unassigned_shards: 0
# number_of_pending_tasks: 0
# number_of_in_flight_fetch: 0
# task_max_waiting_in_queue_millis: 0
# active_shards_percent_as_number: 100.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment