How to install snmpd service for Ubuntu

msitesdev|April 18,2014

SNMPDis the service runningSNMPon a managed entity. SNMP comes in 3 versions. Version 1,the one we are going to use here is not secured,therefore we are going to make sure that only localhost is going to be able to access it.
People opening the service to the outside should make sure that trusted hosts can access the service either though the use ofiptablesor through the use of/etc/hosts.allow.

TheNET-SNMP projectprovides varIoUs SNMP tools: an extensible agent,an SNMP library,tools for requesting or setting information from SNMP agents,tools for generating and handling SNMP traps,a version of the netstat command which uses SNMP,and a Tk/Perl mib browser. The snmpd package contains the snmpd and snmptrapd daemons,documentation,etc.

1.1. Installing the SNMP server

The only package which is required on the server site issnmpd,the SNMP daemon.

To install it type:

$sudo apt-get installsnmpd

snmpd is Now installed but we still have to tweak it a little bit to make it work as we want.

1.2. Configuring SNMPD

The default configuration for snmpd is rather paranoid for security reasons. Edit/etc/snmp/snmpd.confor run snmpconf to allow greater access. You can individually control whether or not snmpd and snmpdtrap are run by editing/etc/default/snmpd.

Configure SNMPD

Edit /etc/snmp/snmpd.conf,enter:
#sudo gedit/etc/snmp/snmpd.conf
Edit or update file as follows:

smuxsocket 127.0.0.1
rocommunity setMeHere
com2sec local     localhost           public
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
view all    included  .1                               80
access MyRWGroup ""      any       noauth    exact  all    all    none

com2sec notConfigUser  default       mrtg
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
view    systemview    included  .1                               80
access  notConfigGroup ""      any       noauth    exact  systemview none none

syslocation athens Greece
syscontact Ubuntu.gr <info@ubuntu.gr>

See snmpd.conf(5) man page for details. Edit /etc/default/snmpd,enter:
#sudo gedit/etc/default/snmpd
Update it as follows:

# This file controls the activity of snmpd and snmptrapd

# MIB directories.  /usr/share/snmp/mibs is the default,but
# including it here avoids some strange problems.
export MIBDirs=/usr/share/snmp/mibs


# snmpd control (yes means start daemon).
SNMPDRUN=yes

# snmpd options (use syslog,close stdin/out/err).
# 
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid '


# snmptrapd control (yes means start daemon).  As of net-snmp version
# 5.0,master agentx support must be enabled in snmpd before snmptrapd
# can be run.  See snmpd.conf(5) for how to do this.
TRAPDRUN=no

# snmptrapd options (use syslog).

TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'

# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes

Restart Snmpd Service

Type the following command:
#sudo /etc/init.d/snmpd restart
Sample outputs:

Restarting network management services: snmpd.

1.3. Checking SNMP configuration:

We are going to use thesnmpwalkutility to verify that the server is working as wanted.

$snmpwalk-v 1 -c mrtg 10.xxx.xxx.xxx

Should return a lot of output

Source:http://www.cyberciti.biz/faq/debain-ubuntu-install-net-snmpd-server/

How to configure SNMPv3 in ubuntu 13.10 server

Install SNMP server and client in ubuntu

Open the terminal and run the following command

sudo apt-get install snmpd snmp

After installation you need to do the following changes.

Configuring SNMPv3 in Ubuntu

Get access to the daemon from the outside.

The default installation only provides access to the daemon for localhost. In order to get access from the outside open the file /etc/default/snmpd in your favorite editor

sudo vi /etc/default/snmpd

Change the following line

From

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /var/run/snmpd.pid’

to

SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf’

and restart snmpd

sudo /etc/init.d/snmpd restart

Define SNMPv3 users,authentication and encryption parameters

SNMPv3 can be used in a number of ways depending on the “securityLevel” configuration parameter:

noAuthnopriv — No authorisation and no encryption,basically no security at all!
authnopriv — Authorisation is required but collected data sent over the network is not encrypted.
authPriv — The strongest form. Authorisation required and everything sent over the network is encrypted.

The snmpd configuration settings are all saved in a file called /etc/snmp/snmpd.conf. Open this file in your editor as in:

sudo vi /etc/snmp/snmpd.conf

Add the following lines to the end of the file:

