2014年2月5日 星期三

[研究] JFFNMS 0.9.4 網路監控 安裝 (CentOS 6.5 x64)

[研究] JFFNMS 0.9.4 網路監控 安裝 (CentOS 6.5 x64)

2014-02-05

Just For Fun Network Management System (JFFNMS)
http://www.jffnms.org/

JFFNMS能監控標準的SNMP (Simple Network Management Protocol) 網絡設備,服務器、路由器和TCP端口。它工作在Linux, FreeBSD 和Windows 2000/XP。

下載
http://www.jffnms.org/downloads/
http://sourceforge.net/projects/jffnms/files/JFFNMS%20Releases/
http://sourceforge.net/projects/jffnms/files/JFFNMS%20Releases/jffnms-0.9.4.tgz/download
0.9.4 版為 2014-02-03 釋出

安裝參考
http://sourceforge.net/apps/mediawiki/jffnms/index.php?title=Linux_Installation
http://sourceforge.net/apps/mediawiki/jffnms/index.php?title=Installation

安裝

yum -y install gcc httpd mysql rrdtool php php-mysql mysql-server net-snmp tftp syslog  nmap  diffutils diffstat rrdtool php-sockets php-snmp php-gd php-mysql php-wddx php-pcre
# yum -y install postgresql postgresql-server
chmod +s /usr/bin/nmap
chmod a+x /usr/bin/nmap

# fping : The latest version is 2.4b2_to-ipv6 (16-Jan-2002).
wget http://fping.sourceforge.net/download/fping.tar.gz
tar zxvf fping.tar.gz
cd fping-2.4b2_to
./configure
make
make install
cd ..
cp /usr/local/sbin/fping  /usr/sbin/fping
chmod +s /usr/local/sbin/fping
chmod a+x /usr/local/sbin/fping
chmod +s /usr/sbin/fping
chmod a+x /usr/sbin/fping
   
# 修改 /etc/php.ini 內容
#    register_globals = On
#    register_argc_argv = On
#    error_reporting  =  E_ALL & ~E_NOTICE
#    allow_url_fopen = On
#    include_path = .:/usr/share/pear
#    short_open_tag = On
   
cp  /etc/php.ini  /etc/php.ini.old

sed -i -e "s@register_globals = Off@register_globals = On@" /etc/php.ini
sed -i -e "s@register_argc_argv = Off@register_argc_argv = On@" /etc/php.ini
sed -i -e "s@error_reporting = E_ALL \& ~E_DEPRECATED@error_reporting  =  E_ALL \& ~E_NOTICE@" /etc/php.ini
sed -i -e "s@allow_url_fopen = Off@allow_url_fopen = On@" /etc/php.ini
sed -i -e "s@;include_path = \".:\/php\/includes\"@include_path = \".:\/php\/includes\"@" /etc/php.ini
sed -i -e "s@short_open_tag = Off@short_open_tag = On@" /etc/php.ini

cat /etc/php.ini | grep register_globals
cat /etc/php.ini | grep register_argc_argv
cat /etc/php.ini | grep error_reporting
cat /etc/php.ini | grep allow_url_fopen
cat /etc/php.ini | grep include_path
cat /etc/php.ini | grep short_open_tag

service httpd restart
    
wget http://sourceforge.net/projects/jffnms/files/JFFNMS%20Releases/jffnms-0.9.4.tgz/download
tar xvzf jffnms-0.9.4.tgz -C  /opt
mv /opt/jffnms-0.9.4 /opt/jffnms

#First, create the new JFFNMS user:
 # groupadd jffnms
 # useradd -g jffnms -d /opt/jffnms -s /bin/false -c 'JFFNMS User' jffnms
 # usermod -G jffnms www-data

groupadd jffnms
useradd -g jffnms -d /opt/jffnms -s /bin/false -c 'JFFNMS User' jffnms
usermod -G jffnms apache

#Log files, RRD files and TFTP files are written by engines, but the webserver needs to read them.
# chown jffnms www-data /opt/jffnms/logs /opt/jffnms/rrd /opt/jffnms/tftp
# chmod 2755 /opt/jffnms/logs /opt/jffnms/rrd /opt/jffnms/tftp

chown jffnms:apache  /opt/jffnms/logs /opt/jffnms/rrd /opt/jffnms/tftpd
chmod 2755 /opt/jffnms/logs /opt/jffnms/rrd /opt/jffnms/tftpd

#Configuration files need to be temporarily writeable by the webserver and readable by engines.
# chown www-data jffnms /opt/jffnms/conf
# chmod 2755 /opt/jffnms/conf

chown apache:jffnms /opt/jffnms/conf
chmod 2755 /opt/jffnms/conf

#The image temporary directory needs to be writable by the webserver.
# chown www-data www-data /opt/jffnms/images/temp
# chmod 0755 /opt/jffnms/images/temp

mkdir -p /opt/jffnms/images/temp
chown apache:apache /opt/jffnms/images/temp
chmod 0755 /opt/jffnms/images/temp

#Temporary engine directory, despite its name, needs to be writable by both the engines and webserver
# chown jffnms www-data /opt/jffnms/engine/temp
# chmod 0775 /opt/jffnms/engine/temp

