首先先弄清楚nsca是嘛玩意,请参考http://beginlinux.com/blog/2009/09/,个人觉得已经很详细介绍了NSCA的工作原理,以及很基础的配置和使用。

这里只是简单记录下,妹纸在根据客户需要进行配置时遇到的问题,以及解决思路:

  1. 在configure源码包是,出现错误:

    checking for libmcrypt-config... no
    checking for libmcrypt - version >= 2.4.11... no
    *** Could not run libmcrypt test program, checking why...
    *** The test program failed to compile or link. See the file config.log for the
    *** exact error that occured. This usually means LIBMCRYPT was incorrectly installed
    *** or that you have moved LIBMCRYPT since it was installed. In the latter case, you
    *** may want to edit the libmcrypt-config script: no

    错误在于libmcrypt和libcrypt-devel包可能没有安装,或者安装后没有正确配置。如果忽略改错误,那么加密功能将无法使用。妹纸两个都遇到了,说说如何解决。

    a. 对应没有安装,直接下包安装即可。注意两个包都是必须的,因为configure过程中会使用libcrypt-config这个命令。该命令包含在libcrypt-devel中。

    b. 对于没有正确配置,情况如下,

    #rpm -ql libmcrypt-devel
    /usr/bin/libmcrypt-config
    /usr/include/mcrypt.h
    /usr/include/mutils
    /usr/include/mutils/mcrypt.h
    /usr/lib64/libmcrypt.so
    可以看到所有的可执行文件和lib文件存放的位置,但是这些配置没有配置到相关文件或命令,因此nsca在配置时找不到。解决方法有二:

    添加新的配置文件,指明lib存放位置,重新加载(貌似作用不大,建议使用第二种)

    # vi /etc/ld.so.conf.d/libmcrypt.conf

    /usr/lib64

    /usr

    /usr/include

    #ldconfig

    #make devclean

    重新configure

    或者在#./configure --with-mcrypt-lib=/usr/lib64/ --with-libmcrypt-prefix=/usr/ 中直接指定lib的存放位置。

  2. 在编译好了,使用过程中,出现文件。client端发送包出去一切OK, 但是server端服务检查状态没有改变,怀疑在传送过程中出现问题。于是检查两边/var/log/message。在server端看到如下错误:

    nsca[17075]: Dropping packet with invalid CRC32 - possibly due to client using wrong password or crypto algorithm?

    检查配置文件没有错误,网上检索发现可能是server端和client端包的版本不一致。检查发现果然版本不对!!果断重新来过。