Skip to content

Formatted README #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ build/
dist/
venv/
nagios_elasticsearch.egg-info/
*.egg*
*.pyc
5 changes: 4 additions & 1 deletion .travis.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ python:
- 2.7

install:
- pip install -r requirements.txt --use-mirrors
- pip install -r requirements.txt

before_script:
- "pep8 ."

script:
- python setup.py test

20 changes: 10 additions & 10 deletions README.rst → README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#Nagios-ElasticSearch
# Nagios-ElasticSearch

A few simple scripts for checking the state of your [ElasticSearch] cluster using Nagios the endpoints of ElasticSearch

[![Build
Status](https://secure.travis-ci.org/opentable/nagios-elasticsearch.png)](https://secure.travis-ci.org/opentable/nagios-elasticsearch.png)
Status](https://travis-ci.org/192dot/nagios-elasticsearch.svg?branch=master)](https://travis-ci.org/192dot/nagios-elasticsearch.svg?branch=master)

##How they work
## How they work

These plugins work by submitting API requests to a local or remote
ElasticSearch server via the [cluster-health] and [node stats] endpoints

###Check Nodes in Cluster
### Check Nodes in Cluster

This can be used to specify the nodes that are expected in the cluster. Currently, the check will return as **CRITICAL** if there are any unaccounted for nodes

Expand All @@ -29,7 +29,7 @@ Options:
python check_es_nodes.py --host=myescluster.com --expected_nodes_in_cluster=13
```

###Check Cluster Health Status
### Check Cluster Health Status

This plugin can be used to get the current cluster health. This will return OK for Green, Warning for Yellow and Critical for Red.

Expand All @@ -47,7 +47,7 @@ Options:
python check_es_cluster_status.py --host=myescluster.com
```

###Check for Unassigned Nodes in Cluster
### Check for Unassigned Nodes in Cluster

This plugin can be used to check for unassigned shards in the cluster. This can potentially indicate that a node is missing from the cluster. The alert will currently indicate a CRITICAL error if an unassigned shard is found

Expand All @@ -65,7 +65,7 @@ Options:
python check_es_unassigned_shards.py --host=myescluster.com
```

###Check Node JVM Usage
### Check Node JVM Usage

This plugin can be used to ensure that the nodes in the cluster are not approaching, or exceeding, the thresholds that we determine that the JVM needs to run at. Currently, if any of the nodes exceed the critical limt, then the cluster will throw a CRITICAL error. If no nodes exceed the critical threshold but a node exceeds the warning threshold, then the cluster will throw a WARNING.

Expand All @@ -89,11 +89,11 @@ Options:
python check_es_unassigned_shards.py --host=myescluster.com
```

###Installation
### Installation

###Development
### Development

###License
### License
This project is licensed under MIT

[cluster-health]: http://www.elasticsearch.org/guide/reference/api/admin-cluster-health.html
Expand Down
3 changes: 2 additions & 1 deletion check_es_cluster_status.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def check(self, opts, args):
cluster_status = es_cluster_health['status'].lower()

if cluster_status == 'red':
raise Status("CRITICAL", "Cluster status is currently reporting as "
raise Status("CRITICAL",
"Cluster status is currently reporting as "
"Red")
elif cluster_status == 'yellow':
raise Status("WARNING", "Cluster status is currently reporting as "
Expand Down
5 changes: 3 additions & 2 deletions check_es_nodes.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ def check(self, opts, args):
"reporting as '%s' but we expected '%s'"
% (active_cluster_nodes, nodes_in_cluster))
else:
raise Status('OK', "Number of nodes in the cluster is '%s'"
"which is >= %s as expected" % (active_cluster_nodes, nodes_in_cluster))
raise Status('OK', "Number of nodes in the cluster is '%s'"
"which is >= %s as expected" % (active_cluster_nodes,
nodes_in_cluster))

if __name__ == "__main__":
ESNodesCheck().run()
18 changes: 9 additions & 9 deletions check_es_split_brain.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def check(self, opts, args):

if len(responding_nodes) == 0:
raise Status('Unknown',
"All cluster nodes unresponsive:\r\n"
"%s" % (str("\r\n".join(failed_nodes))))
"All cluster nodes unresponsive:\r\n"
"%s" % (str("\r\n".join(failed_nodes))))
elif len(masters) != 1:
raise Status('Critical', "%d masters (%s) found in %s cluster"
% (len(masters),
Expand All @@ -59,14 +59,14 @@ def check(self, opts, args):
else:
if len(failed_nodes) == 0:
raise Status('OK', "%d/%d nodes have same master"
% (len(responding_nodes), len(nodes)))
% (len(responding_nodes), len(nodes)))
else:
raise Status('OK', "%d/%d nodes have same master\r\n"
"%d unresponsive nodes:\r\n%s"
% (len(responding_nodes),
len(nodes),
len(failed_nodes),
str("\r\n".join(failed_nodes))))
raise Status('Warning', "%d/%d nodes have same master\r\n""
"%d unresponsive nodes:\r\n%s"
% (len(responding_nodes),
len(nodes),
len(failed_nodes),
str("\r\n".join(failed_nodes))))

if __name__ == "__main__":
ESSplitBrainCheck().run()
1 change: 1 addition & 0 deletions requirements.txt
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nagioscheck==0.1.6
pep8==1.7.0
3 changes: 1 addition & 2 deletions setup.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ def parse_requirements(filename):
setup(
name="nagios-elasticsearch",
description="A selection of Nagios plugins to monitor ElasticSearch.",
long_description=open('README.rst').read(),
long_description=open('README.md').read(),
version="0.1.4",
packages=find_packages(),
author='Paul Stack',
author_email='[email protected]',
url="https://github.com/stack72/nagios-elasticsearch",
download_url='http://github.com/stack72/nagios-elasticsearch/tarball/0.1.4',
scripts=["check_es_nodes.py",
"check_es_cluster_status.py",
"check_es_jvm_usage.py",
Expand Down