ubuntu18.04 install python

The first part: Install snmp program and service.

There are two ways to install snmp support in Ubuntu. The first is to install it directly through apt-get. The second is to download the source code net-snmp-5.7.3.tar.gz from the netsnmp official website, and compile and install it.

Regarding the second method, I have checked the methods on the Internet. Unfortunately, I have not succeeded in the end, so I recommend the first method here.

The first step is to install snmpd, snmp, and snmp-mibs-downloader

snmpd is a process that monitors the snmp service, binds to a certain port, waits for the SNMP request from the requester, processes it, and returns information to the requester.

snmp is the snmp command set of a requester.

snmp-mibs-downloader

The following is the installation command:

~$sudo apt-get install snmp

~$sudo apt-get install snmpd

~$sudo apt-get install snmp-mibs-download

The second step is to start the snmpd service

~$sudo service snmpd restart

Finally, test whether the following is successful

~$snmpwalk -v 2c -c public localhost

If the data is returned correctly, it means that the installed snmp can be used normally.

The second part: install the python programming package corresponding to netsnmp.

Here is mainly to install netsnmp-py, https://pypi.org/project/netsnmp-py/.

First, install the corresponding dependent libraries.

~$sudo apt-get install libsnmp30 libsnmp-dev libczmq-dev

The name of libsnmp-dev libczmq-dev cannot be wrong, otherwise it will not be found.

Second, install pyzmq, pyczmq. http://pyzmq.readthedocs.io/en/latest/index.html

~$sudo pip install pyczmq

Next, install netsnmp-py and you are done.

~$sudo pip install netsnmp-py

Finally, it is to test whether the netsnmp-py function is available in python in the program.

In netsnmp-py, a SNMPSession class is provided, which provides three basic functions get/getnext/walk.

For details, please refer to: sample in usr/local/lib/python3.6/dist-packages/netsnmp/init.py.

example:

~$python

Python 3.6.5 (default, Apr 1 2018, 05:46:30) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import netsnmp >>> with netsnmp.SNMPSession('localhost', 'public') as ss: ... ss.get(['.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0']) ... [('.1.3.6.1.2.1.1.1.0', 'STRING', '"Linux laosierLinux 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64"'), ('.1.3.6.1.2.1.1.3.0', 'Timeticks', '0:3:13:31.57')] >>>

If the above information is returned, haha, I wish you success.

Recommended Posts

ubuntu12.04 install python3
ubuntu18.04 install python
Install python3.6 under Ubuntu 16.04
Install Python3 on Ubuntu 14.04
Install python in Ubuntu
Install Python3 on Ubuntu 16.04
Install Python3.7 on Ubuntu
Ubuntu install the latest Python 3.
Install Python 3.7 on Ubuntu 18.04 LTS
ubuntu18.04 compile and install python3.8
Centos6 install Python2.7.13
Ubuntu16 upgrade Python3
Centos7 install Python 3.6.
Relearn ubuntu --python3
ubuntu18.04 install docker
CentOS install Python 3.6
Ubuntu install guide
Centos7 install Python2.7
ubuntu install nodejs
ubuntu 16 install asp.net
ubuntu install leanote
How to install Python 3.8 on Ubuntu 18.04
ubuntu install Jenkins
docker install ubuntu
Install Python virtual environment on Ubuntu 18.04
Centos install Python3
Install TensorFlow (python2.7 version) on Ubuntu
ubuntu16.0.1 install pagoda
CentOS6.8 install python2.7
ubuntu 18.04 install teamviewer
ubuntu install sendmail
ubuntu16.04 upgrade python2
How to install Python2 on Ubuntu20.04 ubuntu/focal64
Use python3 to install third on ubuntu
Ubuntu18.04 switch Python version
Install apache+PHP under Ubuntu
install vscode on ubuntu18
Install node.js under Ubuntu
ubuntu install zsh terminal
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
ubuntu configuration python, Red
Install docker on Ubuntu
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Ubuntu16.04 switch python version
Python MySQLd under Ubuntu
Install nodejs10 on Ubuntu16
ubuntu install harbor warehouse
[python] python2 and python3 under ubuntu
Install mysql on Ubuntu 14.04
Install Pytorch+CUDA on Ubuntu 16.04
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
Python virtual environment: Ubuntu16.04
ubuntu16.04 install node.js, npm
Install rJava on Ubuntu18
Install JDK10+ on Ubuntu
pcduino ubuntu install os