Cannot add host to icingaweb2

This forum was archived to /woltlab and is now in read-only mode.
  • Recently installed icingaweb2 and I have setup up distributed environment which consist of 2x masters 2 X satallites 1Xdb


    I have created updated my zones.conf with the relevant endpoints/zones


    so I have 4X endpoints and 2 X Zones


    I have updated constants.conf on the master and changed the Zone entry from the current hostname to "master"

    I have enabled API on all nodes and I have ran the icinga2 node wizard on all instances

    checked logs and can confirm that the nodes are added


    updated the features on all boxes


    ice-web icinga2 # icinga2 feature list

    Disabled features: compatlog debuglog gelf graphite influxdb opentsdb perfdata statusdata syslog

    Enabled features: api checker command ido-mysql livestatus mainlog notification

    ice-web icinga2 #



    I have now created a zone files and added the to ~/icinga2/zones.d/satellite1 also I have created ~/icinga2/zones.d/master

    in these Satellite1 directory I have created 5 X files commands.conf, hosts.conf, users.conf, templates.conf, services.conf


    restarted icinga2

    accessing the web frontend I can only see the database added?


    when I run:

    icinga2 object list --type Host



    I can see all the host added


    in the logs and also from the commands run but it is not showing up in the web front end ?

  • The inline screenshot shows the services, not the hosts.

    Show a screenshot of the overview/hosts menu.


    You are logged in as the icingaweb2 admin user and have all rights to all objects ?

  • this is most likely a problem with Icingaweb2 and the Database.

    Can you confirm that the DB is working correctly?

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • still a trainee, not sure if I am running the command correctly

    there was no output as below:



    ice-web conf.d # curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/hosts'

    ice-web conf.d # curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/vanilla-api-uat.linx.net'

    ice-web conf.d # curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/hosts/vanilla-api-uat.linx.net'

    ice-web conf.d # curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/hosts/vanilla-api-uat.linx.net!http'

    ice-web conf.d # curl -k -s -u root:icinga 'https://localhost:5665/v1/objects/services?joins=host'

    ice-web conf.d #

  • that is rather strange, is there no output at all? any error in the logs when you do this.

    How did you setup the API?

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • I am not sure how I can confirm if the databases is working OK attached the mysqld.err log


    2017-07-21 15:32:59 6418 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=mysqld-bin' to avoid this problem.

    2017-07-21 15:32:59 6418 [Note] InnoDB: Using atomics to ref count buffer pool pages

    2017-07-21 15:32:59 6418 [Note] InnoDB: The InnoDB memory heap is disabled

    2017-07-21 15:32:59 6418 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

    2017-07-21 15:32:59 6418 [Note] InnoDB: Memory barrier is not used

    2017-07-21 15:32:59 6418 [Note] InnoDB: Compressed tables use zlib 1.2.11

    2017-07-21 15:32:59 6418 [Note] InnoDB: Using Linux native AIO

    2017-07-21 15:32:59 6418 [Note] InnoDB: Using CPU crc32 instructions

    2017-07-21 15:32:59 6418 [Note] InnoDB: Initializing buffer pool, size = 128.0M

    2017-07-21 15:32:59 6418 [Note] InnoDB: Completed initialization of buffer pool

    2017-07-21 15:32:59 6418 [Note] InnoDB: Highest supported file format is Barracuda.

    2017-07-21 15:32:59 6418 [Note] InnoDB: 128 rollback segment(s) are active.

    2017-07-21 15:32:59 6418 [Note] InnoDB: Waiting for purge to start

    2017-07-21 15:32:59 6418 [Note] InnoDB: 5.6.35 started; log sequence number 7930125858

    2017-07-21 15:32:59 6418 [Warning] /usr/sbin/mysqld: unknown option '--loose-federated'

    2017-07-21 15:32:59 6418 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.

    2017-07-21 15:32:59 6418 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.

    2017-07-21 15:32:59 6418 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306

    2017-07-21 15:32:59 6418 [Note] - '0.0.0.0' resolves to '0.0.0.0';

    2017-07-21 15:32:59 6418 [Note] Server socket created on IP: '0.0.0.0'.

    2017-07-21 15:32:59 6418 [Note] Event Scheduler: Loaded 0 events

    2017-07-21 15:32:59 6418 [Note] /usr/sbin/mysqld: ready for connections.

    Version: '5.6.35-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Source distribution

  • the only i can add I setup the db as a satellite but i removed the db from the zones.conf file and added another instance

    Attached logs from icinga2:


    [2017-08-02 11:54:18 +0100] warning/ApiListener: Ignoring command. 'api' does not accept commands.

    [2017-08-02 11:54:47 +0100] warning/JsonRpcConnection: API client disconnected for identity 'ice-db.linx.net'

    [2017-08-02 11:55:43 +0100] information/ApiListener: New client connection for identity 'ice-db.linx.net' from [192.168.200.160]:53004 (no Endpoint object found for identity)

    [2017-08-02 11:56:47 +0100] warning/JsonRpcConnection: API client disconnected for identity 'ice-db.linx.net'

    [2017-08-02 11:57:00 +0100] information/Application: Received request to shut down.

    [2017-08-02 11:57:01 +0100] information/Application: Shutting down...

    [2017-08-02 11:57:01 +0100] information/CheckerComponent: Checker stopped.

  • can you post how your /etc/icinga2/conf.d/api-users.conf looks? That way we will atleast find out why you did not get a response from your api call

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • ice-web icinga2 # curl -k -s -u root:icinga 'https://localhost/v1/objects/hosts/vanilla-api-uat.linx.net!http'

    <!DOCTYPE html>

    <!--[if IE 8]>

    <html class="no-js ie8" lang="en"> <![endif]-->

    <!--[if gt IE 8]><!-->

    <html class="no-js" lang="en"> <!--<![endif]-->

    <head>

    <meta charset="utf-8">

    <meta name="google" value="notranslate">

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta http-equiv="cleartype" content="on">

    <title>Icinga Web</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <meta name="apple-mobile-web-app-capable" content="yes">

    <meta name="application-name" content="Icinga Web 2">

    <meta name="apple-mobile-web-app-title" content="Icinga">

    <script type="text/javascript">

    (function() {

    var html = document.getElementsByTagName('html')[0];

    html.className = html.className.replace(/no-js/, 'js');

    }());

    </script>

    <link rel="stylesheet" href="/css/icinga.min.css" media="all" type="text/css" />

    <!-- Respond.js IE8 support of media queries -->

    <!--[if lt IE 9]>

    <script src="/js/vendor/respond.min.js"></script>

    <![endif]-->

    <link type="image/png" rel="shortcut icon" href="/img/favicon.png" />

    <link rel="apple-touch-icon" href="/img/touch-icon.png">

    </head>

    <body id="body" class="loading">

    <pre id="responsive-debug"></pre>

    <div id="layout" class="default-layout">

    <div id="guest-error">

    <div class="centered-ghost">

    <div class="centered-content">

    <div id="icinga-logo" aria-hidden="true"></div>

    <div id="guest-error-message">

    <div class="content">

    <p tabindex="-1" class="autofocus error-message">Page not found.</p>

    </div>

    </div>

    </div>

    </div>

    </div>

    </div>

    <iframe id="fileupload-frame-target" name="fileupload-frame-target"></iframe>

    <!--[if IE 8]>

    <script type="text/javascript" src="/js/icinga.ie8.js"></script>

    <![endif]-->

    <!--[if gt IE 8]><!-->

    <script type="text/javascript" src="/js/icinga.min.js"></script>

    <!--<![endif]-->

    <script type="text/javascript">

    var icinga = new Icinga({

    baseUrl: ''

    });

    </script>

    </body>

    </html>

    ice-web icinga2 #

  • /**

    * The APIUser objects are used for authentication against the API.

    */

    object ApiUser "icingaweb2" {

    password = "xxxxxxxxxxxx"

    // client_cn = "ice-db"


    permissions = [ "*" ]

    }

    ice-web icinga2 #

  • try doing a curl like this:

    curl -k -s -u <ApiUSer>:<ApiPasswort> 'https://localhost:5665/v1/objects/hosts/vanilla-api-uat.linx.net!http'

    that one should work.

    The problem with your Webinterface will be next, although I can not guarantee that I will answer after 1530 today.

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • can you post how your /etc/icinga2/conf.d/api-users.conf looks? That way we will atleast find out why you did not get a response from your api call

    Better use

    Code
    1. icinga2 object list --type apiuser

    because you never know if api-users.conf is loaded :)

  • I have just restarted icinga2 and attached the logs


    [2017-08-02 13:47:57 +0100] information/LivestatusListener: Created UNIX socket in '/var/run/icinga2/cmd/livestatus'.

    [2017-08-02 13:47:57 +0100] information/JsonRpcConnection: Reconnecting to API endpoint 'ice-c.linx.net' via host 'ice-c.linx.net' and port '5665'

    [2017-08-02 13:47:57 +0100] information/ConfigItem: Activated all objects.

    [2017-08-02 13:47:57 +0100] information/ApiListener: New client connection for identity 'ice-a.linx.net' to [192.168.200.197]:5665

    [2017-08-02 13:47:57 +0100] information/ApiListener: New client connection for identity 'ice-c.linx.net' to [192.168.200.210]:5665

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending config updates for endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing configuration files for zone 'satellite1' to endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending config updates for endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing configuration files for zone 'master' to endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing configuration files for zone 'satellite1' to endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing runtime objects to endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished syncing runtime objects to endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending config updates for endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending replay log for endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending replay log for endpoint 'ice-a.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing runtime objects to endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: New client connection for identity 'ice-b.linx.net' to [192.168.200.198]:5665

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending config updates for endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing configuration files for zone 'satellite1' to endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Syncing runtime objects to endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished syncing runtime objects to endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending config updates for endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending replay log for endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending replay log for endpoint 'ice-b.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished syncing runtime objects to endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending config updates for endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/ApiListener: Sending replay log for endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] information/DbConnection: Resuming IDO connection: ido-mysql

    [2017-08-02 13:47:57 +0100] information/ApiListener: Finished sending replay log for endpoint 'ice-c.linx.net'.

    [2017-08-02 13:47:57 +0100] warning/ApiListener: Ignoring config update. 'api' does not accept config.

    [2017-08-02 13:47:57 +0100] warning/ApiListener: Ignoring config update from 'ice-c.linx.net' for object 'ice-c.linx.net!load!ice-c-1501666463-3' of type 'Downtime'. 'api' does not accept config.

    [2017-08-02 13:47:57 +0100] information/Checkable: Checking for configured notifications for object 'ice-web.linx.net!cluster'

    [2017-08-02 13:47:57 +0100] information/Checkable: Checkable 'ice-web.linx.net!cluster' does not have any notifications.

    [2017-08-02 13:47:57 +0100] information/Checkable: Checking for configured notifications for object 'ice-web.linx.net!cluster'

    [2017-08-02 13:47:57 +0100] information/Checkable: Checkable 'ice-web.linx.net!cluster' does not have any notifications.

    [2017-08-02 13:48:05 +0100] information/Checkable: Checking for configured notifications for object 'ice-web.linx.net!cluster'

    [2017-08-02 13:48:05 +0100] information/Checkable: Checkable 'ice-web.linx.net!cluster' does not have any notifications.

    [2017-08-02 13:48:43 +0100] information/ApiListener: New client connection for identity 'ice-db.linx.net' from [192.168.200.160]:54568 (no Endpoint object found for identity)

  • ice-web satellite1 # curl -k -s -u icingaweb2:6563e6c0b7a5a1e9 'https://localhost:5665/v1/objects/hosts/vanilla-api-uat.linx.net!http'

    {"error":404.0,"status":"No objects found."}ice-web satellite1 #

  • ice-web satellite1 # icinga2 object list --type apiuser

    Object 'icingaweb2' of type 'ApiUser':

    % declared in '/etc/icinga2/conf.d/api-users.conf', lines 4:1-4:27

    * __name = "icingaweb2"

    * client_cn = ""

    * name = "icingaweb2"

    * package = "_etc"

    * password = "xxxxxxxxxx"

    % = modified in '/etc/icinga2/conf.d/api-users.conf', lines 5:3-5:31

    * permissions = [ "*" ]

    % = modified in '/etc/icinga2/conf.d/api-users.conf', lines 8:3-8:23

    * templates = [ "icingaweb2" ]

    % = modified in '/etc/icinga2/conf.d/api-users.conf', lines 4:1-4:27

    * type = "ApiUser"

    * zone = ""

  • my bad the curl was wrong it should have been:

    curl -k -s -u <ApiUser>:<ApiPassword> 'https://localhost:5665/v1/objects/services/vanilla-api-uat.linx.net!http' | python -m json.tool

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • ice-web satellite1 # curl -k -s -u icingaweb2:xxxxxxxxxx 'https://localhost:5665/v1/objects/services/vanilla-api-uat.linx.net!http' | python -m json.tool

    {

    "error": 404.0,

    "status": "No objects found."

    }

    ice-web satellite1 #