lnmp-zabbix
1 wget http://down1.chinaunix.net/distfiles/freetype-2.4.7.tar.bz2 2 tar -jxvf freetype-2.4.7.tar.bz2 3 cd freetype-2.4.7 4 ./configure --prefix=/usr/local/freetype 5 make 6 make install
echo "####################### Install libxml2-2.9.1 #############"
1 wget http://xmlsoft.org/sources/libxml2-2.9.1.tar.gz 2 tar -zxf libxml2-2.9.1.tar.gz 3 cd libxml2-2.9.1 4 rpm -qa | grep python-devel 5 yum install python-devel 6 make 7 make install
1 #wget http://downloads.sourceforge.net/project/libpng/libpng16/1.6.9/libpng-1.6.9.tar.gz 2 wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.21.tar.gz 3 tar -zxf libpng-1.6.21.tar.gz 4 cd libpng-1.6.21 5 ./configure --prefix=/usr/local/libpng 6 make 7 make install
echo "################## libiconv ##########"
1 wget http://down1.chinaunix.net/distfiles/libiconv-1.14.tar.gz 2 tar -zxf libiconv-1.14.tar.gz 3 cd libiconv-1.14 4 ./configure–prefix=/usr/local/iconv 5 make 6 make install
echo "############ jpegsrc ###########333"
1 wgethttp://www.ijg.org/files/jpegsrc.v9a.tar.gz 2 tar -zxf jpegsrc.v9a.tar.gz 3 cd jpeg-9a/ 4 mkdir -p /usr/local/jpeg 5 mkdir -p /usr/local/jpeg/include 6 mkdir -p /usr/local/jpeg/sibn 7 mkdir -p /usr/local/jpeg/lib 8 mkdir -p /usr/local/jpeg/man/man1 9 ./configure --prefix=/usr/local/jpeg/ 10 make 11 make install
echo "############# libmcrypt ##############
1 wget https://vps.googlecode.com/files/libmcrypt-2.5.8.tar.gz 2 3 tar -zxf libmcrypt-2.5.7.tar.gz 4 cd libmcrypt-2.5.7 5 ./configure --prefix=/usr/local/libmcrypt/ 6 make 7 make install 8 ln -s /usr/local/libmcrypt/lib/libmcrypt.la /usr/lib/libmcrypt.la 9 ln -s /usr/local/libmcrypt/lib/libmcrypt.so /usr/lib/libmcrypt.so 10 ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 11 ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4.4.7 /usr/lib/libmcrypt.so.4.4.7
echo "################# mhash ############# "
1 wget http://softlayer-ams.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2 2 tar -zxf mhash-0.9.9.tar.gz 3 cd mhash-0.9.9 4 ./configure 5 make 6 make install
echo "############ mcrypt ###############"
#wget https://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz wget http://down1.chinaunix.net/distfiles/mcrypt-2.6.4.tar.gz tar -zxf mcrypt-2.6.4.tar.gz cd mcrypt-2.6.4 ln -s /usr/local/libmcrypt/bin/libmcrypt-config /usr/bin/libmcrypt-config export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH make make install 8)
echo "############ zlib ########"
1 wget http://iweb.dl.sourceforge.net/project/libpng/zlib/1.2.8/zlib-1.2.8.tar.gz 2 tar -zxf zlib-1.2.8.tar.gz 3 cd zlib-1.2.8 4 ./configure 5 make 6 make install
echo "############### libgd ##########"
1 yum -y install libXpm-devel 2 tar -zxf libgd-2.1.0.tar.gz 3 cd libgd-2.1.0 4 ./configure --prefix=/usr/local/gd --with-png=/usr/local/libpng/ --with-zlib --with-jpeg=/usr/local/jpeg/ --with-freetype=/usr/local/freetype/ --with-xpm 5 make 6 make install
echo "############# pcre ##########"
1 tar -zxf pcre-8.34.tar.gz 2 cd pcre-8.34 3 ./configure --prefix=/usr/local/pcre 4 make 5 make install
echo "############# Nginx ###########"
1 wget http://nginx.org/download/nginx-1.5.10.tar.gz 2 tar -zxf nginx-1.5.10.tar.gz 3 cd nginx-1.5.10 4 groupadd www 5 useradd www -g www 6 ulimit -SHn 65535
7 yum install gd-devel*
1 ./configure --user=www \ 2 --group=www \ 3 --prefix=/usr/local/nginx \ 4 --with-http_stub_status_module \ 5 --with-http_ssl_module \ 6 --with-pcre=/home/download/lnmp-zabbix/pcre-8.34 \ 7 --with-http_realip_module \ 8 --with-http_image_filter_module
make
make install
1 user www; 2 worker_processes 1; 3 4 #error_log logs/error.log; 5 #error_log logs/error.log notice; 6 #error_log logs/error.log info; 7 8 #pid logs/nginx.pid; 9 10 11 events { 12 worker_connections 1024; 13 } 14 15 16 http { 17 include mime.types; 18 default_type application/octet-stream; 19 20 #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 21 # '$status $body_bytes_sent "$http_referer" ' 22 # '"$http_user_agent" "$http_x_forwarded_for"'; 23 24 #access_log logs/access.log main; 25 26 sendfile on; 27 #tcp_nopush on; 28 29 #keepalive_timeout 0; 30 keepalive_timeout 65; 31 32 #gzip on; 33 34 server { 35 listen 80; 36 server_name localhost; 37 38 #charset koi8-r; 39 40 #access_log logs/host.access.log main; 41 42 location / { 43 root html; 44 index index.html index.htm; 45 } 46 47 #error_page 404 /404.html; 48 49 # redirect server error pages to the static page /50x.html 50 # 51 error_page 500 502 503 504 /50x.html; 52 location = /50x.html { 53 root html; 54 } 55 56 # proxy the PHP scripts to Apache listening on 127.0.0.1:80 57 # 58 #location ~ \.php$ { 59 # proxy_pass http://127.0.0.1; 60 #} 61 62 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 63 # 64 location ~ \.php$ { 65 root html; 66 fastcgi_pass 127.0.0.1:9000; 67 fastcgi_index index.php; 68 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 69 include fastcgi_params; 70 } 71 72 # deny access to .htaccess files, if Apache's document root 73 # concurs with nginx's one 74 # 75 #location ~ /\.ht { 76 # deny all; 77 #} 78 } 79 80 81 # another virtual host using mix of IP-, name-, and port-based configuration 82 # 83 #server { 84 # listen 8000; 85 # listen somename:8080; 86 # server_name somename alias another.alias; 87 88 # location / { 89 # root html; 90 # index index.html index.htm; 91 # } 92 #} 93 94 95 # HTTPS server 96 # 97 #server { 98 # listen 443; 99 # server_name localhost; 100 101 # ssl on; 102 # ssl_certificate cert.pem; 103 # ssl_certificate_key cert.key; 104 105 # ssl_session_timeout 5m; 106 107 # ssl_protocols SSLv2 SSLv3 TLSv1; 108 # ssl_ciphers HIGH:!aNULL:!MD5; 109 # ssl_prefer_server_ciphers on; 110 111 # location / { 112 # root html; 113 # index index.html index.htm; 114 # } 115 #} 116 117 }
1 #echo "make -f objs/Makefile 2 #make[1]: Entering directory `/usr/local/src/nginx-0.8.54′ 3 #cd /usr/local/pcre / 4 # && if [ -f Makefile ]; then make distclean; fi / 5 # && CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " / 6 # ./configure –disable-shared 7 #/bin/sh: line 2: ./configure: No such file or directory 8 #make[1]: *** [/usr/local/pcre/Makefile] Error 127 9 #make[1]: Leaving directory `/usr/local/src/nginx-0.8.54′ 10 #make: *** [build] Error 2" 11 #echo "下意识的google了几下,别人碰到的很少,也么解决好。不怕,好歹之前也玩过嵌入式的皮毛,自己写过makefile。编译nginx怎么会去pcre目录下找makefile呢?那我指定pcre源码目录给它。" 12 #
1 #!/bin/bash 2 3 echo_red(){ 4 echo -e "\033[31m [ $1 ] \033[0m" 5 } 6 yum install yum-utils 7 yum-complete-transaction --cleanup-only 8 package-cleanup --dupes 9 package-cleanup --problems 10 yum -y update 11 12 MYSQL_DIR=/usr/local/mysql 13 MYSQL_SRC=/usr/local/src 14 DATA_DIR=/data/mysql 15 16 #check development tools requried by mysql 17 #echo -e "\033[31m [ Checking for gcc...... ] \033[0m" 18 echo_red "Checking for gcc......" 19 #rpm -qa|grep gcc-[0-9] || yum install gcc && echo -e "\033[32m GCC installed \033[0m" 20 rpm -qa|grep gcc-[0-9] || yum install gcc && echo_red "Gcc install" 21 #echo -e "\033[31m [ Checking for gcc-c++......] \033[0m" 22 echo_read "Checking for gcc-c++......" 23 #rpm -qa|grep gcc-c++ || yum install gcc-c++ && echo -e "\033[32m GCC-C++ installed \033[0m" 24 rpm -qa|grep gcc-c++ || yum install gcc-c++ && echo_red "GCC-C++ installed" 25 26 #echo -e "\033[31m [ Checking for bison...... ] \033[0m" 27 echo_red "Checking for bison..." 28 #rpm -qa|greo bison || yum install bison && echo -e "\033[32m BISON installed \033[0m" 29 rpm -qa|greo bison || yum install bison && echo_red "BISON installed" 30 31 #echo -e "\033[31m [ Checking for ncurses...... ] \033[0m" 32 echo_red "Chking for ncurses..." 33 #rpm -qa|grep ncurses || yum install ncurses && echo -e "\033[32m NCURSES installed \033[0m" 34 rpm -qa|grep ncurses || yum install ncurses && echo_red "NCURSES installed" 35 36 #echo -e "\033[31m [ Checking for ncurses-devel...... ] \033[0m" 37 read_red "Checking for ncurses-devel..." 38 #rpm -qa|grep ncurses-devel || yum install ncurses-devel && echo -e "\033[32m NCURSES-DEVEL installed \033[0m" 39 rpm -qa|grep ncurses-devel || yum install ncurses-devel && echo_red "NCURSES-DEVEL installed" 40 41 #echo -e "\033[31m [ Checking for wget...... ] \033[0m" 42 echo_red "Checking for wget..." 43 #rpm -qa|grep wget||yum -y install wget && echo -e "\033[32m wget installed \033[0m" 44 rpm -qa|grep wget||yum -y install wget && echo_red "wget installed" 45 46 # check if already installed mysql, if exists ,remove it 47 rpm -qa|grep mysql 48 if [ $? -eq 0 ];then 49 yum remove mysql mysql-server -y 50 echo "" 51 #echo "\033[32m Mysql already removed \033[0m" 52 echo_red "Mysql already removed..." 53 echo "" 54 else 55 #echo "\033[32m Mysql does not exist \033[0m" 56 echo_red "Mysql does not exist" 57 fi 58 #check user mysql exists or not 59 id mysql > /dev/null 2>&1 60 if [ $? -eq 0 ];then 61 echo "" 62 #echo -e "\033[31m User mysql exists,now remove it;and add a new acount \033[0m" 63 echo_red "User mysql exists,now remove it;and add a new acount" 64 /usr/sbin/userdel -r mysql 65 /usr/sbin/groupadd -g 3306 mysql 66 /usr/sbin/useradd -u 3306 -g mysql -M -s /sbin/nologin mysql 67 #echo -e "\033[32m User mysql created \033[0m" 68 echo_red "User mysql created" 69 else 70 echo "" 71 #echo -e "\033[31m User mysql does not exists ,now we will create it \033[0m" 72 echo_red "User mysql dose not exists,now we will create it" 73 /usr/sbin/groupadd -g 3306 mysql 74 /usr/sbin/useradd -u 3306 -g mysql -M -s /sbin/nologin mysql 75 #echo -e "\033[32m User mysql created \033[0m" 76 echo_red "User mysql created" 77 fi 78 79 #yum remove mysql 2>/mnt/error.log 80 #yum install gcc* gcc-c++ ncurses-devel* bison wget 81 82 #Download and install cmake for mysql 5.5 or newer distribution 83 cd $MYSQL_SRC 84 #echo -e "\003[32m Beginning download...... \033[0m" 85 echo_red "Beginning download..." 86 wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz 87 #echo -e "\033[31m Download Ended \033[0m" 88 echo_red "Download Ended" 89 echo "" 90 #echo -e "\033[32m Beginning uncompress and install......\033[0m" 91 echo_red "Beginning uncompress and install..." 92 tar -xzvf cmake-2.8.5.tar.gz 93 cd cmake-2.8.5 94 ./configure 95 make && make install 96 #echo -e "\033[31m Install Ended \033[0m" 97 echo_red "Install Ended" 98 99 100 #Download and install mysql tarball 101 cd $MYSQL_SRC 102 #echo -e "\033[32m Beginning download...... \033[0m" 103 echo_red "Beginning download..." 104 wget http://dev.mysql.com/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz 105 #echo -e "\033[31m DownloadE Ended \033[0m" 106 echo_red "Download Ended" 107 echo "" 108 #echo -e "\033[32m Beginning uncompress and install...... \033[0m" 109 echo_red "Beginning uncompress and install..." 110 tar -zxf mysql-5.5.27.tar.gz 111 cd mysql-5.5.27 112 cmake -DCMAKE_INSTALL_PREFIX=$MYSQL_DIR -DMYSQL_DATADIR=$DATA_DIR/data -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWTIH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DMYSQL_TCP_PORT=3306 113 make && make install 114 #echo -e "\033[31m Install Ended \033[0m" 115 echo_red "Install Ended" 116 117 # now configure you installation 118 mkdir -p $DATA_DIR/data 119 mkdir -p $DATA_DIR/log 120 chown -R mysql:mysql $DATA_DIR 121 chmod -R 755 $DATA_DIR 122 123 # use my-medium.cnf as my.cnf 124 cp support-files/my-medium.cnf /etc/my.cnf 125 126 #initialized database 127 $MYSQL_DIR/scripts/mysql_install_db --user=mysql --basedir=$MYSQL_DIR --datadir=$DATA_DIR/data 128 129 # use mysql.server as mysqld 130 cp support-files/mysql.server /etc/init.d/mysqld 131 chmod +x /etc/init.d/mysqld 132 133 # set mysql as system service and start when system boot 134 /sbin/chkconfig --add mysqld 135 /sbin/chkconfig mysqld on 136 137 138 # create soft links 139 cd /usr/local/bin 140 ln -s /usr/local/mysql/bin/mysql mysql && 141 ln -s /usr/local/mysql/bin/mysqldump mysqldump && 142 ln -s /usr/local/mysql/bin/mysqladmin mysqladmin 143 144 #echo "Start the mysql service" 145 echo_red "Start the mysql service" 146 service mysqld start 147 148 #echo -e "\033[31m You have installed mysql successfull " 149 echo_red "You have installed mysql successfull" 150 #echo -e "\033[32m END END END END \033[0M" 151 echo_red "END..........................................................................................................." 152 153 Mysql安装脚本
echo "############### PHP ############"
1 wget http://mirrors.sohu.com/php/php-5.5.9.tar.gz
1 tar -zxf php-5.5.9.tar.gz 2 cd php-5.5.9 3 4 ./configure --prefix=/usr/local/php \ 5 --with-config-file-path=/usr/local/php/etc \ 6 --with-mysql=/usr/local/mysql/ \ 7 --with-mysqli=/usr/local/mysql/bin/mysql_config \ 8 --with-iconv-dir=/usr/local/iconv/ \ 9 --with-freetype-dir=/usr/local/freetype/ \ 10 --with-jpeg-dir=/usr/local/jpeg/ \ 11 --with-png-dir=/usr/local/libpng/ \ 12 --with-zlib \ 13 --with-libxml-dir=/usr/local/libxml2/ \ 14 --enable-xml \ 15 --disable-rpath \ 16 --enable-bcmath \ 17 --enable-shmop \ 18 --enable-sysvsem \ 19 --enable-inline-optimization \ 20 --with-curl \ 21 --enable-mbregex \ 22 --enable-fpm \ 23 --enable-mbstring \ 24 --with-mcrypt \ 25 --with-gd=/usr/local/gd \ 26 --enable-gd-native-ttf \ 27 --enable-gd-native-ttf \ 28 --with-openssl \ 29 --with-mhash \ 30 --enable-pcntl \ 31 --enable-sockets \ 32 --with-xmlrpc \ 33 --enable-zip \ 34 --enable-soap \ 35 --with-pdo-mysql \ 36 --enable-maintainer-zts \ 37 --enable-opcache=no
#echo "注意:在编译时出现这样的错误:/usr/bin/ld:cannotfind-lltdl出现此错误大多是由于你的系统未安装libtool库导致,但即使你已安装了libtool库也可能会遇到。对此我们要做两件事情:
#1,确认系统是否安装了libtool库;
#2,为PHP编译作兼容性设置。第一步很容做到:yum-yinstalllibtoollibtool-ltdl;第二步由于PHP的configure指定的libltdl名为libltdl.so,为此我们只需添加一个名称连接:ln-s/usr/lib64/libltdl.so.3.1.4/usr/lib64/libltdl.so"
1 make 2 make install
1 cd /usr/local/php/etc 2 cp php-fpm.conf.default php-fpm.conf 3 sed -i "s/user = nobody/user = www/g" php-fpm.conf 4 sed -i "s/group = nobody/group = www/g" php-fpm.conf
1 #echo " 2 # 创建php.ini文件,这个文件是对php一些运行选项进行配置的文件,非常重要,以后肯定会用到。官方文档在这里:http://www.php.net/manual/zh/ini.php。方法是将PHP源码目录下的「php.ini-production」文件复制到PHP安装目录下的「lib/」文件夹,并且重命名为「php.ini」。在我的机器上,输入命令「cp /home/reetsee/download/php-5.4.29/php.ini-production /home/reetsee/environment/php/lib/php.ini」即可完成。 3 # 设置php-fpm.pid的路径,这个文件记录了php-fpm的进程id,以后你要重启php-fpm时可以通过命令(假设你在PHP的安装目录下)「kill -USR2 `cat var/run/php-fpm.pid`」。注意那两个引号是反引号「`」,不是单引号或者双引号。具体的做法是编辑PHP安装目录下的「etc/php-fpm.conf」文件,找到「pid = 」这一行,将前面的分号「;」去掉。如下图所示: 4 #"
1 cp /home/download/lnmp-zabbix/php-5.5.9/php.ini-production /usr/local/php/lib/ini.php
1 #sed-i's/^\(.*\)date.timezone=.*$/date.timezone=Asia\/Shanghai/g'/usr/local/php/lib/php.ini 2 3 #sed-i's/^\(.*\)post_max_size=.*$/post_max_size=16M/g'/usr/local/php/lib/php.ini 4 5 #sed-i's/^\(.*\)max_execution_time=.*$/max_execution_time=300/g'/usr/local/php/lib/php.ini 6 7 #sed-i's/^\(.*\)max_input_time=.*$/max_input_time=300/g'/usr/local/php/lib/php.ini
1 cat php-fpm.conf|grep -v ';'|grep -v '^$' 2 3 [global] 4 pid = run/php-fpm.pid 5 6 7 [www] 8 user = www 9 group = www 10 listen = 127.0.0.1:9000 11 12 pm = dynamic 13 pm.max_children = 5 14 pm.start_servers = 2 15 pm.min_spare_servers = 1 16 pm.max_spare_servers = 3
SNMP安装
1 yum -y install net-snmp net-snmp-*
1 service snmpd start
snmp安装后,默认的配置文件是/etc/snmp/snmpd.conf,得到是数据信息是有限的,需要手动配置。
snmp配置文件详解
定义安全体名称
1 com2sec notConfigUser default public 2 配置语法: 3 com2sec sec.name source community 4 com2sec :固定的配置指令 5 sec.name :安全体名称,可自定义,本例中为notConfigUser 6 source :允许访问的地址,default默认为全部允许 7 community :共同体或社区名称,可以自定义,这个最重要,相当于取数据时的密码,本例中为采用安装时默认的为public
定义安全组
1 com2sec notConfigUser default public 2 配置语法: 3 com2sec sec.name source community 4 com2sec :固定的配置指令 5 sec.name :安全体名称,可自定义,本例中为notConfigUser 6 source :允许访问的地址,default默认为全部允许 7 community :共同体或社区名称,可以自定义,这个最重要,相当于取数据时的密码,本例中为采用安装时默认的为public
定义视图
1 # name incl/excl subtree mask(optional) 2 view systemview included .1 3 view systemview included .1.3.6.1.2.1.1 4 view systemview included .1.3.6.1.2.1.25.1.1 5 配置语法: 6 view name include substree mask 7 view :固定配置指令 8 name :视图名,本例为systemview 9 included :一般用include表示包括的视图内容,excl很少用,表示排除的意思 10 subtree :mib子树节点 11 mask :掩码 ,可以不写,默认
向安全组授权相应的视图
1 access notConfigGroup "" any noauth exact systemview none none 2 配置语法: 3 access group context sec.model sec.level prefix read write notif 4 access :固定的配置指令 5 group :安全组名,在前文设定的 6 context :上下文,v1,v2c中始终为空:“”; 7 sec.model :安全模式,可选v1。v2c,any表示支持所有的模式 8 sec.level :安全级别,可选值有auth,noauth,priv,v1,v2c中只能为noauth 9 prefix :代理,可以不写该项 10 read :授权的读视图 11 write :授权的写视图 12 notif :授权的trap视图
系统联系人息
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
完整的配置实例1
1 vim /etc/snmp/snmpd.conf 2 com2sec zabbix default caisangzi 3 group zabbix v1 zabbix 4 group zabbix v2c zabbix 5 view view1 included .1 6 view view1 included .1.3.6.1.2.1.1 7 view view1 included .1.3.6.1.2.1.25.1.1 8 access zabbix "" any noauth exact view1 none none
查看取得的数据
1 #在配置文件中把安全团体名和团体组名配置相同都为zabbix 2 [root@zhu1 ~]# snmpwalk -v2c -c caisangzi 127.0.0.1
简洁的配置实例
1 rocommunity zhuzhu 127.0.0.1/32 2 rocommunity zhuzhu 10.1.1.0/32 3 rocommunity zhuzhu 192.168.70.133 4 group notConfigGroup v1 notConfigUser 5 group notConfigGroup v2c notConfigUser 6 view systemview include .1.3.6.1.2.1.1 7 view systemview include .1.3.6.1.2.1.25.1.1 8 view systemview include .1.3.6.1.4.1.2208 9 access notConfigGroup "" any noauth exact all none none 10 view all include .1 80 11 syslocation Unknown 12 syscontact Root
1 rocommunity COMMUNITY [SOURCE [OID]] 2 rwcommunity COMMUNITY [SOURCE [OID]] 3 rocommunity :读权限与团体名的合成指令 4 COMMUNITY :团体名 5 [SOURCE [OID]] :允许的ip,与包含的oid树节点,可以不写采用默认的
与snmp有关的指令介绍
snmpwalk-v2c-c团体名ip地址:查看某主机的oid信息
1 snmpwalk -v2c -c caisangzi 127.0.0.1
snmpget
1 snmpget -v2c -c caisangzi 192.168.70.137 SNMPv2-MIB::sysName.0 2 SNMPv2-MIB::sysName.0 = STRING: www
把内容转化为oid
1 snmpget -v2c -c caisangzi -On 192.168.70.137 SNMPv2-MIB::sysName.0.1.3.6.1.2.1.1.5.0 = STRING: www
1 snmptranslate -On SNMPv2-MIB::sysName.0.1.3.6.1.2.1.1.5.0
1)cp –fr /usr/local/nginx/sbin/nginx /etc/init.d/ 2)cp –fr /usr/local/php/sbin/php-fpm /etc/init.d 3)/etc/init.d/php-fpm & 4)/etc/init.d/nginx &
Zabbixserver基本安装
echo "############# zabbix ###########"
1 tar -zxf zabbix-2.2.3.tar.gz 2 cd zabbix-2.2.3 3 4 ./configure --prefix=/usr/local/zabbix \ 5 --enable-server \ 6 --enable-agent \ 7 --with-mysql=/usr/local/mysql/bin/mysql_config \ 8 --enable-proxy \ 9 --enable-ipv6 \ 10 --with-net-snmp \ 11 --with-libcurl 12 13 make 14 make install
Zabbix基本配置
1 mysql –uroot –p****
1 create database zabbix character set utf8; 2 grant all privileges on zabbix.* to zabbix@'127.0.0.1' identified by '123'; 3 flush privileges;
导入数据库表结构
1 cd /home/download/lnmp-zabbix/zabbix-2.2.3/database/mysql 2 mysql -uzabbix -p123 zabbix <schema.sql 3 mysql -uzabbix -p123 zabbix <images.sql 4 mysql -uzabbix -p123 zabbix <data.sql
Copyzabbix源代码
1 cp -fr /home/download/lnmp-zabbix/zabbix-2.2.3/frontends/php/ /usr/local/nginx/html/zabbix
1 chmod -R 755 /usr/local/nginx/html/zabbix 2 chown www.www /usr/local/nginx/html/zabbix -R
Copy zabbix server agent启动脚本并修改
1 cp -fr /home/download/lnmp-zabbix/zabbix-2.2.3/misc/init.d/fedora/core5/zabbix_* /etc/init.d/
1 chmod 777 /etc/init.d/zabbix_*
1 vim/etc/init.d/zabbix_server
2 ZABBIX_BIN="/usr/local/sbin/zabbix_server"修改成
3 ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
4 #vim/etc/init.d/zabbix_agent
5 ZABBIX_BIN="/usr/local/sbin/zabbix_server"修改成
6 ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_server"
1 chmod 777 /etc/init.d/zabbix_* 2 3 sed -i "s/\/usr\/local\/sbin\/zabbix_server/\/usr\/local\/zabbix\/sbin\/zabbix_server/g" /etc/init.d/zabbix_server 4 5 sed -i "s/\/usr\/local\/sbin\/zabbix_agentd/\/usr\/local\/zabbix\/sbin\/zabbix_agentd/g" /etc/init.d/zabbix_agentd
Zabbixserver基本配置
1 cat zabbix_server.conf|grep -v '#'|grep -v '^$' 2 LogFile=/tmp/zabbix_server.log 3 DBName=zabbix 4 DBUser=zabbix 5 DBPassword=123 6 DebugLevel=3 7 ListenIP=127.0.0.1 8 AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
Zabbixagent基本配置
1 cat zabbix_agent.conf|grep -v '#'|grep -v '^$' 2 Server=127.0.0.1 3 UnsafeUserParameters=1 4 Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
http://www.it165.net/admin/html/201402/2365.html
本文来自博客园,作者:IT老登,转载请注明原文链接:https://www.cnblogs.com/nb-blog/p/5330128.html