Zabbix-snmp

1. SNMP监控


SNMP  简单网络管理协议    simple  network  management  protocol

为不同的种类的设备,不同厂家生产的设备,定义为一个统一的接口和协议。为了提高网络管理的效率。

工作在UDP 161端口,用于监控目标设备的操作系统、硬件设备、服务应用、软硬件配置、网络协议状态、设备性能及资源利用率、设备报错事件信息、应用程序状态等软硬件信息。


路由器    交换机    打印机     linux   windows  Unix   
华三   华为    思科    IP地址   +  SNMP协议 

身份标识符:
OID  object  ID   对象的标识符 
系统中第一个CPU  空闲状态  负载状态  IO等待状态
.1    .1.1   .1.2  .1.3

系统中第一个CPU  空闲状态  负载状态  IO等待状态
.2      .2.1   .2.2   .2.3  

MIB   存放OID信息  


linux中常见的设备的OID信息
#安装服务端

[root@web02 ~]# yum install -y  net-snmp

com2sec notConfigUser  default      123456          #添加密码 

view    systemview    included   .1                    #添加此行  查看的设备OID分支

[root@web02 ~]# systemctl  enable  snmpd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/snmpd.service to /usr/lib/systemd/system/snmpd.service.
[root@web02 ~]# systemctl  start   snmpd.service 

[root@web02 ~]# netstat  -lntup | grep 161
udp        0      0 0.0.0.0:161             0.0.0.0:*                           68707/snmpd         

#安装客户端

[root@zabbix-server ~]# yum install -y  net-snmp-utils

#使用方法:  

      -v 1|2c|3        specifies SNMP version to use        #snmp协议版本    2c  

      -c COMMUNITY        set the community string        #密码 

[root@zabbix-server ~]# snmpwalk  -v 2c  -c 123456  10.0.0.8  .1.3.6.1.4.1.2021.11.11.0
UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 99
[root@zabbix-server ~]# 
[root@zabbix-server ~]# snmpwalk  -v 2c  -c 123456  10.0.0.8  .1.3.6.1.2.1.2.2.1.6
IF-MIB::ifPhysAddress.1 = STRING: 
IF-MIB::ifPhysAddress.2 = STRING: 0:c:29:f7:1e:da
IF-MIB::ifPhysAddress.3 = STRING: 0:c:29:f7:1e:e4

#显示所有监控的值
[root@zabbix-server ~]# snmpwalk  -v 2c  -c 123456  10.0.0.8

2. Zabbix的硬件监控及网站分析


物理硬件监控:

    CPU温度   风扇的转速  主板的温度  电压  功率   机房巡检   监控不了硬盘的情况   

    IPMI  

    ipmitool  命令行获取这些信息  

[root@web01 ~]# yum install -y ipmitool


[root@web01 ~]# /usr/bin/ipmitool -I lanplus -H 10.0.0.7  -U sysadmin -P admin chassis status
Error: Unable to establish IPMI v2 / RMCP+ session
[root@web01 ~]# ipmitool –I open sensor list
Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory

https://blog.csdn.net/zygblock/article/details/53367664


PV UV IP监控

根据日志进行分析  

开源软件:

    piwik   ====   matomo    自己搭建的

    js代码    开发写的

    Awstates   是一个免费的强大而有个性的工具,带来先进的网络,流量,FTP或邮件服务器统计图。

    GoAccess   基于终端的日志分析器   

第三方统计:

    腾讯分析    https://ta.qq.com/

    百度统计

    谷歌分析

[root@web01 /code]# cat /etc/nginx/conf.d/default.conf
server {
    listen       80;
    server_name  localhost;
    root   /code/discuz/upload;
    location / {
        index  index.php index.html;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

[root@web01 /code]# groupadd  -g666 www
[root@web01 /code]# useradd  -u666 -g666 www
[root@web01 /code]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@web01 /code]# systemctl  restart nginx


[root@web01 /code]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2895
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database discuz;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> 

[root@web01 /code]# mv Discuz_X3.3_SC_UTF8.zip  /tmp/
[root@web01 /code]# ll
total 4
drwxr-xr-x  2 root root  102 2017-07-27 17:18 readme
drwxr-xr-x 12 root root 4096 2017-07-27 17:18 upload
drwxr-xr-x  4 root root   72 2017-07-27 17:18 utility
[root@web01 /code]# mkdir discuz
[root@web01 /code]# mv u* discuz/
[root@web01 /code]# mv readme/ discuz/

[root@web01 /code]# chown  -R www.www discuz/



matomo  #应用在LNMP架构上的
[root@web01 /etc/nginx/conf.d]# cat matomo.conf
server {
    listen       80;
    server_name  matomo.qls.com;
    root   /code/matomo;
    location / {
        index  index.php index.html;
    }
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}


[root@web01 /code]# rz

[root@web01 /code]# ll
total 18924
drwxr-xr-x 5 www  www        49 2020-03-30 14:40 discuz
-rw-r--r-- 1 root root 19375918 2020-03-24 12:25 matomo-latest.zip
[root@web01 /code]# unzip -q matomo-latest.zip 
[root@web01 /code]# ll
total 18932
drwxr-xr-x  5 www  www        49 2020-03-30 14:40 discuz
-rw-r--r--  1 root root      341 2020-03-24 12:25 How to install Matomo.html
drwxr-xr-x 12 root root     4096 2020-03-24 12:25 matomo
-rw-r--r--  1 root root 19375918 2020-03-24 12:25 matomo-latest.zip
[root@web01 /code]# chown  -R www.www matomo

[root@web01 /code]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3034
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database matomo;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on *.* to matomo@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> 


[root@web01 ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3265
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> drop user matomo@'localhost';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> grant all on *.* to matomo@'10.0.0.%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> 



###安装php7.2版本
yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-gd php72w-mcrypt php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache php72w-pecl-memcached php72w-pecl-redis php72w-pecl-mongodb
Copyright © 高程程 all right reserved,powered by Gitbook修订于: 2021-05-18 21:14:55

results matching ""

    No results matching ""