ndo2fs安装

I described the concept of ndo2fs in another article before. In this article I’ll show you the steps I made to get a working installation of ndo2fs. These are the preparing steps to use NagVis on basis of ndo2fs.
Note: I recommend ndo2fs for all users who use �C or want to use �C the ndo only for NagVis purposes. If you don’t need any historical information in your ndo database (e.g. for reporting or SLA analyzing) you should give ndo2fs a try. It’s a lightweight and stable alternative to the NDO on MySQL basis.
There are four main things you need to start with ndo2fs:
  • Running and configured Nagios (See Nagios.org for howtos)
  • ndoutils from Nagios.org
  • current ndo2fs version from git repository
  • Perl with module JSON::XS
I’ll now explain the setup process on my Ubuntu 8.10. I did all the following steps with super user privileges. Use sudo -s to switch in Ubuntu.
If you already have running ndomod.o with ndo2db you can skip the first part (Building the ndoutils) and just continue with changing the configuration of your ndomod.cfg as described at the end of section 1.
  1. Build and configure Nagios and ndomod.o

    The ndomod.o is the broker module which docks on the Nagios core to proceed the data to the ndo2fs daemon.
    Change to working directory
    mkdir -p /tmp/work
    cd /tmp/work
    Get ndoutils from sourceforge:
    wget http://ovh.dl.sourceforge.net/sourceforge/nagios/ndoutils-1.4b7.tar.gz
    Unpack
    tar xvzf ndoutils-1.4b7.tar.gz
    cd ndoutils-1.4b7
    Configure and build (I assume you have build utils)
    ./configure --disable-mysql --disable-pgsql
    make
    Note: Maybe there are some error messages due configure about some missing mysql devel packages. It doesn’t mater whether you have mysql-devel or not, you won’t need it for compiling ndomod.o.
    The file ndomod-<nagios-version>.o (I use Nagios 3) should be located in src/ directory. Move it to your nagios/bin folder.
    mv src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
    Then move the sample ndomod.cfg to your Nagios cfg directory
    mv config/ndomod.cfg /usr/local/nagios/etc
    Fix file permissions, change owner and permissions as you prefer.
    chmod 755 /usr/local/nagios/bin/ndomod.o
    chown nagios:nagios /usr/local/nagios/bin/ndomod.o
    chmod 644 /usr/local/nagios/etc/ndomod.cfg
    chown nagios:nagios /usr/local/nagios/etc/ndomod.cfg
    Go to your Nagios configuration and configure your Nagios to talk with the ndomod.o broker module. Check your configuration for the following parameters and alter them or add the following lines to your nagios.cfg
    vi /usr/local/nagios/etc/nagios.cfg
    event_broker_options=-1
    broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
    Then change your configuration of ndomod.o
    vi /usr/local/nagios/etc/ndomod.cfg
    I like to use the default data processing way of ndo2fs on TCP port 5668. You need to set or change the following options:
    output_type=tcpsocket
    output=127.0.0.1
    tcp_port=5668
    data_processing_options=32259009
    We just configured Nagios to push events to TCP port 5668 on 127.0.0.1 by ndomod.o. We also limited the data which Nagios is pushing to reduce the overhead of information which are not handled by ndo2fs.
  2. The ndo2fs part

    I export the current revision of ndo2fs from git. I only do this because there is no tag with the new init script included yet.
    cd /tmp/work
    wget 'http://git.nagiosprojects.org/?p=ndo2fs.git;a=snapshot;h=0a3eef6fe289562af69391ca4f04ec95399d3cec;sf=tgz' -O ndo2fs-0.1.14.tar.gz
    Unpack
    tar xvzf ndo2fs-*.tar.gz
    cd ndo2fs*
    Move ndo2fs script to Nagios bin directory
    mv ndo2fs /usr/local/nagios/bin
    Fix the permissions again
    chmod 755 /usr/local/nagios/bin/ndo2fs
    chown nagios:nagios /usr/local/nagios/bin/ndo2fs
    Now you need to move and enable the init script
    mv init/ndo2fs /etc/init.d
    chown root:root /etc/init.d/ndo2fs
    chmod 755 /etc/init.d/ndo2fs
    update-rc.d ndo2fs defaults
    Before you can start using ndo2fs you need a perl JSON parser module called JSON::XS. In Ubuntu you can get it by
    apt-get install libjson-xs-perl
    There are some other ways to get the module on other operating systems. Try cpan or load it manually. The cpan command is:
    perl -MCPAN -e install JSON::XS
    Now you can start ndo2fs
    /etc/init.d/ndo2fs start
    To get the complete Nagios information faster through ndo2fs you can restart your Nagios daemon.
    /etc/init.d/nagios restart
When you got here without any trouble and have no data processing errors in your nagios logfile ( /usr/local/nagios/var/nagios.log) and a the complete ndo2fs data structure at /tmp/ndo2fs. ndo2fs is now ready to use with e.g. NagVis.
Advanced Hint: If you like to use ndo2fs parallel to your current ndo2db you can modify your ndo2fs script in /usr/local/nagios/bin/ndo2fs to forward all information to the ndo2db daemon. Just have a look at and change the following options:

你可能感兴趣的:(职场,perl,休闲,ndo2fs)