Centreon: add a poller PDF Print E-mail
Saturday, 18 February 2012 22:42

Steps to take (some are very specific for me):

  • make sure ndo2db  is working on the central poller
  • install and configure nagios on a satellite
  • synchronize/add plugins images and mib files on this satellite

    rsync -avu /usr/local/nagios/libexec/360viewpoint/
    nagios@{IP_ADDRESS_SATELLITE}:/usr/local/nagios/libexec/360viewpoint
    rsync -avu /usr/local/nagios/share/images/ nagios@
    {IP_ADDRESS_SATELLITE}:/usr/local/nagios/share/images
    rsync -avu /usr/share/snmp/mibs/ root
    @{IP_ADDRESS_SATELLITE}:/usr/share/snmp/mibs

  • on the satellite copy the created x86 plugins from libexec to 360viewpoint directory (only when plugins copied from Centreon server are 64_x86 bit and you run on x86)

    /bin/cp /usr/local/nagios/libexec/check* /usr/local/nagios/libexec/360viewpoint
     
  • In Centreon add a satellite: configuration > centreon
  • In Centreon add the satellite as a host and add services
  • In Centreon add ndomod confg file for satellite: configuration > centreon > ndomod.cfg

    instance_name=poller01
    output_type=tcpsocket
    output=10.0.2.19
    tcp_port=5669
    output_buffer_items=5000
    file_rotation_interval=14400
    file_rotation_timeout=60
    reconnect_interval=15
    reconnect_warning_interval=900
    data_processing_options=-1
    config_output_options=3

  • On Centreon make sure file /var/lib/centreon/centreon.cmd is writable by nagios and apache:

    chown nagios:nagcmd /var/lib/centreon

  • On Centreon generate ssh key file:

    su - nagios
    ssh-keygen
    ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@{
    IP_ADDRESS_SATELLITE}
    ssh {IP_ADDRESS}
    exit
    exit
  • On satellite configure sudo (using visudo) in order to allow the central server to manage the Nagios daemon on the satellite monitor

    nagios ALL=NOPASSWD: /etc/init.d/nagios restart
    nagios ALL=NOPASSWD: /etc/init.d/nagios stop
    nagios ALL=NOPASSWD: /etc/init.d/nagios start
    nagios ALL=NOPASSWD: /etc/init.d/nagios reload
    nagios ALL=NOPASSWD: /usr/sbin/nagiostats
    nagios ALL=NOPASSWD: /usr/sbin/nagios *  

  • On satellite download, Compile and Install NDOMOD

    cd /tmp
    wget http://sourceforge.net/projects/nagios/files/ndoutils-1.x/ndoutils-1.4b9/ndoutils-1.4b9.tar.gz/download
    tar xvzf ndoutils-1.4b9.tar.gz
    cd ndoutils-1.4b9
    ./configure --codefix=/usr/local/nagios/ --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
    make
    cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
    chmod 774 /usr/local/nagios/bin/ndo*
    chown nagios:nagios /usr/local/nagios/bin/ndo*
    cp config/ndo* /usr/local/nagios/etc/

  • In Centreon go and activate configuration of the Central Poller and the Satellite.
    Check logs on satellite:

    # tail -f /usr/local/nagios/var/nagios.log
    [1329614509] Nagios 3.3.1 starting... (PID=12125) [1329614509] Local time is Sun Feb 19 02:21:49 CET 2012 [1329614509] LOG VERSION: 2.0
    [1329614509] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
    [1329614509] ndomod: Successfully connected to data sink. 0 queued items to flush.
    [1329614509] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
    [1329614509] Finished daemonizing... (New PID=12126)

    Check logs on Centreon:

    # tail -f /usr/local/centreon/log/centcore.log

    24/2/2012 11:57:44 - Start: Send config files on poller 2
    24/2/2012 11:57:44 - End: Send config files on poller 2
    24/2/2012 11:57:44 - Start: Send Centreon Broker config files on poller 2
    24/2/2012 11:57:44 - End: Send Centreon Broker config files on poller 2
    24/2/2012 11:57:45 - Init Script : 'sudo /etc/init.d/nagios restart' On poller xxx.xxx.xxx.xxx (2)
    24/2/2012 11:57:45 - NAGIOS : Running configuration check...done.
    24/2/2012 11:57:45 - NAGIOS : Stopping nagios: done.
    24/2/2012 11:57:45 - NAGIOS : Starting nagios: done.

  • On the satellite (because of a centreon bug?):

    mkdir /usr/local/nagios/etc/serviceext/
    chown nagios:nagcmd /usr/local/nagios/etc/serviceext/
  • On the satellite (depending on the configuration of the poller in Centreon):

    mkdir /etc/centreon-broker
    chown root:nagios /etc/centreon-broker
    chmod 775 /etc/centreon-broker


    mkdir -p /etc/centreon/broker
    chown -R root:nagios /etc/centreon
    chmod -R 775 /etc/centreon


  • On the satellite (because centcore dumps the files in the serviceext directory and not etc

    /etc/init.d/nagios
    NagiosCfgFile=${prefix}/etc/nagios.cfg
    to
    NagiosCfgFile=${prefix}/etc/serviceext/nagios.cfg
  • Create a blank starting webpage on the root of the webserver.
    touch /var/www/html/index.html
  • Install CPAN module to prevent error with plugins like:
    #perl -MCPAN -e shell
    cpan> install Bundle::CPAN
    cpan[1]> reload cpan
    cpan[1]> reload index
    cpan[1]> install Net::SNMP
    cpan[1]> install Getopt::Long
    cpan[1]> install Config::IniFiles

  • Create SSH tunnel for NDO traffic actions on Satellite
    On Satellite as root:

    ssh-keygen
    ssh-copy-id -i /root/.ssh/id_rsa.pub nagios@{IP_ADDRESS_CENTREON}
    ssh nagios@{IP_ADDRESS_CENTREON}
    yum -y install autossh

    Make sure the ndomod.cfg is configured to connect to 127.0.0.1 in stead of {IP_ADDRESS_CENTREON}

    Add the following lines to /etc/ssh/ssh_config:

    Host poller01
            Hostname {IP_ADDRESS_CENTREON}
            User nagios
            CheckHostIP no
            LocalForward 5669 127.0.0.1:5669
            #LocalForward 514 127.0.0.1:514
            Compression yes
     

    As root on the Centreon server:

    yum -y install autossh

    Add the following lines to /etc/ssh/ssh_config:

    Host poller01
            Hostname {IP_ADDRESS_CENTREON}
            User nagios
            CheckHostIP no
            LocalForward 5669 127.0.0.1:5669
            #LocalForward 514 127.0.0.1:514
            Compression yes


    Start tunnel:
    autossh -N poller01& ->> ???? does not work yet, figuring this out

    autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L 5669:localhost:5669 nagios@{IP_ADDRESS_CENTREON}


    Check Nagios log file:

    [1329910951] ndomod: NDOMOD 1.4b9 (10-27-2009) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
    [1329910951] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
    [1329910951] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
    [1329910951] Warning: Service 'CPU' on host '360viewpoint_poll01' has no notification time period defined!
    [1329910951] Warning: Service 'HTTP' on host '360viewpoint_poll01' has no notification time period defined!
    [1329910951] Finished daemonizing... (New PID=27511)
    [1329911863] ndomod: Still unable to connect to data sink.  162 items lost, 5000 queued items to flush.
    [1329912775] ndomod: Still unable to connect to data sink.  4869 items lost, 5000 queued items to flush.
    [1329912855] ndomod: Successfully connected to data sink.  5281 items lost, 5000 queued items to flush.
    [1329912855] ndomod: Successfully flushed 5000 queued items to data sink.

    # ps ax | grep ssh | grep -v grep
     1570 ?        Ss     0:20 /usr/sbin/sshd
    21905 ?        Ss     0:00 sshd: nagios [priv]
    21907 ?        S      0:00 sshd: nagios
    22271 ?        Ss     0:00 sshd: nagios [priv]
    22273 ?        S      0:00 sshd: nagios
    29128 ?        S      0:00 /usr/bin/ssh -q -N -o ServerAliveInterval 60 -o ServerAliveCountMax 3 -L 11111:localhost:5669 nagios@
    {IP_ADDRESS_CENTREON}
    30492 ?        Ss     0:00 sshd: root@pts/0

Troubleshooting SSH

killall ssh

[1329915500] ndomod: Error writing to data sink!  Some output may get lost...
[1329915500] ndomod: Please check remote ndo2db log, database connection or SSL Parameters

autossh -M 0 -q -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -L 11111:localhost:5669 nagios@{IP_ADDRESS_CENTREON}

ps ax | grep ssh | grep -v grep
31288 ?        Ss     0:00 autossh -M 0 -q    -N -o ServerAliveInterval 60 -o ServerAliveCountMax 3 -L 11111:localhost:5669 nagios@{IP_ADDRESS_CENTREON}
31289 ?        S      0:00 /usr/bin/ssh -q -N -o ServerAliveInterval 60 -o ServerAliveCountMax 3 -L 11111:localhost:5669 nagios@{IP_ADDRESS_CENTREON}

[1329915516] ndomod: Successfully reconnected to data sink!  0 items lost, 91 queued items to flush.
[1329915516] ndomod: Successfully flushed 91 queued items to data sink.
 

That's it I hope.

 

Add comment


Security code
Refresh

More KB Articles