Results 1 to 1 of 1

Thread: Mongodb inconsistencies when polling data

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    1

    Question Mongodb inconsistencies when polling data

    Greetings.

    I will post this in 'General Discussion' because I did not found a proper category.

    I have been working with Shinken for a year, but only used the web interface for both check and configure alerts, until now that I need to create a report of our current configuration, this report includes details like alert/host name, check_command, contacts for example, and doing this manually from the web page is a daunting task, so I created some scripts.

    I created a script to pull data from mongo collections, as I can see in the arbiter web page, the data (checks in this case) is being pulled from two sources, syncui and nagios-cfg-file.

    The arbiter UI shows 576 checks configured, but when I query the collections directly, it shows me the following:
    ---- Checking collection: data-syncui-host ----
    839
    ---- Checking collection: data-cfg-file-nagios-host ----
    346
    --- TOTAL ----------
    1185

    1185 != 576 as shown in the UI.

    I am also considering the templates ( when a mongo document have the option: register => 0 ) and I am excluding them, even if I include the templates, the numbers do not match with the checks and template numbers shown in the UI.

    So my concern is, how to pull data from the Shinken collections, if the arbiter UI says I have 576 checks from both syncui and nagios-cfg-file, why the mongo collections shows me other numbers as shown above.

    Also I ran the same script to pull data from the collections 'data-syncui-host' and 'data-cfg-file-nagios-host' and it not return the same values after two executions, how this is possible? Also nobody was adding things in Shinken, so the numbers should be equal after several script executions.

    [shinken@server01]$ ./miner.sh hosts host_collections.txt
    ---- Checking collection: data-syncui-host ----
    231
    ---- Checking collection: data-cfg-file-nagios-host ----
    346
    --- TOTAL ----------
    577
    [shinken@server01]$ ./miner.sh hosts host_collections.txt
    ---- Checking collection: data-syncui-host ----
    176
    ---- Checking collection: data-cfg-file-nagios-host ----
    346
    --- TOTAL ----------
    522
    [shinken@server01]$ ./miner.sh hosts host_collections.txt
    ---- Checking collection: data-syncui-host ----
    787
    ---- Checking collection: data-cfg-file-nagios-host ----
    346
    --- TOTAL ----------
    1133
    [shinken@server01]$ ./miner.sh hosts host_collections.txt
    ---- Checking collection: data-syncui-host ----
    96
    ---- Checking collection: data-cfg-file-nagios-host ----
    346
    --- TOTAL ----------
    442

    [shinken@server01]$ cat host_collections.txt
    data-syncui-host
    data-cfg-file-nagios-host


    Basically the 'host' parameter is to create a folder to send the results, and the second one is the file listing the collections I need to check.

    Also I do not understand why in the host collection I can find macros and templates, this should not be in separate configurations?

    Could someone explain to me the logic behind this please?
    Or if you guys known about a tool/script to gather this info and create a report I will really appreciate it.

    Thansk.
    Last edited by jc5666; 11-23-2017 at 09:33 PM. Reason: New input added from the mongo queries

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •