zabbix4.0安装+grafana数据展示

zabbix4.0安装+grafana数据展示

如果对运维课程感兴趣,可以在b站上搜索我的账号: 运维实战课程,可以关注我,学习更多免费的运维实战技术视频

Zabbix_server: 192.168.43.166  被监控端: 192.168.43.xx

lnmp工作过程:用户请求nginx,当请求静态页面,nginx直接返回给用户,当请求动态页面,如php程序文件,nginx会调用php-fpm进程获取动态页面,然后返回给用户,当用户请求nginx,需要获取mysql数据时,nginx会通过php-fpm程序来操作后台mysql,php-fpm请求到数据后,返回给nginx,nginx再返回给用户。

1.lnmp之nginx1.15.9编译安装和加入systemctl启动

[root@zabbix_server ~]# yum -y install unzip zip vim lrzsz wget createrepo

[root@zabbix_server ~]# yum install -y wget gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel

[root@zabbix_server ~]# ls

nginx-1.15.9.tar.gz

[root@zabbix_server ~]# tar -zxf nginx-1.15.9.tar.gz

[root@zabbix_server ~]# ls

nginx-1.15.9  nginx-1.15.9.tar.gz

[root@zabbix_server ~]# cd nginx-1.15.9

[root@zabbix_server nginx-1.15.9]# ls

auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

[root@zabbix_server nginx-1.15.9]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

[root@zabbix_server nginx-1.15.9]# make && make install

[root@zabbix_server nginx-1.15.9]# cd

[root@zabbix_server ~]# ls /usr/local/nginx/

conf  html  logs  sbin

使用systemctl管理nginx:

[root@zabbix_server ~]# vim /usr/local/nginx/conf/nginx.conf

user  root;   #添加或修改

......

[root@zabbix_server ~]# vim /usr/lib/systemd/system/nginx.service

[Unit]

Description=nginx

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/nginx/sbin/nginx

[Install]

WantedBy=multi-user.target

#注意:主要修改的两项是描述Description和启动命令ExecStart部分(启动服务的命令写上即可)

[root@zabbix_server ~]# systemctl daemon-reload

[root@zabbix_server ~]# systemctl start nginx

[root@zabbix_server ~]# netstat -anput |grep 80

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      807/nginx: master p

[root@zabbix_server ~]# ps -ef |grep nginx

有进程

[root@zabbix_server ~]# systemctl status nginx

● nginx.service - nginx

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

   Active: active (running) since Thu 2019-08-29 09:39:56 CST; 29s ago

[root@zabbix_server ~]# systemctl stop nginx

[root@zabbix_server ~]# systemctl status nginx

● nginx.service - nginx

   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

   Active: inactive (dead)

[root@zabbix_server ~]# systemctl enable nginx     #设置开机自启

注意:vim /usr/lib/systemd/system/nginx.service也可写成如下:

[Unit]

Description=nginx - high performance web server

After=network.target remote-fs.target nss-lookup.target

[Service]

Type=forking

ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

ExecReload=/usr/local/nginx/sbin/nginx -s reload

ExecStop=/usr/local/nginx/sbin/nginx -s stop

[Install]

WantedBy=multi-user.target

2.lnmp之php5.6.40编译安装和php-fpm进程和加入systemctl启动

[root@zabbix_server ~]# yum -y install epel-release

[root@zabbix_server ~]# yum -y install  gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel openldap openldap-devel libmcrypt libmcrypt-devel

[root@zabbix_server ~]# ls php-5.6.40.tar.gz

php-5.6.40.tar.gz

[root@zabbix_server ~]# tar -zxf php-5.6.40.tar.gz

[root@zabbix_server ~]# cd php-5.6.40

[root@zabbix_server php-5.6.40]# ls

acinclude.m4      EXTENSIONS       Makefile.gcov        README.EXT_SKEL                   README.SUBMITTING_PATCH    stub.c

aclocal.m4        footer           Makefile.global      README.GIT-RULES                  README.TESTING             tests

build             generated_lists  makerpm              README.input_filter               README.TESTING2            travis

buildconf         genfiles         missing              README.MAILINGLIST_RULES          README.UNIX-BUILD-SYSTEM   TSRM

buildconf.bat     header           mkinstalldirs        README.md                         README.WIN32-BUILD-SYSTEM  UPGRADING

CODING_STANDARDS  INSTALL          netware              README.namespaces                 run-tests.php              UPGRADING.INTERNALS

config.guess      install-sh       NEWS                 README.NEW-OUTPUT-API             sapi                       vcsclean

config.sub        LICENSE          pear                 README.PARAMETER_PARSING_API      scripts                    win32

configure         ltmain.sh        php5.spec.in         README.REDIST.BINS                server-tests-config.php    Zend

configure.in      main             php.gif              README.RELEASE_PROCESS            server-tests.php

CREDITS           makedist         php.ini-development  README.SELF-CONTAINED-EXTENSIONS  snapshot

ext               Makefile.frag    php.ini-production   README.STREAMS                    stamp-h.in

[root@zabbix_server php-5.6.40]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-ctype --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fpm

[root@zabbix_server php-5.6.40]# make && make install

[root@zabbix_server php-5.6.40]# ls /usr/local/php/

bin  etc  include  lib  php  sbin  var

[root@zabbix_server php-5.6.40]# ls

acinclude.m4      config.status    genfiles    main                missing        php.ini-development       README.PARAMETER_PARSING_API      README.WIN32-BUILD-SYSTEM  tests

aclocal.m4        config.sub       header      makedist            mkinstalldirs  php.ini-production        README.REDIST.BINS                run-tests.php              travis

build             configure        include     Makefile            modules        README.EXT_SKEL           README.RELEASE_PROCESS            sapi                       TSRM

buildconf         configure.in     INSTALL     Makefile.frag       netware        README.GIT-RULES          README.SELF-CONTAINED-EXTENSIONS  scripts                    UPGRADING

buildconf.bat     CREDITS          install-sh  Makefile.fragments  NEWS           README.input_filter       README.STREAMS                    server-tests-config.php    UPGRADING.INTERNALS

CODING_STANDARDS  ext              libs        Makefile.gcov       pear           README.MAILINGLIST_RULES  README.SUBMITTING_PATCH           server-tests.php           vcsclean

config.guess      EXTENSIONS       libtool     Makefile.global     php5.spec      README.md                 README.TESTING                    snapshot                   win32

config.log        footer           LICENSE     Makefile.objects    php5.spec.in   README.namespaces         README.TESTING2                   stamp-h.in                 Zend

config.nice       generated_lists  ltmain.sh   makerpm             php.gif        README.NEW-OUTPUT-API     README.UNIX-BUILD-SYSTEM          stub.c

[root@zabbix_server php-5.6.40]# cp php.ini-production /usr/local/php/etc/php.ini    #拷贝php的配置文件

[root@zabbix_server php-5.6.40]# mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf  #改名php-fpm配置文件

[root@zabbix_server php-5.6.40]# cd

[root@zabbi

  • 15
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维实战课程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值