chown jffnms:apache /opt/jffnms/engine/temp
chmod 0775 /opt/jffnms/engine/temp

#chown -R jffnms:jffnms /opt/jffnms
#chmod 770 /opt/jffnms
#chmod -R ug+rw /opt/jffnms

# 修改 crontab
#Install the JFFNMS crontab file
# crontab -u jffnms /opt/jffnms/docs/unix/crontab

#Now modify the values at the top if they don't match your system:
# crontab -e -u jffnms

#Allow JFFNMS to run cron jobs (AFAIK only needed in Solaris)
# echo jffnms >> /etc/cron.allow

crontab -u jffnms /opt/jffnms/docs/unix/crontab
#crontab -e -u jffnms
echo jffnms >> /etc/cron.allow

# 建立資料庫
# mysql -u <mysql admin username> -p<password>
# mysql> CREATE DATABASE jffnms;
# mysql> GRANT ALL PRIVILEGES ON jffnms.* TO jffnms@localhost IDENTIFIED BY 'jffnms';
# mysql> FLUSH PRIVILEGES;
# mysql> quit
# mysql -u jffnms -pjffnms jffnms < docs/install/jffnms-0.9.4.mysql

service mysqld restart
mysql -e "create database jffnms; "
mysql -e "GRANT ALL PRIVILEGES ON jffnms.* TO jffnms@localhost IDENTIFIED BY 'jffnms';"
mysql -e "flush privileges; "
mysql -ujffnms -pjffnms jffnms < /opt/jffnms/docs/install/jffnms-0.9.4.mysql
# check
mysql -ujffnms -pjffnms -e "use jffnms; show databases; "
mysql -ujffnms -pjffnms -e "use jffnms; show tables;"

#-----------------------------------------
# 或使用 PostgreSQL 資料庫 (Shell Script 寫法待研究)
#    PostgreSQL:
#    ===========
#   # psql template1 postgres
#   template1=# create user jffnms password 'jffnms' createdb;
#   template1=# \connect template1 jffnms
#   template1=# create database jffnms;
#   template1=# \q
#  
#   # psql jffnms jffnms < docs/install/jffnms-0.9.4.pgsql
 
##su - postgres -c " /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data  & "
##su - postgres -c "createdb -U postgres -E UNICODE opennms"

#echo "create user jffnms password 'jffnms' createdb;" | su - postgres -c "/usr/bin/psql template1"
#echo "create database jffnms;" | su - postgres -c "/usr/bin/psql -U jffnms"
#-----------------------------------------

# 修改 Apache Web Server 設定 /etc/httpd/conf/httpd.conf
#Virtual Host
#<VirtualHost *>
# ServerName nms.example.com
# ServerAdmin webmaster@example.com
# DocumentRoot /opt/jffnms/htdocs
# LimitRequestLine 20000
# <Directory /opt/jffnms/htdocs >
#  Options Indexes FollowSymLinks Multiviews
# </Directory>
#</VirtualHost>
#Use Alias directives within the virtual host if you want to move some of the sub-directories around. For example, if you want your temporary images to be put in a directory /var/lib/jffnms/tempimages, put the following line in the Apache configuration:
# Alias /jffnms/images/temp/ /var/lib/jffnms/tempimages/

echo "<VirtualHost *>" >> /etc/httpd/conf/httpd.conf
#echo " ServerName nms.example.com" >> /etc/httpd/conf/httpd.conf
#echo " ServerAdmin webmaster@example.com" >> /etc/httpd/conf/httpd.conf
echo " DocumentRoot /opt/jffnms/htdocs" >> /etc/httpd/conf/httpd.conf
echo " LimitRequestLine 20000" >> /etc/httpd/conf/httpd.conf
echo " <Directory /opt/jffnms/htdocs >" >> /etc/httpd/conf/httpd.conf
echo "  Options Indexes FollowSymLinks Multiviews" >> /etc/httpd/conf/httpd.conf
echo " </Directory>" >> /etc/httpd/conf/httpd.conf
echo "</VirtualHost>" >> /etc/httpd/conf/httpd.conf
echo " Alias /jffnms/images/temp/ /var/lib/jffnms/tempimages/" >> /etc/httpd/conf/httpd.conf

#ln -s /opt/jffnms/htdocs /var/www/html/jffnms

service httpd restart
chkconfig httpd on
service mysqld restart
chkconfig mysqld on
# service postgresql restart
yum  -y install  xinetd  
service xinetd restart
chkconfig xinetd on

firefox http://localhost/jffnms &


執行
chown   -R   apache:apaceh    /opt/jffnms
ln -s /opt/jffnms/htdocs /var/www/html/jffnms 
看看







(問題待研究....)

相關

[研究] JFFNMS 0.9.1 網路監控 安裝 (CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20292

十大優秀開源網絡管理工具
http://forum.icst.org.tw/phpbb/viewtopic.php?t=16080


1 則留言:

  1. Hi 拜讀您的文章,竟然也得到相同的結果,請問您有解了嗎?

    回覆刪除