当前位置: 首页> 娱乐> 明星 > Centos7.9下的snmp搭建及实例

Centos7.9下的snmp搭建及实例

时间:2025/7/18 17:05:35来源:https://blog.csdn.net/z19861216/article/details/141467567 浏览次数:0次

1.测试环境

在VMware上安装两台Centos7系统,一台作为SNMP NMS(IP:192.168.10.131),一台作为:SNMP Agent(IP:192.168.10.245),分别在其系统上安装snmp服务

2.基础环境配置

为了防止防火墙及selinux等的影响,需关闭防火墙及selinux等,具体参考:

Linux常规基础配置_linux基础配置-CSDN博客

3.安装snmp

yum源配置,具体参考:

Linux常规基础配置_linux基础配置-CSDN博客

3.1.SNMP NMS端安装snmp

snmp安装命令:

yum install -y net-snmp net-snmp-utils

[root@logstash ~]# yum install -y net-snmp net-snmp-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package matching 1:net-snmp-5.7.2-49.el7.x86_64 already installed. Checking for update.
Package matching 1:net-snmp-utils-5.7.2-49.el7.x86_64 already installed. Checking for update.
Nothing to do
[root@logstash ~]# 
[root@logstash ~]# snmpd -vNET-SNMP version:  5.7.2
Web:               http://www.net-snmp.org/
Email:             net-snmp-coders@lists.sourceforge.net[root@logstash ~]# 

3.2.SNMP Agent端安装snmp

snmp安装命令:

yum install -y net-snmp net-snmp-utils

[root@kibana ~]# yum install -y net-snmp net-snmp-utils
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.aliyun.com* epel: d2lzkl7pfhq30w.cloudfront.net* extras: mirrors.aliyun.com* updates: mirrors.aliyun.com
软件包 1:net-snmp-5.7.2-49.el7_9.4.x86_64 已安装并且是最新版本
软件包 1:net-snmp-utils-5.7.2-49.el7_9.4.x86_64 已安装并且是最新版本
无须任何处理
[root@kibana ~]# 
[root@kibana ~]# snmpd -vNET-SNMP version:  5.7.2
Web:               http://www.net-snmp.org/
Email:             net-snmp-coders@lists.sourceforge.net[root@kibana ~]# 

4.配置snmp

4.1.SNMP NMS端安装snmp

1.进入/etc/snmp目录

2.编辑snmpd.conf文件,并保存

#启用社区信息,只允许本主机访问该节点

com2sec notConfigUser  localhost       public
com2sec notConfigUser  192.168.10.131       public

#把用户加入安全组

group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

#可以查看.1下所有OID的对象信息

view    all    included   .1    80

#允许可读权限

access  notConfigGroup ""      any       noauth    exact  all none none

3.启动snmp

命令:

systemctl start snmpd

[root@logstash snmp]# systemctl start snmpd
[root@logstash snmp]# systemctl status snmpd
● snmpd.service - Simple Network Management Protocol (SNMP) Daemon.Loaded: loaded (/usr/lib/systemd/system/snmpd.service; disabled; vendor preset: disabled)Active: active (running) since Fri 2024-08-23 15:07:17 CST; 55min agoMain PID: 12381 (snmpd)Tasks: 1Memory: 5.2MCGroup: /system.slice/snmpd.service└─12381 /usr/sbin/snmpd -LS0-6d -fAug 23 15:07:16 logstash systemd[1]: Starting Simple Network Management Protocol (SNMP) Daemon....
Aug 23 15:07:17 logstash systemd[1]: Started Simp
关键字:Centos7.9下的snmp搭建及实例

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: