Skip to content

Commit

Permalink
help: use fixed column size
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Oct 25, 2024
1 parent 5af6b94 commit 81ffd3b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
4 changes: 3 additions & 1 deletion docs/checks/plugins/check_dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ Application Options:
-p, --port= Port number you want to use (default: 53)
-q, --querytype= DNS record query type (default: A)
--norec Set not recursive mode
-e, --expected-string= IP-ADDRESS string you expect the DNS server to return. If multiple IP-ADDRESS are returned at once, you have to specify whole string
-e, --expected-string= IP-ADDRESS string you expect the DNS server to return.
If multiple IP-ADDRESS are returned at once, you have
to specify whole string
Help Options:
-h, --help Show this help message
Expand Down
18 changes: 12 additions & 6 deletions docs/checks/plugins/check_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ Naemon Config
Application Options:
--timeout= Timeout to wait for connection (default: 10s)
--max-buffer-size= Max buffer size to read response body (default: 1MB)
--no-discard raise error when the response body is larger then max-buffer-size
--consecutive= number of consecutive successful requests required (default: 1)
--interim= interval time after successful request for consecutive mode (default: 1s)
--max-buffer-size= Max buffer size to read response body
(default: 1MB)
--no-discard raise error when the response body is larger
then max-buffer-size
--consecutive= number of consecutive successful requests
required (default: 1)
--interim= interval time after successful request for
consecutive mode (default: 1s)
--wait-for retry until successful when enabled
--wait-for-interval= retry interval (default: 2s)
--wait-for-max= time to wait for success
Expand All @@ -70,11 +74,13 @@ Application Options:
-p, --port= Port number
-j, --method= Set HTTP Method (default: GET)
-u, --uri= URI to request (default: /)
-e, --expect= Comma-delimited list of expected HTTP response status
-e, --expect= Comma-delimited list of expected HTTP
response status
-s, --string= String to expect in the content
--base64-string= Base64 Encoded string to expect the content
-A, --useragent= UserAgent to be sent (default: check_http)
-a, --authorization= username:password on sites with basic authentication
-a, --authorization= username:password on sites with basic
authentication
-S, --ssl use https
--sni enable SNI
--tls-max=[1.0|1.1|1.2|1.3] maximum supported TLS version
Expand Down
29 changes: 21 additions & 8 deletions docs/checks/plugins/check_tcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,31 @@ Application Options:
-p, --port= Port number
-s, --send= String to send to the server
-e, --expect-pattern= Regexp pattern to expect in server response
-q, --quit= String to send server to initiate a clean close of the connection
-q, --quit= String to send server to initiate a clean close
of the connection
-S, --ssl Use SSL for the connection.
-U, --unix-sock= Unix Domain Socket
--no-check-certificate Do not check certificate
-t, --timeout= Seconds before connection times out (default: 10)
-m, --maxbytes= Close connection once more than this number of bytes are received
-d, --delay= Seconds to wait between sending string and polling for response
-w, --warning= Response time to result in warning status (seconds)
-c, --critical= Response time to result in critical status (seconds)
-E, --escape Can use \n, \r, \t or \ in send or quit string. Must come before send or quit option. By default, nothing added to send, \r\n added to end of quit
-W, --error-warning Set the error level to warning when exiting with unexpected error (default: critical). In the case of request succeeded, evaluation result of -c option eval takes priority.
-C, --expect-closed Verify that the port/unixsock is closed. If the port/unixsock is closed, OK; if open, follow the ErrWarning flag. This option only verifies the connection.
-m, --maxbytes= Close connection once more than this number of
bytes are received
-d, --delay= Seconds to wait between sending string and
polling for response
-w, --warning= Response time to result in warning status
(seconds)
-c, --critical= Response time to result in critical status
(seconds)
-E, --escape Can use \n, \r, \t or \ in send or quit string.
Must come before send or quit option. By default,
nothing added to send, \r\n added to end of quit
-W, --error-warning Set the error level to warning when exiting with
unexpected error (default: critical). In the case
of request succeeded, evaluation result of -c
option eval takes priority.
-C, --expect-closed Verify that the port/unixsock is closed. If the
port/unixsock is closed, OK; if open, follow the
ErrWarning flag. This option only verifies the
connection.
Help Options:
-h, --help Show this help message
Expand Down
4 changes: 4 additions & 0 deletions pkg/snclient/builtin_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"fmt"
"io"
"os"
"regexp"
"strings"
)
Expand Down Expand Up @@ -72,6 +73,9 @@ func (l *CheckBuiltin) Check(ctx context.Context, snc *Agent, check *CheckData,
}

func (l *CheckBuiltin) Help(ctx context.Context, snc *Agent, check *CheckData, format ShowHelp) (out string) {
// use fixed size when printing help pages
os.Setenv("COLS", "80")

check.rawArgs = []string{"--help"}
res, _ := l.Check(ctx, snc, check, []Argument{})

Expand Down

0 comments on commit 81ffd3b

Please sign in to comment.