Skip to content

Commit 7fbea7f

Browse files
committed
Update help texts and README
1 parent 39bc084 commit 7fbea7f

File tree

5 files changed

+56
-34
lines changed

5 files changed

+56
-34
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
.idea
22
/dist/
3+
coverage.html
4+
coverage.out
35
check_elasticsearch*

README.md

+43-23
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ query.
55

66
## Usage
77

8+
```
9+
Usage:
10+
check_elasticsearch [flags]
11+
check_elasticsearch [command]
12+
13+
Available Commands:
14+
health Checks the health status of an Elasticsearch cluster
15+
query Checks the total hits/results of an Elasticsearch query
16+
17+
Flags:
18+
-H, --hostname string Hostname of the Elasticsearch instance (default "localhost")
19+
-p, --port int Port of the Elasticsearch instance (default 9200)
20+
-U, --username string Username if authentication is required
21+
-P, --password string Password if authentication is required
22+
-S, --tls Use a HTTPS connection
23+
--insecure Skip the verification of the server's TLS certificate
24+
-t, --timeout int Timeout in seconds for the CheckPlugin (default 30)
25+
-h, --help help for check_elasticsearch
26+
-v, --version version for check_elasticsearch
27+
```
28+
829
### Health
930

1031
Checks the health status of an Elasticsearch cluster.
@@ -13,26 +34,22 @@ Checks the health status of an Elasticsearch cluster.
1334
Usage:
1435
check_elasticsearch health
1536
16-
Flags:
17-
-h, --help help for health
18-
19-
Global Flags:
20-
-H, --hostname string Hostname or ip address of elasticsearch node (default "localhost")
21-
--insecure Allow use of self signed certificates when using SSL
22-
-P, --password string Password if authentication is required
23-
-p, --port int Port of elasticsearch node (default 9200)
24-
-S, --tls Use secure connection
25-
-U, --username string Username if authentication is required
37+
The cluster health status is:
38+
green = OK
39+
yellow = WARNING
40+
red = CRITICAL
2641
```
2742

28-
#### Elasticsearch cluster with green status (all nodes are running)
43+
Examples:
44+
45+
Elasticsearch cluster with green status (all nodes are running):
2946

3047
```
3148
$ check_elasticsearch health -U exampleuser -P examplepassword -S --insecure
3249
OK - Cluster es-example-cluster is green | status=0 nodes=3 data_nodes=3 active_primary_shards=10 active_shards=20
3350
```
3451

35-
#### Elasticsearch cluster with yellow status (not all nodes are running)
52+
Elasticsearch cluster with yellow status (not all nodes are running):
3653

3754
```
3855
$ check_elasticsearch health -U exampleuser -P examplepassword -S --insecure
@@ -41,31 +58,34 @@ WARNING - Cluster es-example-cluster is yellow | status=1 nodes=2 data_nodes=2 a
4158

4259
### Query
4360

44-
Checks the total hits/results of an Elasticsearch query.<br>
45-
The plugin is currently capable to return the total hits of documents based on a provided query string.
61+
Checks the total hits/results of an Elasticsearch query.
62+
63+
Hint: The plugin is currently capable to return the total hits of documents based on a provided query string.
4664

4765
```
4866
Usage:
4967
check_elasticsearch query [flags]
5068
5169
Flags:
52-
-q, --query string Elasticsearch query
53-
-I, --index string The index which will be used (default "_all")
54-
-k, --msgkey string Message of messagekey to display
55-
-m, --msglen int Number of characters to display in latest message (default 80)
56-
-w, --warning uint Warning threshold for total hits (default 20)
57-
-c, --critical uint Critical threshold for total hits (default 50)
58-
-h, --help help for query
70+
-q, --query string The Elasticsearch query
71+
-I, --index string Name of the Index which will be used (default "_all")
72+
-k, --msgkey string Message of messagekey to display
73+
-m, --msglen int Number of characters to display in the latest message (default 80)
74+
-w, --warning string Warning threshold for total hits (default "20")
75+
-c, --critical string Critical threshold for total hits (default "50")
76+
-h, --help help for query
5977
```
6078

61-
#### Search for total hits without any message
79+
Examples:
80+
81+
Search for total hits without any message:
6282

6383
```
6484
$ check_elasticsearch query -q "event.dataset:sample_web_logs and @timestamp:[now-5m TO now]" -I "kibana_sample_data_logs"
6585
CRITICAL - Total hits: 14074 | total=14074;20;50
6686
```
6787

68-
#### Search for total hits with message
88+
Search for total hits with message:
6989

7090
```
7191
$ check_elasticsearch query -q "event.dataset:sample_web_logs and @timestamp:[now-5m TO now]" -I "kibana_sample_data_logs" -k "message"

cmd/health.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ var healthCmd = &cobra.Command{
1212
Long: `Checks the health status of an Elasticsearch cluster
1313
1414
The cluster health status is:
15-
green = OK
16-
yellow = WARNING
17-
red = CRITICAL.`,
15+
green = OK
16+
yellow = WARNING
17+
red = CRITICAL`,
1818
Example: " check_elasticsearch health --hostname \"127.0.0.1\" --port 9200 --username \"exampleUser\" " +
1919
"--password \"examplePass\" --tls --insecure",
2020
Run: func(cmd *cobra.Command, args []string) {

cmd/query.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ func init() {
9191

9292
fs := queryCmd.Flags()
9393
fs.StringVarP(&cliQueryConfig.Query, "query", "q", "",
94-
"Elasticsearch query")
94+
"The Elasticsearch query")
9595
fs.StringVarP(&cliQueryConfig.Index, "index", "I", "_all",
96-
"The index which will be used ")
96+
"Name of the Index which will be used")
9797
fs.StringVarP(&cliQueryConfig.MessageKey, "msgkey", "k", "",
9898
"Message of messagekey to display")
9999
fs.IntVarP(&cliQueryConfig.MessageLen, "msglen", "m", 80,
100-
"Number of characters to display in latest message")
100+
"Number of characters to display in the latest message")
101101
fs.StringVarP(&cliQueryConfig.Warning, "warning", "w", "20",
102102
"Warning threshold for total hits")
103103
fs.StringVarP(&cliQueryConfig.Critical, "critical", "c", "50",

cmd/root.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ func init() {
4141

4242
pfs := rootCmd.PersistentFlags()
4343
pfs.StringVarP(&cliConfig.Hostname, "hostname", "H", "localhost",
44-
"Address of elasticsearch node")
44+
"Hostname of the Elasticsearch instance")
4545
pfs.IntVarP(&cliConfig.Port, "port", "p", 9200,
46-
"Port of elasticsearch node")
46+
"Port of the Elasticsearch instance")
4747
pfs.StringVarP(&cliConfig.Username, "username", "U", "",
4848
"Username if authentication is required")
4949
pfs.StringVarP(&cliConfig.Password, "password", "P", "",
5050
"Password if authentication is required")
5151
pfs.BoolVarP(&cliConfig.TLS, "tls", "S", false,
52-
"Use secure connection")
52+
"Use a HTTPS connection")
5353
pfs.BoolVar(&cliConfig.Insecure, "insecure", false,
54-
"Allow use of self signed certificates when using SSL")
54+
"Skip the verification of the server's TLS certificate")
5555
pfs.IntVarP(&Timeout, "timeout", "t", Timeout,
56-
"Timeout for the check")
56+
"Timeout in seconds for the CheckPlugin")
5757

5858
rootCmd.Flags().SortFlags = false
5959
pfs.SortFlags = false

0 commit comments

Comments
 (0)