设为首页 收藏本站
查看: 774|回复: 0

[经验分享] Install zabbix Server

[复制链接]

尚未签到

发表于 2016-11-6 08:57:53 | 显示全部楼层 |阅读模式
-------------------------------
Install zabbix Server
-------------------------------
Install mysql
【mysql】
Version:mysql-5.0.51.tar.gz

Run:
#groupadd mysql
#useradd -g mysql mysql

cd mysql-5.0.51

Run:
./configure \
--prefix=/usr/local/mysql \
--with-mysqld-user=mysql

cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R mysql.mysql var

Run:
make;make install
Error Handling: (main reasons for the system has not been installed compiler)
1.checking for tgetent in -ltermcap... no
checking for termcap functions library... configure: error: No curses/termcap library found
Solution:
yum install libtermcap-devel
yum install ncurses-devel
2.../depcomp: line 512: exec: g++: not found

Install apache

【Apache】
Version:Apache 2.0.63
./configure \
--prefix=/usr/local/apache

Install PHP
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc --with-mysql=/usr/local/mysql --with-gd --with-jpeg-dir --with-zlib-dir --with-png-dir --with-freetype-dir --enable-track-vars --enable-sockets --enable-ftp --disable-debug  --enable-bcmath

[Attention:]You must use “--enable-bcmatch”
Error 1:
configure: error: xml2-config not found. Please check your libxml2 installation.
Solution:yum install libxml2-devel

Error 2:If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype.h not found.
Solution:yum install freetype-devel

Make;make install
cp php.ini-dist /www/php/php.ini
Install zabbix

cd create/
cd schema/
cat mysql.sql | mysql -u root zabbix
cd ..
cd data/
cat data.sql | mysql -u root zabbix
cat images_mysql.sql | mysql -u root zabbix

mkdir /etc/zabbix

Error solution:
./zabbix_server: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory

./configure --prefix=/data/zabbix/ --enable-server --enable-agent --with-mysql
make
make install


Configuration:

  Detected OS:        linux-gnu
  Install path:       /data/zabbix/
  Compilation arch:   linux

  Compiler:           gcc
  Compiler flags:     -g -O2   -I/usr/local/mysql/include/mysql      

  Enable server:      yes
  With database:      MySQL
  WEB Monitoring via: no
  Native Jabber:      no
  SNMP:               no
  IPv6:               no
  Linker flags:             -L/usr/local/mysql/lib/mysql     
  Libraries:          -lm -lresolv     -lmysqlclient     

  Enable agent:       yes
  Linker flags:        
  Libraries:          -lm -lresolv

  LDAP support:       no
Copy frontends to htodcs:

Cp –rf  /root/zabbix/zabbix-1.4.4/frontends/php/*  /data/WebSite/htdocs/

Enter user interface
http://127.0.01./index.php
User is admin, password is empty.




-------------------------------
Install zabbix to client
-------------------------------
1.version:1.4.4
2.tar zxvf zabbix_agents_1.4.4.linux2_6.x86_64.tar.gz
cd zabbix
cp file to target directory
cp zabbix_agentd.conf to /etc/zabbix/

3.Modify /etc/zabbix/zabbix_agentd.conf
Server= your IP,
if you want to add your UserParameter, you must modify “UserParameter=”.
example:
UserParameter=iowait,vmstat|grep -v memory |awk '{print $16}' |grep -v wa
4.run zabbix_agentd

-----------------------------------------------
About UserParameter (Java_app_*)
-----------------------------------------------
Currently java environment need to monitor these parameters in the following:

UserParameter=ServerInfo.ThreadCount,curl -s 'http://127.0.0.1:8180/ecws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f1 -d ","
UserParameter=ServerInfo.FreeMem,curl -s 'http://127.0.0.1:8180/ecws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f2 -d ","
UserParameter=ServerInfo.MaxMem,curl -s 'http://127.0.0.1:8180/ecws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f4 -d ","
UserParameter=ServerInfo.TotalMem,curl -s 'http://127.0.0.1:8180/ecws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f3 -d ","
UserParameter=ServerInfo.CurrentStatus,curl -s 'http://127.0.0.1:8180/ecws/status' |grep CurrentStatus|cut -f2 -d "="
UserParameter=ApplicationInfo.DependencyCheck.DatabaseDependencyCheck,curl -s 'http://127.0.0.1:8180/ecws/status' |grep DatabaseDependencyCheck|cut -f2 -d "="
UserParameter=ApplicationInfo.DependencyCheck.EncryptionServiceDependencyCheck,curl -s 'http://127.0.0.1:8180/ecws/status' |grep EncryptionServiceDependencyCheck|cut -f2 -d "="
UserParameter=ApplicationInfo.DependencyCheck.PaymentServiceDependencyCheck,curl -s 'http://127.0.0.1:8180/ecws/status' |grep PaymentServiceDependencyCheck|cut -f2 -d "="
UserParameter=DBConnection.Active,curl -s 'http://127.0.0.1:8180/ecws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f1 -d ","
UserParameter=DBConnection.Available,curl -s 'http://127.0.0.1:8180/ecws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f2 -d ","
UserParameter=DBConnection.Opened,curl -s 'http://127.0.0.1:8180/ecws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f3 -d ","

If you want to install it to other servers, Please modify these item:
http://127.0.0.1:8180/ecws/status
1.port: 8180 changed to correct port
2./ecws changed to correct directory

Then you must be restart zabbix_agentd


-------------------------------------------------------------------------
Sum of multi-server Item data
-------------------------------------


Attention: you can put these shell to anyone server.

Please see the shell “payflow-int.sh”
1.you must replace URL from “http://payflow-app0[1-2].int.real.com:9080/payflow/status”
A.[1-2] is payflow-app01.int real.com and payflow-app02.int.real.com,if you have 01-09, you can use [1-9].
B. port: 9080 changed to correct port
C. /payflow/status changed to correct directory
2.if you want to change other UserParameter, you must change “grep ServerInfo.JVMInfo” to what you need.

Copy flow-int.sh,pws-int.sh,rcws-int.sh to the correct server.
Add these UserParameter to /etc/zabbix/zabbix-agented.conf

UserParameter=Payflow-int.ThreadCount,/data/zabbix/bin/payflow-int.sh ThreadCount
UserParameter=Payflow-int.active,/data/zabbix/bin/payflow-int.sh active
UserParameter=Payflow-int.available,/data/zabbix/bin/payflow-int.sh available
UserParameter=Payflow-int.opened,/data/zabbix/bin/payflow-int.sh opened
UserParameter=Payflow-int.PayflowApplication.ModeRequest.NEW_REQUEST,/data/zabbix/bin/payflow-int.sh PayflowApplication.ModeRequest.NEW_REQUEST
UserParameter=Payflow-int.PayflowApplication.ModeRequest.SUBMIT,/data/zabbix/bin/payflow-int.sh PayflowApplication.ModeRequest.SUBMIT
UserParameter=Payflow-int.PayflowApplication.Error,/data/zabbix/bin/payflow-int.sh Error

# Sum Total of RCWS-INT

UserParameter=RCWS-INT.ThreadCount,/data/zabbix/bin/rcws-int.sh ThreadCount
UserParameter=RCWS-INT.Active,/data/zabbix/bin/rcws-int.sh Active
UserParameter=RCWS-INT.available,/data/zabbix/bin/rcws-int.sh available
UserParameter=RCWS-INT.opened,/data/zabbix/bin/rcws-int.sh opened
UserParameter=RCWS-INT.createOrder,/data/zabbix/bin/rcws-int.sh createOrder
UserParameter=RCWS-INT.createNewOrder,/data/zabbix/bin/rcws-int.s createNewOrder
UserParameter=RCWS-INT.PreviewOrder,/data/zabbix/bin/rcws-int.s PreviewOrder
UserParameter=RCWS-INT.PWSFacade.authorize,/data/zabbix/bin/rcws-int.s PWSFacade.authorize
UserParameter=RCWS-INT.PWSFacade.settlementCharge,/data/zabbix/bin/rcws-int.s PWSFacade.settlementCharge
UserParameter=RCWS-INT.POAPPaymentService.authorizeBill,/data/zabbix/bin/rcws-int.s POAPPaymentService.authorizeBill

# Sum Total of PWS-INT

UserParameter=PWS-INT.ThreadCount,/data/zabbix/bin/pws-int.sh ThreadCount
UserParameter=PWS-INT.PaymentTransactionService.authorize,/data/zabbix/bin/pws-int.sh PaymentTransactionService.authorize
UserParameter=PWS-INT.PaymentTransactionService.authenticatePaymentMethod,/data/zabbix/bin/pws-int.sh PaymentTransactionService.authenticatePaymentMethod
UserParameter=PWS-INT.PaymentTransactionService.settle,/data/zabbix/bin/pws-int.sh PaymentTransactionService.settle
UserParameter=PWS-INT.VCastPaymentProcessorAdapter.authorize,/data/zabbix/bin/pws-int.sh VCastPaymentProcessorAdapter.authorize
UserParameter=PWS-INT.VCastPaymentProcessorAdapter.settle,/data/zabbix/bin/pws-int.sh VCastPaymentProcessorAdapter.settle

Then you must restart zabbix_agented
You add the UserParameter to anyone server. Please Reference in front of the UserParameter.

----------------------------------
shell payflow-int.sh
---------------------------------
#:!/bin/sh
if [ "$1" = "" ] ; then
echo "Please enter parameter!"
else
        #Sum Total of ThreadCount
        if [ "$1" = "ThreadCount" ] ; then
                echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{
print sum}'`
        fi

        #Sum Total of DBConnection.active
        if [ "$1" = "active" ] ; then
                echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=
$1}END{print sum}'`
        fi

       #Sum Total of DBConnection.available
        if [ "$1" = "available" ] ; then
                echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f2 -d ","|awk 'BEGIN{sum=0}{sum+=
$1}END{print sum}'`
        fi

        #Sum Total of DBConnection.opened
        if [ "$1" = "opened" ] ; then
                echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f3 -d ","|awk 'BEGIN{sum=0}{sum+=
$1}END{print sum}'`
        fi

        #Sum Total of PayflowApplication.ModeRequest.NEW_REQUEST
        if [ "$1" = "PayflowApplication.ModeRequest.NEW_REQUEST" ] ; then
                echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep PayflowApplication.ModeRequest.NEW_REQUEST|cut -f2 -d "="|cut -f1 -d ","|awk 'B
EGIN{sum=0}{sum+=$1}END{print sum}'`
        fi

        #Sum Total of PayflowApplication.ModeRequest.SUBMIT
        if [ "$1" = "PayflowApplication.ModeRequest.SUBMIT" ] ; then
                 echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep PayflowApplication.ModeRequest.SUBMIT|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN
{sum=0}{sum+=$1}END{print sum}'`
        fi

        #Sum Total of Error
        if [ "$1" = "Error" ] ; then
                 echo `curl -s 'http://payflow-app0[1-2].int.real.com:9080/payflow/status' |grep Error|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print sum}'`
        fi

fi

----------------------------------------------------------------
Shell pws-int.sh
----------------------------------------------------------------

#!/bin/sh
if [ "$1" = "" ] ; then
echo "Please enter parameter!"
else
        #Sum Total of ThreadCount
        if [ "$1" = "ThreadCount" ] ; then
                echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print su
m}'`
        fi

        #Sum Total of PaymentTransactionService.authorize
        if [ "$1" = "PaymentTransactionService.authorize" ] ; then
                echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep PaymentTransactionService.authorize|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum
+=$1}END{print sum}'`
        fi

       #Sum Total of PaymentTransactionService.authenticatePaymentMethod
        if [ "$1" = "PaymentTransactionService.authenticatePaymentMethod" ] ; then
                echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep PaymentTransactionService.authenticatePaymentMethod|cut -f2 -d "="|cut -f2 -d ","|awk '
BEGIN{sum=0}{sum+=$1}END{print sum}'`
        fi

        #Sum Total of PaymentTransactionService.settle
        if [ "$1" = "PaymentTransactionService.settle" ] ; then
                echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep PaymentTransactionService.settle|cut -f2 -d "="|cut -f3 -d ","|awk 'BEGIN{sum=0}{sum+=$
1}END{print sum}'`
        fi

        #Sum Total of VCastPaymentProcessorAdapter.authorize
        if [ "$1" = "VCastPaymentProcessorAdapter.authorize" ] ; then
                echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep VCastPaymentProcessorAdapter.authorize|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{
sum+=$1}END{print sum}'`
        fi

        #Sum Total of VCastPaymentProcessorAdapter.settle
        if [ "$1" = "VCastPaymentProcessorAdapter.settle" ] ; then
                 echo `curl -s 'http://pws-app0[1-2].int.real.com:8480/pws/status' |grep VCastPaymentProcessorAdapter.settle|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{su
m+=$1}END{print sum}'`
        fi

fi


------------------------------------------------------------------
shell rcws-int.sh
-----------------------------------------------------------------
#!/bin/sh
if [ "$1" = "" ] ; then
echo "Please enter parameter!"
else
        #Sum Total of ThreadCount
        if [ "$1" = "ThreadCount" ] ; then
                echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep ServerInfo.JVMInfo|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print
sum}'`
        fi

        #Sum Total of DBConnection.Active
        if [ "$1" = "Active" ] ; then
                echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END
{print sum}'`
        fi

       #Sum Total of DBConnection.available
        if [ "$1" = "available" ] ; then
                echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f2 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END
{print sum}'`
        fi

        #Sum Total of DBConnection.opened
        if [ "$1" = "opened" ] ; then
                echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep DBConnection.DBConnection|cut -f2 -d "="|cut -f3 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END
{print sum}'`
        fi

        #Sum Total of createOrder
        if [ "$1" = "createOrder" ] ; then
                echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep createOrder|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print sum}'`
        fi

        #Sum Total of createNewOrder
        if [ "$1" = "createNewOrder" ] ; then
                 echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep createNewOrder|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print sum
}'`
        fi

        #Sum Total of PreviewOrder
        if [ "$1" = "PreviewOrder" ] ; then
                 echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep PreviewOrder|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{print sum}'
`
        fi

        #Sum Total of PWSFacade.authorize
        if [ "$1" = "PWSFacade.authorize" ] ; then
                 echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep PWSFacade.authorize|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}END{prin
t sum}'`
        fi
        
        #Sum Total of PWSFacade.settlementCharge
        if [ "$1" = "PWSFacade.settlementCharge" ] ; then
                 echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep PWSFacade.settlementCharge|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum+=$1}E
ND{print sum}'`
        fi

        #Sum Total of POAPPaymentService.authorizeBill
        if [ "$1" = "POAPPaymentService.authorizeBill" ] ; then
                 echo `curl -s 'http://rcws-app0[1-2].int.real.com:8380/rcws/status' |grep POAPPaymentService.authorizeBill|cut -f2 -d "="|cut -f1 -d ","|awk 'BEGIN{sum=0}{sum
+=$1}END{print sum}'`  
        fi

fi

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-296392-1-1.html 上篇帖子: 影响SQL Server数据库应用性能的几个常见因素 下篇帖子: SQL Server 2005 & 2008 master与msdb数据库的备份与恢复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表