User Tools

Site Tools


can_t_send_external_icinga_command

Server error: Can't send external Icinga command (icinga2.cmd)

Problema al ejecutar un comando en Icinga.

Server error: Can't send external Icinga command "[1428775441] SCHEDULE_SVC_CHECK;busimint;apt;1428779037" to the local command file "/var/run/icinga2/cmd/icinga2.cmd": exception 'RuntimeException' with message 'SplFileObject::__construct(/var/run/icinga2/cmd/icinga2.cmd): failed to open stream: Permission denied' in /usr/share/icingaweb2/library/Icinga/Util/File.php:39
Can't send external Icinga command "[1428775441] SCHEDULE_SVC_CHECK;busimint;apt;1428779037" to the local command file "/var/run/icinga2/cmd/icinga2.cmd": exception 'RuntimeException' with message 'SplFileObject::__construct(/var/run/icinga2/cmd/icinga2.cmd): failed to open stream: Permission denied' in /usr/share/icingaweb2/library/Icinga/Util/File.php:39
Stack trace:
#0 /usr/share/icingaweb2/library/Icinga/Util/File.php(39): SplFileObject->__construct('/var/run/icinga...', 'wn', false)
#1 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Command/Transport/LocalCommandFile.php(122): Icinga\Util\File->__construct('/var/run/icinga...', 'wn')
#2 /usr/share/icingaweb2/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php(84): Icinga\Module\Monitoring\Command\Transport\LocalCommandFile->send(Object(Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand))
#3 /usr/share/icingaweb2/modules/monitoring/application/forms/Command/Object/ScheduleServiceCheckCommandForm.php(97): Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm->scheduleCheck(Object(Icinga\Module\Monitoring\Command\Object\ScheduleServiceCheckCommand), Object(Icinga\Web\Request))
#4 /usr/share/icingaweb2/library/Icinga/Web/Form.php(844): Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm->onSuccess()
#5 /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Web/Controller/MonitoredObjectController.php(112): Icinga\Web\Form->handleRequest()
#6 /usr/share/icingaweb2/modules/monitoring/application/controllers/ServiceController.php(73): Icinga\Module\Monitoring\Web\Controller\MonitoredObjectController->handleCommandForm(Object(Icinga\Module\Monitoring\Forms\Command\Object\ScheduleServiceCheckCommandForm))
#7 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Monitoring_ServiceController->rescheduleCheckAction()
#8 /usr/share/icingaweb2/library/vendor/Zend/Controller/Dispatcher/Standard.php(303): Zend_Controller_Action->dispatch('rescheduleCheck...')
#9 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Zend_Controller_Dispatcher_Standard->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#10 /usr/share/icingaweb2/library/Icinga/Application/Web.php(154): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#11 /usr/share/icingaweb2/library/Icinga/Application/webrouter.php(111): Icinga\Application\Web->dispatch()
#12 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/icin...')
#13 {main}

Solución: Activar el uso de comandos para que los Frameworks web puedan utilizarlos, la no activación de esta propiedad suele ser la causa más común. Antes de ello se debe comprobar que la ruta y permisos están correctamente configurados (puede ser la otra causa del problema).

cat /etc/icingaweb2/modules/monitoring/instances.ini
 
[icinga]
transport           = "local"
path                = "/var/run/icinga2/cmd/icinga2.cmd"
 
ls -ltd /var/run/icinga2/cmd/
drwx--s--- 2 nagios www-data 60 abr 11 20:14 /var/run/icinga2/cmd/
icinga2 feature enable command
service icinga2 restart
can_t_send_external_icinga_command.txt · Last modified: 2020/12/25 22:57 by 127.0.0.1