Icinga2 doesn't start after enable API

  • Hi,

    After enabling feature API I can't start icinga2.

    I don't change any API configuration file and get the error in object ApiListener. This a new Icinga2 installation. Did anyone have the same problem or can help to solve?


    ➜ ~ icinga2 --version

    icinga2 - The Icinga 2 network monitoring daemon (version: v2.6.3)


    Copyright (c) 2012-2017 Icinga Development Team (https://www.icinga.com/)

    License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>

    This is free software: you are free to change and redistribute it.

    There is NO WARRANTY, to the extent permitted by law.


    Application information:

    Installation root: /usr

    Sysconf directory: /etc

    Run directory: /run

    Local state directory: /var

    Package data directory: /usr/share/icinga2

    State path: /var/lib/icinga2/icinga2.state

    Modified attributes path: /var/lib/icinga2/modified-attributes.conf

    Objects path: /var/cache/icinga2/icinga2.debug

    Vars path: /var/cache/icinga2/icinga2.vars

    PID path: /run/icinga2/icinga2.pid


    System information:

    Platform: CentOS Linux

    Platform version: 7 (Core)

    Kernel: Linux

    Kernel version: 3.10.0-514.26.2.el7.x86_64

    Architecture: x86_64


    Build information:

    Compiler: GNU 4.8.5

    Build host: unknown



    ➜ ~ icinga2 feature enable api

    Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.

    ➜ ~ systemctl restart icinga2.service

    Job for icinga2.service failed because the control process exited with error code. See "systemctl status icinga2.service" and "journalctl -xe" for details.

    ➜ ~ systemctl status icinga2.service -l

    ● icinga2.service - Icinga host/service/network monitoring system

    Loaded: loaded (/etc/systemd/system/icinga2.service; enabled; vendor preset: disabled)

    Active: failed (Result: exit-code) since Sa 2017-07-15 18:51:00 CEST; 14s ago

    Process: 41716 ExecStart=/usr/sbin/icinga2 daemon -d -e ${ICINGA2_ERROR_LOG} --no-stack-rlimit (code=exited, status=1/FAILURE)

    Process: 41654 ExecStartPre=/usr/lib/icinga2/prepare-dirs /etc/sysconfig/icinga2 (code=exited, status=0/SUCCESS)

    Main PID: 37126 (code=exited, status=0/SUCCESS)


    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: /etc/icinga2/features-enabled/api.conf(4):

    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: /etc/icinga2/features-enabled/api.conf(5): object ApiListener "api" {

    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: ^^^^^^^^^^^^^^^^^^^^^^^^

    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: /etc/icinga2/features-enabled/api.conf(6): cert_path = SysconfDir + "/icinga2/pki/" + NodeName + ".crt"

    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: /etc/icinga2/features-enabled/api.conf(7): key_path = SysconfDir + "/icinga2/pki/" + NodeName + ".key"

    Jul 15 18:51:00 dev-icinga.localdomain icinga2[41716]: [2017-07-15 18:51:00 +0200] critical/config: 1 error

    Jul 15 18:51:00 dev-icinga.localdomain systemd[1]: icinga2.service: control process exited, code=exited status=1

    Jul 15 18:51:00 dev-icinga.localdomain systemd[1]: Failed to start Icinga host/service/network monitoring system.

    Jul 15 18:51:00 dev-icinga.localdomain systemd[1]: Unit icinga2.service entered failed state.

    Jul 15 18:51:00 dev-icinga.localdomain systemd[1]: icinga2.service failed.


    Regards,
    Andy.

  • I solved the problem. Before enabling API the module must be setup with:

    icinga2 api setup

    Thanks for your help.