Linux/net-snmp+PHP

net-snmpとPHP

バージョン

  • PHP 5.2.6
  • net-snmp 5.1.4

net-snmpのバージョンを最新の5.4.2.1をインストールすると、 下記のエラーでPHPのコンフィグが通らない

configure: error: SNMP sanity check failed. Please check config.log for more information.

net-snmp

http://www.net-snmp.org/

ここからソースをダウンロード

# tar zxvf net-snmp-5.1.4.2.tar.gz
# cd net-snmp-5.1.4.2
#./configure \
--with-mib-modules=ucd-"snmp/diskio ucd_snmp" \
--enable-shared --enable-ucd-snmp-compatibility \
--with-openssl=/usr/local/ssl --sysconfdir=/etc
# make
# make install

# mkdir /etc/snmp
# cp EXAMPLE.conf /etc/snmp/snmpd.conf

snmpd起動スクリプト

# vi /etc/init.d/snmpd

#!/bin/bash

# ucd-snmp init file for snmpd
#
# chkconfig: 345 50 50
# description: Simple Network Management Protocol (SNMP) Daemon
#
# processname: /usr/local/sbin/snmpd
# config: /usr/local/share/snmp/snmpd.conf
# pidfile: /var/run/snmpd
# securlevel: 10

# source function library
. /etc/rc.d/init.d/functions

OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd -a"
RETVAL=0
prog="snmpd"

start() {
        echo -n $"Starting $prog: "
        daemon /usr/local/sbin/snmpd $OPTIONS
        RETVAL=$?
        echo
        touch /var/lock/subsys/snmpd
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc /usr/local/sbin/snmpd
        RETVAL=$?
        echo
        rm -f /var/lock/subsys/snmpd
        return $RETVAL
}

reload(){
        stop
        start
}

restart(){
        stop
        start
}

condrestart(){
    [ -e /var/lock/subsys/snmpd ] && restart
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  condrestart)
        condrestart
        ;;
  status)
        status snmpd
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
        RETVAL=1
esac

exit $RETVAL

PHP

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--enable-cli \
--enable-pear \
--with-tsrm-pth \
--with-gd --with-zlib \
--with-freetype-dir=/usr/local \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--enable-force-cgi-redirect \
--enable-mbstring \
--enable-mbstr-enc-trans \
--enable-trans-sid \
--enable-versioning \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-sockets \
--with-snmp=/usr/local