Python開發(fā)環(huán)境搭建(5):SNMP

使用的系統(tǒng)為Redhat 7.6 的64位,使用Net-SNMP 5.7版本

創(chuàng)新互聯(lián)是專業(yè)的神農(nóng)架林區(qū)網(wǎng)站建設(shè)公司,神農(nóng)架林區(qū)接單;提供成都做網(wǎng)站、網(wǎng)站建設(shè),網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行神農(nóng)架林區(qū)網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!

  1. 安裝MySQL包
    rpm -ivh mysql-community-libs-compat*
    不安裝這個包會出現(xiàn)如下報錯
    Python 開發(fā)環(huán)境搭建(5):SNMP

  2. 安裝

    cd /mnt/Packages
    rpm -ivh net-snmp
    yum install -y net-snmp-perl
    yum install -y net-snmp-utils
    yum install -y net-snmp-devel
    yum install -y net-snmp-lib
  3. 驗證
    可以使用下面的命令去驗證你是否成功安裝了Net-SNMP,如果你可以獲取到正確的版本號,說明你已經(jīng)成功安裝了Net-SNMP
    snmpget --version
    Python 開發(fā)環(huán)境搭建(5):SNMP

  4. 配置snmpd.conf
    vi /etc/snmp/snmpd.conf

    ###############################################################################
    # Access Control
    ###############################################################################
    # First, map the community name "public" into a "security name"
    #       sec.name  source          community
    com2sec notConfigUser  default       public
    # Second, map the security name into a group name:
    #       groupName      securityModel securityName
    group   notConfigGroup v1           notConfigUser
    group   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  notif
    access  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                          mask
    view all    included  .1                               80
    ###############################################################################
    # 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 <root@localhost> (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
  5. 運行snmpd 且開機自啟動

    chkconfig snmpd on
    systemctl start snmp
  6. 可通過如下命令檢查snmpd是否啟動
    netstat -na | grep 161
    Python 開發(fā)環(huán)境搭建(5):SNMP

    ps aux | grep snmp
    Python 開發(fā)環(huán)境搭建(5):SNMP

  7. 測試snmpd
    可以用如下的幾個命令獲取系統(tǒng)開機時間,如果有正確的返回則說明snmp運行正常
    snmpwalk -v 2c -c public localhost sysUpTime.0
    Python 開發(fā)環(huán)境搭建(5):SNMP

配置python獲取netsnmp

pip install client

pip install python3-netsnmp

新聞標題:Python開發(fā)環(huán)境搭建(5):SNMP
當前網(wǎng)址:http://muchs.cn/article14/ihdpde.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、微信小程序網(wǎng)站設(shè)計、電子商務(wù)、營銷型網(wǎng)站建設(shè)Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)