Thursday, January 29, 2009

HOWTO Install SPINE engine for Cacti

HOWTO Install SPINE engine for cacti

1.- Download package
Web site: http://cacti.net/spine_download.php
Package: cacti-spine-0.8.7c.tar.gz
From console:
root@server:/var/www/noc# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7c.tar.gz
root@server:/var/www/noc# tar -xzvf cacti-spine-0.8.7c.tar.gz
root@server:/var/www/noc# mv cacti-spine-0.8.7c spine
root@server:/var/www/noc# cd spine/

2.- Prepare development environment
Be sure you have autoconf, automake and libtool to compile.
root@server:/var/www/noc# apt-get install autoconf automake libtool
root@server:/var/www/noc# apt-get install libsnmp-dev libsnmp-base libsnmp15
3.- Install Spine
Steps:
shell>aclocal
shell>libtoolize --force
shell>autoheader
shell>autoconf
shell>automake
shell>./configure
shell>make
shell>make install


a.-aclocal
root@server:/var/www/noc/spine# aclocal
/usr/share/aclocal/libmcrypt.m4:17: warning: underquoted definition of AM_PATH_LIBMCRYPT
/usr/share/aclocal/libmcrypt.m4:17: run info '(automake)Extending aclocal'
/usr/share/aclocal/libmcrypt.m4:17: or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
b.- libtoolize --force
root@server:/var/www/noc/spine# libtoolize --force
Using `AC_PROG_RANLIB' is rendered obsolete by `AC_PROG_LIBTOOL'
Putting files in AC_CONFIG_AUX_DIR, `config'.
c.- autoheader, autoconf and automake
root@server:/var/www/noc/spine# autoheader
root@server:/var/www/noc/spine#
autoconf
root@server:/var/www/noc/spine#
automake
d.- ./configure
root@server:/var/www/noc/spine# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gawk... (cached) gawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for xlf... no
checking for f77... no
checking for frt... no
checking for pgf77... no
checking for cf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for xlf90... no
checking for f90... no
checking for pgf90... no
checking for pghpf... no
checking for epcf90... no
checking for gfortran... no
checking for g95... no
checking for xlf95... no
checking for f95... no
checking for fort... no
checking for ifort... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for ranlib... (cached) ranlib
checking whether to enable -Wall... no
checking for threadsafe gethostbyname()... no
checking for gethostbyname_r in -lnls... no
checking for socket in -lsocket... no
checking for floor in -lm... yes
checking for pthread_exit in -lpthread... yes
checking for deflate in -lz... yes
checking for kstat_close in -lkstat... no
checking for CRYPTO_realloc in -lcrypto... yes
checking for ANSI C header files... (cached) yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for signal.h... (cached) yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking for netinet/in_systm.h... yes
checking for netinet/in.h... yes
checking for netinet/ip.h... yes
checking for netinet/ip_icmp.h... yes
checking for unsigned long long... yes
checking for long long... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking return type of signal handlers... void
checking for malloc... yes
checking for calloc... yes
checking for gettimeofday... yes
checking for strerror... yes
checking for strtoll... yes
checking priv.h usability... no
checking priv.h presence... no
checking for priv.h... no
checking whether we are using Solaris privileges... no
checking for mysql_init in -lmysqlclient_r... yes
checking for mysql_thread_init in -lmysqlclient_r... yes
checking if UCD-SNMP needs crypto support... no
checking if Net-SNMP needs crypto support... yes
checking for snmp_timeout in -lnetsnmp... yes
checking for the spine results buffer size... 1024 bytes
checking for the maximum simultaneous spine scripts... 20
checking for the maximum MySQL buffer size... 65536
checking whether we are using nifty popen... no
checking for glibc gethostbyname_r... yes
checking for Solaris/Irix gethostbyname_r... no
checking for HP-UX gethostbyname_r... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
e.- make
root@server:/var/www/noc/spine# make
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT sql.o -MD -MP -MF .deps/sql.Tpo -c -o sql.o sql.c
mv -f .deps/sql.Tpo .deps/sql.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT spine.o -MD -MP -MF .deps/spine.Tpo -c -o spine.o spine.c
mv -f .deps/spine.Tpo .deps/spine.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT util.o -MD -MP -MF .deps/util.Tpo -c -o util.o util.c
mv -f .deps/util.Tpo .deps/util.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT snmp.o -MD -MP -MF .deps/snmp.Tpo -c -o snmp.o snmp.c
mv -f .deps/snmp.Tpo .deps/snmp.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT locks.o -MD -MP -MF .deps/locks.Tpo -c -o locks.o locks.c
mv -f .deps/locks.Tpo .deps/locks.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT poller.o -MD -MP -MF .deps/poller.Tpo -c -o poller.o poller.c
mv -f .deps/poller.Tpo .deps/poller.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT nft_popen.o -MD -MP -MF .deps/nft_popen.Tpo -c -o nft_popen.o nft_popen.c
mv -f .deps/nft_popen.Tpo .deps/nft_popen.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT php.o -MD -MP -MF .deps/php.Tpo -c -o php.o php.c
mv -f .deps/php.Tpo .deps/php.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT ping.o -MD -MP -MF .deps/ping.Tpo -c -o ping.o ping.c
ping.c: En la función ‘init_sockaddr’:
ping.c:789: aviso: la devolución crea un entero desde un puntero sin una conversión
mv -f .deps/ping.Tpo .deps/ping.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT keywords.o -MD -MP -MF .deps/keywords.Tpo -c -o keywords.o keywords.c
mv -f .deps/keywords.Tpo .deps/keywords.Po
gcc -DHAVE_CONFIG_H -I. -I./config -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -MT error.o -MD -MP -MF .deps/error.Tpo -c -o error.o error.c
mv -f .deps/error.Tpo .deps/error.Po
/bin/sh ./libtool --tag=CC --mode=link gcc -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -L/usr/lib -L/usr/lib -o spine sql.o spine.o util.o snmp.o locks.o poller.o nft_popen.o php.o ping.o keywords.o error.o -lnetsnmp -lmysqlclient_r -lmysqlclient_r -lcrypto -lz -lpthread -lm
mkdir .libs
gcc -I/usr/include/net-snmp -I/usr/include/net-snmp/.. -I/usr/include/mysql -g -O2 -o spine sql.o spine.o util.o snmp.o locks.o poller.o nft_popen.o php.o ping.o keywords.o error.o -L/usr/lib /usr/lib/libnetsnmp.so /usr/lib/libmysqlclient_r.so -lcrypto -lz -lpthread -lm
f.- make install
root@server:/var/www/noc/spine# make install
make[1]: se ingresa al directorio `/var/www/noc/spine'
test -z "/usr/local/spine/bin" || /bin/mkdir -p "/usr/local/spine/bin"
/bin/sh ./libtool --mode=install /usr/bin/install -c 'spine' '/usr/local/spine/bin/spine'
/usr/bin/install -c spine /usr/local/spine/bin/spine
test -z "/usr/local/spine/etc" || /bin/mkdir -p "/usr/local/spine/etc"
/usr/bin/install -c -m 644 'spine.conf.dist' '/usr/local/spine/etc/spine.conf.dist'
make[1]: se sale del directorio `/var/www/noc/spine'
4.- Configure spine.conf file
Updatedb and locate spine. My case: /usr/local/spine/etc
root@server:/var/www/noc/spine# cd /usr/local/spine/etc/
root@server:/usr/local/spine/etc#
cp spine.conf.dist spine.conf
root@server:/usr/local/spine/etc#
vim spine.conf
Change from:
DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass cactiuser
DB_Port 3306

To:
DB_Host localhost
DB_Database cactidb
DB_User
cactiuser
DB_Pass
somepassword
DB_Port 3306
Remember that include/config.php is:
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "somepassword";
$database_port = "3306";

5.- Activate SPINE for cacti
This is the cacti Log before use spine (only with cmd.php)

Update spine binary location:
Console -> Settings->Paths->Alternate Poller Path->
Spine Poller File Path = /usr/local/spine/bin/spine


Change main Poller and frecuency
Console -> Settings->Poller
Poller Type = spine
Poller Interval =
every minute

Cron Interval = every 5 minutes

Cacti Log after spine setup and activation:



9 comments:

  1. Hey, thanks a bunch for this article! It helped me a ton.

    ReplyDelete
  2. Thanks. It's save me a lot of time.

    ReplyDelete
  3. Dear friend, let me know if you have some issue...

    Bye

    ReplyDelete
  4. that's great !! thanks

    ReplyDelete
  5. Thanks for the posting it was a big help. Just a quick addition. If you are doing this on Ubuntu make sure you run -

    apt-get install libmysqlclient15-dev

    if you get an error about mysql headers during the configure.

    ReplyDelete
  6. yeah!! nice post!
    thx!! =)

    ReplyDelete
  7. No such file or directory for this path: /usr/local/spine/etc/spine.conf

    What's the problem ?

    ReplyDelete
  8. Hi Walter,

    I followed your post and i am stuck on the make part.
    everything before works as you said until i hit the make command.
    It gives the following error:
    make: *** No targets specified and no makefile found. Stop.
    Knowing that in the spine directory the following 2 files exists: Makefile.am and Makefile.in.
    What am i missing ? (i am using debian 7.5)

    ReplyDelete