#
createuser user1
createuser user2 MD5 user2password
createuser user3 MD5 user3password DES user3encryption
#
rouser user1 noauth 1.3.6.1.2.1.1
rouser user2 auth 1.3.6.1.2.1
rwuser user3 priv 1.3.6.1.2.1

Note:- If you want to use your own username/password combinations you need to note that the password and encryption phrases should have a length of at least 8 characters

Also you need to do the following change so that snmp can listen for connections on all interfaces

From

#agentAddress udp:161,udp6:[::1]:161

to

agentAddress udp:161,udp6:[::1]:161

Save your modified snmpd.conf file and restart the daemon with:

sudo /etc/init.d/snmpd restart

Tags:snmp

How to install snmpd service for Ubuntu的更多相关文章

  1. iOS – 友好的NSDate格式

    我需要在我的应用程序中显示帖子的日期给用户,现在我用这种格式:“5月25日星期五”.如何格式化NSDate以阅读“2小时前”的内容?使其更加用户友好.解决方法NSDateFormatter不能做这样的事情;你将需要建立自己的规则.我想像:所以这是打印’x分钟前’或’x小时前’从日期起24小时,通常是一天.

  2. 记一次云计算测试实验-openstack-icehouse-安装swift

    -----------------------controller:---------------------------------sourceadmin-openrc.shkeystoneuser-create--name=swift--pass=000000--email=swift@localhostkeystoneuser-role-add--user=swift--tenant=ser

  3. android – 模拟器中hosts文件中的Url映射被忽略

    我正在使用genymotion仿真器,并使用它从主机文件中提取adbremountadbpull/system/etc/hostsC:\Users\Rkn09\Desktop\hosts我添加了新的映射192.168.0.115xxx.mydomain.com,我把它推回到模拟器使用adbpushC:\Users\Rkn09\Desktop\hosts/system/etc/hosts但是当我向x

  4. Python封装SNMP调用接口的示例代码

    PySNMP 是一个纯粹用Python实现的SNMP,用PySNMP的最抽象的API为One-line Applications。本文为大家分享了Python封装SNMP调用接口的示例代码,需要的可以参考一下

  5. 如何删除零计数和don&#39;不要在Zabbix上显示它们的图形?

    我已经为此创建了发现项,但有一个问题,该设备有多个{ENT_NAME}。其中一个ENT_NAME有关于正常运行时间的信息,但没有关于cpu和temp的信息(显示0)。因此,Zabbix显示了一些未使用的图形。

  6. centos – 原因:(noSuchName)此MIB中没有此类变量名称

    我正在使用centos操作系统.我试图通过snmpget命令获取localhost的内存统计信息,我收到此错误.但是,如果我解雇了这个…

  7. centos – 如何使用zabbix获取所有SNMP项目?

    场景:操作系统:CentOS7.2Zabbix版本:3.0尝试使用SNMP协议监控某些交换机我能够毫无问题地监控它们,所有项目都正常工作,一切都很好但添加每一项都是痛苦的屁股而且我现在不浪费时间所以我开始谷歌搜索,发现ZabbixExtras,其中似乎解决了我的问题,但还没有,因为最后一个版本适用于Zabbix2.4.无论如何,我试图安装它,但正如预期的那样,根本没有成功.我一直试图找到一个替代方案,到目前为止得到任何东西,所以这基本上是我的最后一次机会……

  8. CentOS 7 SNMP端口始终关闭

    我有一个CentOS7服务器,我打开了SNMP连接的端口.即使我可以在这里看到端口打开:当我试图从外面击中这个端口时,我总是得到关闭它.即使是nmap也同意这一点:我还能做些什么来打开这些端口?SNMP是UDP协议,而不是TCP协议.所以你需要打开UDP端口,即161/udp.更好的是,只需指定服务名称,firewalld将负责处理.

  9. centos – 如何使用SSH列出所有FTP用户名

    我有一个CentOS5.5服务器.如何使用SSH获取服务器上所有FTP用户的列表?首先,无论你是在本地还是远程执行此操作,都无论如何都要在打开的会话期间进行shell访问.如果您只想在远程计算机上执行单个命令并断开连接,则可以在引号内指定它:但是,您几乎没有选项列出特定组中的所有用户:使用getent工具:旧时尚方式:使用家庭酿造脚本,您可以根据自己的需要进行调整:此脚本已从here中删除.

  10. 无法在Centos 6.4 64bit中使用yum安装mysql / mysql-server

    )areallowed.

