November 2024

Install and configure SNMP on RHEL or CentOS

  • Published in SNMP
  • January 10, 2013

 

This guide describe howto install and do a basic configure of SNMP on a RedHat Enterprise Linux or CentOS. Probably it will work on many other *nix systems.

1. Installation

Run command yum install net-snmp-utils

[root@dull etc]# yum install net-snmp-utils
Loading "fastestmirror" plugin
Loading "dellsysidplugin" plugin
...
...
Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 net-snmp-utils          i386       1:5.3.1-24.el5_2.2  updates           182 k
Installing for dependencies:
 net-snmp                i386       1:5.3.1-24.el5_2.2  updates           698 k

Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 879 k
Is this ok [y/N]: y

Answer y

Downloading Packages:

(1/2): net-snmp-utils-5.3 100% |=========================| 182 kB    00:02
(2/2): net-snmp-5.3.1-24. 100% |=========================| 698 kB    00:06
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing: net-snmp                     ######################### [1/2]
  Installing: net-snmp-utils               ######################### [2/2]
Installed: net-snmp-utils.i386 1:5.3.1-24.el5_2.2
Dependency Installed: net-snmp.i386 1:5.3.1-24.el5_2.2
Complete!

Now it is installed

 

 

2. Configure

I’m careful so I do a backup of the snmpd config file.

[root@dull ~]# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org 

Create a new config file.

[root@dull ~]# vi /etc/snmp/snmpd.conf
rocommunity  public
syslocation  "PDC, Peters DataCenter"
syscontact  This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTMLebcb524746921767fb3ba3b80c91887e16%

Start the snmpd service

[root@dull ~]# /etc/init.d/snmpd start

Do a snmpwalk to make sure it is working

[root@dull ~]# snmpwalk -v 1 -c public -O e 127.0.0.1
SNMPv2-MIB::sysDescr.0 = STRING: Linux dull 2.6.18-92.1.17.el5 #1 SMP Tue Nov 4 13:45:01 EST 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (16748) 0:02:47.48
SNMPv2-MIB::sysContact.0 = STRING: This email address is being protected from spambots. You need JavaScript enabled to view it.%MINIFYHTMLebcb524746921767fb3ba3b80c91887e17%SNMPv2-MIB::sysName.0 = STRING: dull
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCentral"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
...
...

Yes, it is working

And finally, make sure snmpd starts next time you restart your machine.

[root@dull ~]# chkconfig snmpd on

 

3. Monitor example

Below is an example of how it looks using op5 Monitor a Nagios based Enterprise Monitor solution.

Read more...

add a user to the sudoers linux为用户添加sudo权限

  • Published in CentOS 6
  • January 9, 2013

 

用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权限使用sudo,我们只要修改一下/etc/sudoers文件就行了。下面是修改方 法:

1)进入超级用户模式。也就是输入"su -",系统会让你输入超级用户密码,输入密码后就进入了超级用户模式。(当然,你也可以直接用root用) 
2)添加文件的写权限。也就是输入命令"chmod u+w /etc/sudoers"。 
3)编辑/etc/sudoers文件。也就是输入命令"vim /etc/sudoers",输入"i"进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的xxx是你的用户名),然后保存(就是先按一 下Esc键,然后输入":wq")退出。 
4)撤销文件的写权限。也就是输入命令"chmod u-w /etc/sudoers"。

Read more...

英特尔RST服务未在运行 2008 r2

.net 3.51 did the trick.

.net 4  is NOT enough.

 

你必须用角色管理工具安装Microsoft .NET Framework 3.5

当你试着在Windows 2008 R2上安装Visual Studio 2008,你可以会遇到下面的情况:

这是因为Windows 2008 R2已装集成了 .NET 3.5.1 framework,你只需通过Server Manager加起这个feature就可以了。

 

打开Server Manager 找到结点Add Features Wizard 勾选.NET Framework 3.5.1 Features ,这个问题同样发生在单独安装

.NET 3.5.1 framework 安装包。

Read more...

CentOS Linux: Fix bash: ntpdate: command not found centos

  • Published in CentOS 6
  • December 27, 2012

First you have to install ntp:

Run as root:

yum install ntp

Then if you run ntpdate again you might get the error again. You can run ntpdate with:

/usr/sbin/ntpdate 2.pool.ntp.org

Replace 2.pool.ntp.org with another server if that doesn’t work.

If you get a ntpdate[585863]: the NTP socket is in use, exiting Error, then run:

/etc/init.d/ntpd stop

Took me 10 precious minutes to update the time in a server … That’s a lot!

Read more...

proftp 权限

  • Published in CentOS 6
  • December 26, 2012

.ftpaccess

 

DeleteAbortedStores off

Umask 000

GroupOwner root

<Limit RMD DELE RNFR RETR READ>

Denyall

</Limit>

Order allow,deny

Allow from xxx.xxx.xxx.xxx

Deny from all

 

Read more...

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558)

  • Published in MYSQL
  • December 25, 2012

mysqldump: Couldn’t execute ‘SHOW FUNCTION STATUS WHERE Db = ‘your-db-here”: Column count of mysql.proc is wrong. Expected 20, found 16. Created with MySQL 50077, now running 50152. Please use mysql_upgrade to fix this error. (1558)

 

/usr/bin/mysql_upgrade -uxxxx -pxxxxxx

 

如果你的webmin/virtualmin自动备份出现下面的错误,那么,就是mysql升级后没有做mysql_upgrade 表修复。 在新版下执行mysql_upgrade命令,其实这个命令包含一下三个命令:


# mysqlcheck –check-upgrade –all-databases –auto-repai

# mysql_fix_privilege_tables

# mysqlcheck –all-databases –check-upgrade –fix-db-names –fix-table-names

Note: 在每一次的升级过程中,mysql_upgrade这个命令我们都应该去执行,它通过mysqlcheck命令帮我们去检查表是否兼容新版本的数据库同时作出修复,还有个很重要的作用就是使用mysql_fix_privilege_tables命令去升级权限表。

 

Read more...

proftpd 配置可以上传,但无法删除的特殊权限

  • Published in CentOS 6
  • December 25, 2012

常见的特殊的需求:
对于FTP服务器上的某个部门的目录,要求:
部门所有人员可以上传下载但无法删除(包括文件和目录)
部门领导全部权限(包括删除)
用redhat自带的vsftp实现起来比较困难,google了以后发现proftpd实现起来比较简单
 
例如:
客服部
部门成员member,可以上传下载,但是无法删
部门主管manager,有全部权限

下载安装:
因为是CENTOS,直接下载rpm安装
wget http://packages.sw.be/proftpd/proftpd-1.3.2-1.el5.rf.i386.rpm
 
安装之后
主目录在/var/ftp
配置文件为 /etc/proftpd.conf
服务名为 proftpd
 
直接启动服务的情况是:
系统用户直接登录,且被chroot在"家目录"下
匿名用户无法登陆
 
设计实施:
部门的目录放在/var/ftp/kefu(客服部),部门人员登录后被chroot在此目录下
目录的所有者是主管manager
目录的所有组是kefu
目录权限为770(只有此部门的人员才可以进此目录)
 
设置如下:
/var/ftp下的kefu目录
drwxrwx--- 2 manager kefu 4096 Mar  3 13:11 kefu
/etc/passwd文件的设置(将他们的主目录设为/var/ftp/kefu,shell改为/sbin/nologin不允许ssh)
manager:x:501:502::/var/ftp/kefu:/sbin/nologin
member:x:502:503::/var/ftp/kefu:/sbin/nologin
新建kefu组,member是组员
 
配置文件proftpd.conf

 

  1. <Directory /var/ftp/kefu> 对这个目录进行限制  
  2.  umask 000  
  3.   <Limit DELE RMD>  
  4.        DenyGroup kefu  
  5.   </Limit>  
  6. </Directory>   

 

解释:

  1.  umask 000 
  2.  此目录下所有用户上传的掩码都是000,这样新文件权限是666,新文件夹是777,这样做是为了保证member传的文件,其他人也可以删,默认掩码是022 
  3.   
  4. <Limit DELE RMD> 
  5.     DenyGroup kefu 
  6. 此目录下对于DELE(删除文件)RMD(删除目录)操作加以限制,对kefu组是拒绝,也就保证了kefu组成员无法执行删除操作.如果需要对单个用户(例如member)限制就用 DenyUser member 
  7.  其实就是无法执行(DELE ,RMD)这两个ftp指令  



 
整个思路:
通过系统权限来允许所有的文件都可以对任何人读写(就是非创建者也可以删)
通过限制FTP指令的执行来限制特定的用户(组)无法执行删除
总的来说就是利用两个层面的限制实现对权限”先放,后收”

Read more...
Subscribe to this RSS feed
Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34