Archive

Archive for the ‘Command-Line’ Category

Install and configure SNMP on Ubuntu

19/04/2011 Leave a comment

This guide describe howto install and configure SNMP on Ubuntu.

In an earlier article I have described howto set it up on RHES or CentOS, it is slightly different in Ubuntu.

1.Installation

root@ibsen:~# sudo apt-get install snmpd
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmpich1.0gf libdc1394-22 genisoimage linux-headers-2.6.27-7 libgfortran2 dvd+rw-tools linux-headers-2.6.27-7-generic libcarp-clan-perl libxml-xql-perl libparse-yapp-perl
  rdate python-xml localechooser-data gcc-4.2-base libimage-size-perl libdebconfclient0 libvisual-0.4-0 libmyth-python perlmagick libvisual-0.4-plugins libavdevice52
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libperl5.10 libsensors3 libsnmp-base libsnmp15
Suggested packages:
  lm-sensors
The following NEW packages will be installed:
  libperl5.10 libsensors3 libsnmp-base libsnmp15 snmpd
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 2463kB of archives.
After this operation, 7987kB of additional disk space will be used.
Do you want to continue [Y/n]?

answer y

2. Configuration

Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org

mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org

Create a new /etc/snmp/snmpd.conf file:

rocommunity  public
syslocation  "PDC, Peters DataCenter"
syscontact  peter@it-slav.net

Make snmpd use the newly created file and make it listen to all interfaces:

Edit /etc/default/snmpd

Change from:

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

To:

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

and restart snmpd

/etc/init.d/snmpd restart

3. Test

Do a snmpwalk from another host against your newly configured host.

[root@op5 ~]# snmpwalk -v 1 -c public -O e ibsen
SNMPv2-MIB::sysDescr.0 = STRING: Linux ibsen 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68869) 0:11:28.69
SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net
SNMPv2-MIB::sysName.0 = STRING: ibsen
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCenter"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip

Yes it works!!

4. Monitor example

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

5. Useful links

  • op5 Statistics, a cacti based graph tool
  • op5 Monitor, an Enterprise Class Monitoring system based on Nagios
  • Net-SNMP, an open source implementation of SNMP
  • Cacti, an open source graph tool
  • Nagios, the number 1 monitor tool

Install and configure SNMP on RHEL or CentOS

19/04/2011 Leave a comment

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  peter@it-slav.net

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: peter@it-slav.net
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.

4. Useful links

  • op5 Statistics, a cacti based graph tool
  • op5 Monitor, an Enterprise Class Monitoring system based on Nagios
  • Net-SNMP, an open source implementation of SNMP
  • Cacti, an open source graph tool
  • Nagios, the number 1 monitor tool

Source:  http://www.it-slav.net/blogs/2008/11/11/install-and-configure-snmp-on-rhel-or-centos/

Too much deferred messages in Zimbra?

12/04/2011 5 comments

Having too much deffered messages in Zimbra Collaboration Suite? And this error usually happened when messages with big attachment is sent?

Error example:

[root@mail ~]#  grep deferred /var/log/maillog
Apr 10 05:32:09 mail2 postfix/smtp[5543]: 2EEF859C06A: to=<nurhidayaharipin_87@yahoo.com.my>, relay=mx1.mail.sg1.yahoo.com[124.108.116.109]:25, delay=217976, delays=217793/0.02/0.4/183, dsn=4.4.2, status=deferred (conversation with mx1.mail.sg1.yahoo.com[124.108.116.109] timed out while sending message body)

The error is related to Postfix, one of the main Zimbra component. This is due to a message take too much time when sent to a recipient. Exceeding the timeout limit defined in the server. To solve the situation, we can increase the timeout limit.

To do this, edit a Postfix configuration file, main.cf.

sudo vim /opt/zimbra/postfix/conf/main.cf

.. and append these lines to the file. By default, Zimbra man.cf does not have  these lines like in other Postfix mail server configuration.

smtp_data_done_timeout = 600s
smtp_data_init_timeout = 120s
smtp_data_xfer_timeout = 600s

The effective attributes should be smtp_data_xfer_timeout. The bigger the values, the better. But for me 600 should be enough. Restart the service to implement the new configuration. That should do the work.

Source:

http://serverfault.com/questions/55949/postfix-timed-out-while-sending-message-body-to-microsoft-esmtp-mail-service

http://forums.fedoraforum.org/showthread.php?t=68888

Locking APT packages to spesific version

17/11/2009 Leave a comment

I never knew this until i was really need this. My Firefox automatically upgraded and some of the add-on became incompatible.

If you are using synaptic, you can force a package to specific version. Select

Packages -> Force Version

Then, you ll be given option to use which version to use.

To lock the package from being upgraded. You can lock the package by select the specific package, then select

Packages -> Lock Version

Quite simple and useful. However only do this when u are really needed to.

CentOS: YUM from CDROM

16/11/2009 Leave a comment

This is just a small fix.

Currently I wish to install my packages from CDROM, but no luck. Seems there something wrong with it. I have to use it because Internet is something I can’t always have at home. And if i have it, the connection is too slow.

Therefore, I’ve investigate the problem, then I found the problem. A tiny fix will do.

The original configuration in /etc/yum.repos.d/CentOS-Media.repo is something like this

[c5-media]
name=CentOS-$releasever – Media
baseurl=file:///media/CentOS/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

This is wrong, as the cdrom is mounted at /media/CentOS_5.4_Final not /media/CentOS. Therefore correction should be made. Something like this

[c5-media]
name=CentOS-$releasever – Media
baseurl=file:///media/CentOS_5.4_Final/
file:///media/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

There you go. Installing packages using Yum from CDROM should be no problem.

[anakin@localhost ~ ]$ sudo yum –disablerepo=\* –enablerepo=c5-media install <package>

Categories: Command-Line, Open Source

Installing GNU Screen in ESX server

28/08/2009 Leave a comment

Today, I am forced to login into my ESX servers. Some accidents happened and my virtual servers went down. Seems to much snapshots i have made using a scheduler and fill up my datastore entirely.

There is only 2GB left from 500GB of storage. Therefore my machine cannot boot anymore. I tried to use VMware Virtual Client to move some of virtual disks but seems my network was so intermittent and the operations failed over and over.

Well I need to go inside the ESX and manually move the virtual disks. but that the problem, my network is not reliable. I can just let my ssh sessions interrupted while copying the disks.

And worse, ESX does not have screen installed. Hello! that is my favorite tool while playing in CLI. Seems I have to install one, so I can work anywhere as I in the server myself.

I tried to use Yum. But the Yum in ESX is just meant to use for updates only. What a lame!

More research comes up with ESX is built on RH3. That just cool! Just find any rpm that suite that distros, I think it will fit ESX.

And i found it in rpm.pbone.net! the link is:

http://rpm.pbone.net/index.php3/stat/4/idpl/5245464/com/screen-3.9.15-10.i386.rpm.html

and with a dependency that needed:

http://rpm.pbone.net/index.php3/stat/4/idpl/5246885/com/utempter-0.5.5-1.3EL.0.i386.rpm.html

Now, I have it installed and ready to move my virtual disks to external drive I attached to my ESX server!

Categories: Command-Line, Open Source
Follow

Get every new post delivered to your Inbox.