随机推荐

  1. crontab发送一个月份的电子邮件

    ubuntu14.04邮件服务器:Postfixroot收到来自crontab的十几封电子邮件.这些邮件包含PHP警告.>我已经解决了这些警告的原因.>我已修复每个cronjobs不发送电子邮件(输出发送到>/dev/null2>&1)>我删除了之前的所有电子邮件/var/mail/root/var/spool/mail/root但我仍然每小时收到十几封电子邮件.这些电子邮件来自cronjobs,

  2. 模拟两个ubuntu服务器计算机之间的慢速连接

    我想模拟以下场景:假设我有4台ubuntu服务器机器A,B,C和D.我想在机器A和机器C之间减少20%的网络带宽,在A和B之间减少10%.使用网络模拟/限制工具来做到这一点?

  3. ubuntu-12.04 – 如何在ubuntu 12.04中卸载从源安装的redis?

    我从源代码在Ubuntu12.04上安装了redis-server.但在某些时候它无法完全安装,最后一次makeinstallcmd失败.然后我刚刚通过apt包安装.现在我很困惑哪个安装正在运行哪个conf文件?实际上我想卸载/删除通过源安装的所有内容,只是想安装一个包.转到源代码树并尝试以下命令:如果这不起作用,您可以列出软件自行安装所需的步骤:

  4. ubuntu – “apt-get source”无法找到包但“apt-get install”和“apt-get cache”可以找到它

    我正在尝试下载软件包的源代码,但是当我运行时它无法找到.但是当我运行apt-cache搜索squid3时,它会找到它.它也适用于apt-getinstallsquid3.我使用的是Ubuntu11.04服务器,这是我的/etc/apt/sources.list我已经多次更新了.我尝试了很多不同的debs,并没有发现任何其他地方的错误.这里的问题是你的二进制包(deb)与你的源包(deb-src)不

  5. ubuntu – 有没有办法检测nginx何时完成正常关闭?

    &&touchrestarted),因为即使Nginx没有完成其关闭,touch命令也会立即执行.有没有好办法呢?这样的事情怎么样?因此,pgrep将查找任何Nginx进程,而while循环将让它坐在那里直到它们全部消失.你可以改变一些有用的东西,比如睡1;/etc/init.d/Nginx停止,以便它会休眠一秒钟,然后尝试使用init.d脚本停止Nginx.你也可以在某处放置一个计数器,这样你就可以在需要太长时间时发出轰击信号.

  6. ubuntu – 如何将所有外发电子邮件从postfix重定向到单个地址进行测试

    我正在为基于Web的应用程序设置测试服务器,该应用程序发送一些电子邮件通知.有时候测试是使用真实的客户数据进行的,因此我需要保证服务器在我们测试时无法向真实客户发送电子邮件.我想要的是配置postfix,以便它接收任何外发电子邮件并将其重定向到一个电子邮件地址,而不是传递到真正的目的地.我正在运行ubuntu服务器9.10.先感谢您设置本地用户以接收所有被困邮件:你需要在main.cf中添加:然后

  7. ubuntu – vagrant无法连接到虚拟框

    当我使用基本的Vagrantfile,只配置了两条线:我看到我的虚拟框打开,但是我的流氓日志多次显示此行直到超时:然后,超时后的一段时间,虚拟框框终于要求我登录,但是太久了!所以我用流氓/流氓记录.然后在我的物理机器上,如果我“流氓ssh”.没有事情发生,直到:怎么了?

  8. ubuntu – Nginx – 转发HTTP AUTH – 用户?

    我和Nginx和Jenkins有些麻烦.我尝试使用Nginx作为Jenkins实例的反向代理,使用HTTP基本身份验证.它到目前为止工作,但我不知道如何传递带有AUTH用户名的标头?}尝试将此指令添加到您的位置块

  9. Debian / Ubuntu – 删除后如何恢复/ var / cache / apt结构?

    我在ubuntu服务器上的空间不足,所以我做了这个命令以节省空间但是现在在尝试使用apt时,我会收到以下错误:等等显然我删除了一些目录结构.有没有办法做apt-getrebuild-var-tree或类似的?

  10. 检查ubuntu上安装的rubygems版本?

    如何查看我的ubuntu盒子上安装的rubygems版本?只是一个想法,列出已安装的软件包和grep为ruby或宝石或其他:)dpkg–get-selections

返回
顶部