From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- .../application/clicommands/NrpeCommand.php | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 modules/monitoring/application/clicommands/NrpeCommand.php (limited to 'modules/monitoring/application/clicommands/NrpeCommand.php') diff --git a/modules/monitoring/application/clicommands/NrpeCommand.php b/modules/monitoring/application/clicommands/NrpeCommand.php new file mode 100644 index 0000000..fe82322 --- /dev/null +++ b/modules/monitoring/application/clicommands/NrpeCommand.php @@ -0,0 +1,58 @@ + [--ssl] [nrpe options] + * + * EXAMPLE + * + * icingacli monitoring nrpe 127.0.0.1 CheckMEM --ssl --MaxWarn=80% \ + * --MaxCrit=90% --type=physical + */ + public function checkAction() + { + $host = $this->params->shift(); + if (! $host) { + echo $this->showUsage(); + exit(3); + } + $command = $this->params->shift(null, '_NRPE_CHECK'); + $port = $this->params->shift('port', 5666); + try { + $nrpe = new Connection($host, $port); + if ($this->params->shift('ssl')) { + $nrpe->useSsl(); + } + $args = array(); + foreach ($this->params->getParams() as $k => $v) { + $args[] = $k . '=' . $v; + } + echo $nrpe->sendCommand($command, $args) . "\n"; + exit($nrpe->getLastReturnCode()); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + exit(3); + } + } +} -- cgit v1.2.3