Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Construction of Python development environment (5): SNMP

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The system used is Redhat 7.6 64-bit, using Net-SNMP version 5.7

Install the MySQL package

Rpm-ivh mysql-community-libs-compat*

If you do not install this package, you will get the following error

Installation

Cd / mnt/Packagesrpm-ivh net-snmpyum install-y net-snmp-perlyum install-y net-snmp-utilsyum install-y net-snmp-develyum install-y net-snmp-lib

Verification

You can use the following command to verify that you have successfully installed Net-SNMP. If you can get the correct version number, you have successfully installed Net-SNMP.

Snmpget-version

Configure snmpd.conf

Vi / etc/snmp/snmpd.conf

# Access Control## # # First Map the community name "public" into a "security name" # sec.name source communitycom2sec notConfigUser default public# Second, map the security name into a group name:# groupName securityModel securityNamegroup notConfigGroup v1 notConfigUsergroup notConfigGroup V2C notConfigUser# Third Create a view for us to let the group have rights to:# Make at least snmpwalk-v 1 localhost-c public system fast again.# name incl/excl subtree mask (optional) # view systemview included. 1.3.6.1.2.1.1#view systemview included .1.3.6.1.2.1.25.1.1 # Finally Grant the group read-only access to the systemview view.# group context sec.model sec.level prefix read write notifaccess notConfigGroup "" any noauth exact all none none# -# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY# KNOWN AT YOUR SITE. YOU * MUST* CHANGE THE NETWORK TOKEN BELOW TO# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.## incl/excl subtree maskview all included. 180 years # # System contact information## It is also possible to set the sysContact and sysLocation system# variables through the snmpd.conf file:syslocation Unknown (edit / etc/snmp/snmpd.conf) syscontact Root (configure / etc/snmp/snmp.local.conf) # # # # Logging## We do not want annoying "Connection from UDP:" messages in syslog.# If the following option is commented out Snmpd will print each incoming# connection, which can be useful for debugging.dontLogTCPWrappersConnects yes####com2sec notConfigUser localhost Server_pu

Run snmpd and boot automatically

Chkconfig snmpd onsystemctl start snmp

You can check whether snmpd is started by using the following command

Netstat-na | grep

Or

Ps aux | grep snmp

Test snmpd

You can use the following commands to obtain the boot time of the system. If a correct response is returned, the snmp is running normally.

Snmpwalk-v 2c-c public localhost sysUpTime.0

Configure python to get netsnmp

Pip install client

Pip install python3-netsnmp

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report