Add command audit
This commit is contained in:
parent
424f687f5d
commit
7f21e14afc
|
@ -3,6 +3,7 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\Command\Transport;
|
||||
|
||||
use Icinga\Application\Hook\AuditHook;
|
||||
use Icinga\Application\Logger;
|
||||
use Icinga\Exception\Json\JsonDecodeException;
|
||||
use Icinga\Module\Monitoring\Command\IcingaApiCommand;
|
||||
|
@ -196,6 +197,18 @@ class ApiCommandTransport implements CommandTransportInterface
|
|||
$this->getPort()
|
||||
);
|
||||
|
||||
$data = $command->getData();
|
||||
$payload = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$payload[] = "$key=$value";
|
||||
}
|
||||
$payload = implode(', ', $payload);
|
||||
AuditHook::logActivity(
|
||||
'monitoring/command',
|
||||
"Issued command {$command->getEndpoint()} with the following payload: $payload",
|
||||
$data
|
||||
);
|
||||
|
||||
try {
|
||||
$response = RestRequest::post($this->getUriFor($command->getEndpoint()))
|
||||
->authenticateWith($this->getUsername(), $this->getPassword())
|
||||
|
|
Loading…
Reference in New Issue