Skip to content

Commit

Permalink
added documentation for usestdin,delim and added in the ability to de…
Browse files Browse the repository at this point in the history
…fine the delimeter (#17) -BH
  • Loading branch information
hedenface committed Dec 21, 2017
1 parent 99b54d5 commit 49edaa3
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@
------------------
- Added rudimentary debugging to nrdp plugins (#27) -BH
- Added ability to receive JSON check results (#23) -Box293 (Troy)
- Added documentation for --usestdin and --delim (#17) -BH
- Added ability to specify a delimiter when using stdin (#17) -BH

1.4.0 - 01/06/2017
------------------
13 changes: 10 additions & 3 deletions clients/send_nrdp.php
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ function doit()
// Use read from stdin
if ($usestdin != "") {
while ($buf = rtrim(fgets(STDIN), "\n")) {
$parts = explode("\t", $buf);
$parts = explode($delim, $buf);
$fields = count($parts);

// Host check
@@ -181,7 +181,7 @@ function doit()
function check_args($args)
{
global $argv;
global $url, $token, $host, $service, $state, $output, $type, $checktype, $usestdin;
global $url, $token, $host, $service, $state, $output, $type, $checktype, $usestdin, $delim;

$error = false;

@@ -194,6 +194,7 @@ function check_args($args)
$state = grab_array_var($args, "state");
$output = html_entity_decode(grab_array_var($args, "output"), ENT_QUOTES);
$usestdin = grab_array_var($args, "usestdin");
$delim = grab_array_var($args, "delim", "\t");

if ($service != "") {
$type = "service";
@@ -210,14 +211,20 @@ function check_args($args)
echo "Portions Copyright (c) others - see source code\n";
echo "License: BSD\n";
echo "\n";
echo "Usage: ".$argv[0]." --url=<url> --token=<token> --host=<hostname> [--service=<servicename>] --state=<state> --output=<output>\n";
echo "Usage: ".$argv[0]." --url=<url> --token=<token> --host=<hostname> [--service=<servicename>] --state=<state> --output=<output> [--usestdin] [--delim=\\t]\n";
echo "\n";
echo " <url> = The URL used to access the remote NRDP agent.\n";
echo " <token> = The secret token used to access the remote NRDP agent.\n";
echo " <hostname> = The name of the host associated with the passive host/service check result.\n";
echo " <servicename> = For service checks, the name of the service associated with the passive check result.\n";
echo " <state> = An integer indicating the current state of the host or service.\n";
echo " <output> = Text output to be sent as the passive check result. Newlines should be encoded with encoded newlines (\\n).\n";
echo " <usestdin> = Accept check result data from STDIN instead of --host,--service,--state,--output flags\n";
echo " Each line contains a check result in the format of:\n";
echo " host[DELIM]state[DELIM]output[DELIM]\n";
echo " or\n";
echo " host[DELIM]service[DELIM]state[DELIM]output[DELIM]\n";
echo " <delim> = The delimeter (DELIM above) to use when processing from STDIN. The default is \\t (TAB)\n";
echo "\n";
echo "Send a passive host or service check result to a remote Nagios instance using the NRDP agent.\n";
exit(1);

0 comments on commit 49edaa3

Please sign in to comment.