How to Install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7

Virtualmin is an advanced web hosting control panel that is very flexible and powerful for Linux and UNIX systems. It is based on the well-known Open Source web-based system management, Webmin. It is a Webmin module for managing multiple virtual hosts, multiple virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and single friendly web interface. Virtualmin is an excellent alternative to cPanel and Plesk, with the same administrative structure based on user root, resellers, and customers. Virtualmin supports the account creation and management of Apache virtual hosts, BIND DNS domains, MySQL database. VirtualMin also provides functions for non-root users to manage their hosting account. In this article, i will show the steps to install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7. Steps maybe similar to older version of linux distribution.

Install Virtualmin on CentOS 7

There are two versions of Virtualmin exist:

  • Virtualmin GPL is a free and the open source version. (Discussed in this article)
  • Virtualmin Pro is a the commercial version of Virtualmin.

This tutorial assumes the following:

  • You have setup minimal installation for CentOS 7 / RHEL 7 / Oracle Linux 7.
  • You are running with root access.
  • If you are running as a normal user, you must have privileged access (sudo).

Install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7

1. It is recommended to install Virtualmin on the fresh server to avoid conflict when you start the installation. You need to update the system to ensure that we have all the latest software installed.

To update, run the following command :

# yum update -y

2. Download the VirtualMin installer into current directory:

# wget http://software.virtualmin.com/gpl/scripts/install.sh

3. Make the install.sh file executable :

# chmod +x install.sh

4. start the installation :

# ./install.sh
 The systems currently supported by install.sh are:
 CentOS/RHEL/Scientific Linux 7 on x86_64
 CentOS and RHEL 5-6 on i386 and x86_64
 Scientific Linux 6 on i386 and x86_64
 Debian 6, 7, and 8 on i386 and amd64
 Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTS on i386 and amd64
 Amazon Linux 2012.03 on i386 and x86_64
 FreeBSD 7.0 and 8 on i386 and amd64

If your OS is not listed above, this script will fail. More details about the systems supported by the script can be found here:

http://www.virtualmin.com/os-support.html

Example :

# ./install.sh
Checking for Perl
found Perl at /usr/bin/perl


Welcome to the Virtualmin GPL installer, version 1.1.2

 WARNING:

 The installation is quite stable and functional when run on a freshly
 installed supported Operating System.

 If you have existing websites, email users, or if you manually installed
 Virtualmin via a Webmin 'wbm' module, you are likely to run into problems.
 Please read the Virtualmin Administrators Guide before proceeding if
 your system is not a freshly installed and supported OS.

 This script is not intended to update your system!  It should only be
 used to perform your initial Virtualmin installation.  If you have previously
 run the Virtualmin installer, you can perform upgrades and updates from within
 Virtualmin itself, or using your system's package manager. Once Virtualmin is
 installed, you never need to run this script again.

 The systems currently supported by install.sh are:
 CentOS/RHEL/Scientific Linux 7 on x86_64
 CentOS and RHEL 5-6 on i386 and x86_64
 Scientific Linux 6 on i386 and x86_64
 Debian 6, 7, and 8 on i386 and amd64
 Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTS on i386 and amd64
 Amazon Linux 2012.03 on i386 and x86_64
 FreeBSD 7.0 and 8 on i386 and amd64

 If your OS is not listed above, this script will fail.  More details
 about the systems supported by the script can be found here:

   http://www.virtualmin.com/os-support.html

 Continue? (y/n) y
Checking for HTTP client...found /usr/bin/curl -s -O
Checking for perl...found /usr/bin/perl
Loading log4sh logging library...
INFO - Started installation log in /root/virtualmin-install.log
INFO - Checking for fully qualified hostname...
INFO - Hostname OK: fully qualified as centos71.ehowstuff.local
INFO - Installing serial number and license key into /etc/virtualmin-license
INFO - Loading OS selection library...
INFO - Download of http://software.virtualmin.com/lib/oschooser.pl Succeeded.
INFO - Loading OS list...
INFO - Download of http://software.virtualmin.com/lib/os_list.txt Succeeded.
INFO - Operating system name:    CentOS Linux
INFO - Operating system version: 7.1.1503
INFO - Configuring package manager for CentOS Linux 7.1.1503...
INFO - Disabling SELinux during installation...
/usr/sbin/setenforce: SELinux is disabled
INFO -   setenforce 0 failed: 1
INFO - Download of http://software.virtualmin.com/gpl/rhel/7.1.1503/x86_64/virtualmin-release-latest.noarch.rpm Succeeded.
warning: virtualmin-release-latest.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID a0bdbcf9: NOKEY
INFO -  Succeeded.
INFO - Installing dependencies using command: /usr/bin/yum -y -d 2 install bind bind-utils caching-nameserver httpd postfix spamassassin procmail perl-DBD-Pg
 perl-DBD-MySQL quota iptables openssl python mailman subversion mysql mysql-server mysql-devel mariadb mariadb-server postgresql postgresql-server rh-postgr
esql rh-postgresql-server logrotate webalizer php php-xml php-gd php-imap php-mysql php-odbc php-pear php-pgsql php-snmp php-xmlrpc php-mbstring mod_perl mod
_python cyrus-sasl dovecot spamassassin mod_dav_svn cyrus-sasl-gssapi mod_ssl ruby ruby-devel rubygems perl-XML-Simple perl-Crypt-SSLeay mlocate perl-LWP-Pro
tocol-https
                  
..
..
..

5. Once the install.sh script complete, you have to login to web management console :

https://IPADDRESS:10000/

The following are the summaries for the Post Setup Wizard task :

a) Once you login you will be prompted with a Post Setup Wizard. Click Next.

b) You will be prompted if you would like to pre-load certain libraries. Click Yes and then Next.

c) You will be prompted if you would like to run ClamAV virus scanner on your server. It is suggested that you select Yes and click Next.

d) You will be prompted if you would like to run the SpamAssassin e-mail spam scanner. If you are not running e-mail services it is not necessary to run this. However if you are hosting e-mail it is highly advised. Click Yes and Next if you are going to use SpamAssassin, otherwise click Next.

e) Next you will be prompted if you would like to run MySQL and/or PostgreSQL servers. This is entirely up to you as to which database servers you will provide to your customers (if any). Select your options and click Next. You will be prompted on the following screens for password information.

f) Once finished, you will be presented with an ‘All Done’ page. Click Next.

g) Once the main page loads you will need to reload your configuration. Click the Re-check and refresh configuration button in the yellow box.

I hope this article gives you some ideas and essential guidance on how to install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7.

 

How to Configure Firewalld in Linux CentOS 7 / RHEL7

Linux kernel includes powerful network filtering subsystem called Netfilter. It allows kernel modules to inspect each packet crossing the linux system such as to allow or drop incoming and outgoing network packet. In older Red Hat Enterprise Linux (RHEL) release such as RHEL 5 and RHEL 6, iptables was the main method of interacting with the kernel netfilter subsystem. The firewall capabilities were provided by the iptables utility, and configured either at the command line or through the graphical configuration tool, system-config-firewall.

configure firewalld in linux

In RHEL 7, firewalld has been introduced as a new method of interacting with netfilter. It is a default method for managing host-level firewalls. Basically the firewall capabilities are still provided by iptables. But linux administrators now interact with iptables through the dynamic firewall daemon, firewalld, and its configuration tools: firewall-config, firewall-cmd, and firewall-applet, which is not included in the default installation of Red Hat Enterprise Linux 7. Traffic management becomes easier after firewalld classifies all network traffic into a specific zone. Based on criteria such as source IP address of packets through the network, traffic was diverted into the firewall rules for approriate zone.

How to Configure Firewalld in Linux

There are three main ways for system administrators to interact with firewalld.

  • By directly editing congfiguration files in /etc/firewalld
  • By using the graphical firewall-config tool
  • By using firewalld-cmd from the command line (will be discussed in this article)

This article will discuss how to configure firewalld in linux CentoS 7, RHEL 7 and Oracle linux 7 by using firewalld-cmd command line. Please take note that the firewalld daemon is installed from the firewalld package. It is part of a base install, but not part of a minimal installation.

1. How to install Firewalld :

Firewalld package is installed by default in RHEL 7.1 and CentOS 7.1. If you noticed it is not installed, you can install it using the following YUM command.

# sudo yum install firewalld -y

2. How to disable or enable Firewalld at boot :

a) To disable start at boot :

# sudo systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

b) To enable start at boot :

# sudo systemctl enable firewalld

3. Verify that firewalld is enabled and running on your server system :

# sudo systemctl status firewalld.service

Example :

# sudo systemctl status firewalld.service
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: active (running) since Wed 2015-09-09 21:26:25 MYT; 1 weeks 0 days ago
 Main PID: 2348 (firewalld)
   CGroup: /system.slice/firewalld.service
           ??2348 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Sep 09 21:26:25 centos71.ehowstuff.local systemd[1]: Started firewalld - dynamic firewall daemon.

4. How to query the current default zone ?

# sudo firewall-cmd --get-default-zone
public

In this case, the default zone is public.

5. How to list all available zones ?

# sudo firewall-cmd --get-zones
block dmz drop external home internal public trusted work

This will display all available zones.

6. Open up incoming http,https and mysql traffic for public zone :

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-service=https
# sudo firewall-cmd --permanent --zone=public --add-service=mysql

7. Activate the changes to your server firewall :

# sudo firewall-cmd --reload

8. Check the configuration of the running firewall on your system :

a) Query active zone :

# sudo firewall-cmd --get-active-zones

b) Display all running firewall configuration :

# sudo firewall-cmd --zone=public --list-all

Example :

# sudo firewall-cmd --zone=public --list-all
public (default, active)
  interfaces: ens32
  sources:
  services: dhcpv6-client http https mysql ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

I hope that this gives you some ideas and essential guidance on how to configure firewalld in linux RHEL 7 / CentOS 7.

 

How to Install Webmin 1.720 on CentOS 6/RHEL 6

Webmin is a web-based free software that is created for the administration of the system for linux and unix . It is managed through the graphical web interface that is very user friendly and suitable for beginners who are less familiar with linux command line utility. However, a recent version can also be installed and running on the Windows operating system. Webmin can be managed using a modern web browser like google chrome, mozilla firefox and internet explorer. If you are a website operator or system administrator of the virtual private server (VPS) or dedicated server, it is appropriate to use webmin as a platform to manage the system, it will make your life easier.

With webmin, system administrators can perform system administration and configuration task of such a setup user accounts, Apache configuration, DNS management, MySQL database administration, file sharing administration and more. As a reference, I have document the steps of how to setup Webmin 1.720 on CentOS 6/RHEL 6 using source instalation.

1. Download Webmin :

[root@centos66 ~]# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.720.tar.gz

2. Create /software and extract webmin from where it was downloaded :

[root@centos66 ~]# mkdir -p /software
[root@centos66 ~]# tar xzvf webmin-1.720.tar.gz
[root@centos66 ~]# cd webmin-1.720

3. Run setup.sh script :

[root@centos66 webmin-1.720]# ./setup.sh /software/webmin

Example :

[root@centos66 webmin-1.720]# ./setup.sh /software/webmin

When the setup.sh script is run, it will ask the following questions :
The Webmin configuration directory
The directory in which all Webmin configuration information is stored. This is now separate from the Webmin install directory, so that configurations are saved when you upgrade. 
If you have previously installed Webmin and use the same config directory, this will be the only question asked.
The Webmin log directory
The location for pid and webserver log files.
The full path to perl on your system
This is usually /usr/bin/perl or /usr/local/bin/perl
Your Operating system type
In Webmin versions 0.990 and above, this question is only asked if your operating system cannot be automatically determined.
The setup script will display a list of supported systems. If your OS is not on the list, you can try choosing the closest match. However this may not work properly, and may even cause serious problems!
Web server port
The TCP port that the Webmin web server will listen on.
Web server login and password
The login name and password used to acess the Webmin web server.
Web server hostname
The hostname of the machine on which Webmin will run.
Use SSL
This question will only be asked if your system has the Perl SSL libraries installed. See below for more..
Start Webmin at boot time
If your OS is supported, Webmin will ask if you want to have it automatically started at boot time.
Assuming you answer all the above questions correctly, the Webmin web server will be started and the setup script will give you the URL to go to. Enter this URL into your browser, and you will be prompted for the login and password that you choose in setup.sh. Once you have logged in your browser should show the main Webmin page, on which is an icon for each module you have installed.
Typically you can connect to Webmin at http://localhost:10000/. Or if accessing it remotely, replace localhost with your system's IP address.
[root@centos66 webmin-1.720]# ./setup.sh /software/webmin
***********************************************************************
*            Welcome to the Webmin setup script, version 1.720        *
***********************************************************************
Webmin is a web-based interface that allows Unix-like operating
systems and common Unix services to be easily administered.

Installing Webmin from /root/webmin-1.720 to /software/webmin ...

***********************************************************************
Webmin uses separate directories for configuration files and log files.
Unless you want to run multiple versions of Webmin at the same time
you can just accept the defaults.

Config file directory [/etc/webmin]:
Log file directory [/var/webmin]:

***********************************************************************
Webmin is written entirely in Perl. Please enter the full path to the
Perl 5 interpreter on your system.

Full path to perl (default /usr/bin/perl):

Testing Perl ...
Perl seems to be installed ok

***********************************************************************
Operating system name:    CentOS Linux
Operating system version: 6.6

***********************************************************************
Webmin uses its own password protected web server to provide access
to the administration programs. The setup script needs to know :
 - What port to run the web server on. There must not be another
   web server already using this port.
 - The login name required to access the web server.
 - The password required to access the web server.
 - If the webserver should use SSL (if your system supports it).
 - Whether to start webmin at boot time.

Web server port (default 10000):
Login name (default admin):
Login password:
Password again:
The Perl SSLeay library is not installed. SSL not available.
Start Webmin at boot time (y/n): y
***********************************************************************
Copying files to /software/webmin ..
..done

Creating web server config files..
..done

Creating access control file..
..done

Inserting path to perl into scripts..
..done

Creating start and stop scripts..
..done

Copying config files..
..done

Configuring Webmin to start at boot time..
..done

Creating uninstall script /etc/webmin/uninstall.sh ..
..done

Changing ownership and permissions ..
..done

Running postinstall scripts ..
Subroutine setup_ca redefined at /software/webmin/webmin/webmin-lib.pl line 77.
Subroutine install_webmin_module redefined at /software/webmin/webmin/webmin-lib.pl line 127.
Subroutine grant_user_module redefined at /software/webmin/webmin/webmin-lib.pl line 439.
Subroutine delete_webmin_module redefined at /software/webmin/webmin/webmin-lib.pl line 480.
Subroutine file_basename redefined at /software/webmin/webmin/webmin-lib.pl line 589.
Subroutine gnupg_setup redefined at /software/webmin/webmin/webmin-lib.pl line 603.
Subroutine list_standard_modules redefined at /software/webmin/webmin/webmin-lib.pl line 631.
Subroutine standard_chooser_button redefined at /software/webmin/webmin/webmin-lib.pl line 663.
Subroutine list_third_modules redefined at /software/webmin/webmin/webmin-lib.pl line 676.
Subroutine third_chooser_button redefined at /software/webmin/webmin/webmin-lib.pl line 708.
Subroutine get_webmin_base_version redefined at /software/webmin/webmin/webmin-lib.pl line 719.
Subroutine base_version redefined at /software/webmin/webmin/webmin-lib.pl line 729.
Subroutine get_newmodule_users redefined at /software/webmin/webmin/webmin-lib.pl line 740.
Subroutine save_newmodule_users redefined at /software/webmin/webmin/webmin-lib.pl line 762.
Subroutine get_miniserv_sockets redefined at /software/webmin/webmin/webmin-lib.pl line 786.
Subroutine fetch_updates redefined at /software/webmin/webmin/webmin-lib.pl line 834.
Subroutine check_update_signature redefined at /software/webmin/webmin/webmin-lib.pl line 901.
Subroutine find_cron_job redefined at /software/webmin/webmin/webmin-lib.pl line 932.
Subroutine get_ipkeys redefined at /software/webmin/webmin/webmin-lib.pl line 944.
Subroutine save_ipkeys redefined at /software/webmin/webmin/webmin-lib.pl line 965.
Subroutine validate_key_cert redefined at /software/webmin/webmin/webmin-lib.pl line 997.
Subroutine detect_operating_system redefined at /software/webmin/webmin/webmin-lib.pl line 1018.
Subroutine show_webmin_notifications redefined at /software/webmin/webmin/webmin-lib.pl line 1053.
Subroutine get_webmin_notifications redefined at /software/webmin/webmin/webmin-lib.pl line 1069.
Subroutine get_system_uptime redefined at /software/webmin/webmin/webmin-lib.pl line 1271.
Subroutine list_operating_systems redefined at /software/webmin/webmin/webmin-lib.pl line 1318.
Subroutine shared_root_directory redefined at /software/webmin/webmin/webmin-lib.pl line 1343.
Subroutine submit_os_info redefined at /software/webmin/webmin/webmin-lib.pl line 1380.
Subroutine get_webmin_id redefined at /software/webmin/webmin/webmin-lib.pl line 1408.
Subroutine ip_match redefined at /software/webmin/webmin/webmin-lib.pl line 1424.
Subroutine prefix_to_mask redefined at /software/webmin/webmin/webmin-lib.pl line 1519.
Subroutine valid_allow redefined at /software/webmin/webmin/webmin-lib.pl line 1533.
Subroutine get_preloads redefined at /software/webmin/webmin/webmin-lib.pl line 1591.
Subroutine save_preloads redefined at /software/webmin/webmin/webmin-lib.pl line 1603.
Subroutine get_tempdirs redefined at /software/webmin/webmin/webmin-lib.pl line 1614.
Subroutine save_tempdirs redefined at /software/webmin/webmin/webmin-lib.pl line 1631.
Subroutine get_module_install_type redefined at /software/webmin/webmin/webmin-lib.pl line 1650.
Subroutine get_install_type redefined at /software/webmin/webmin/webmin-lib.pl line 1667.
Subroutine list_cached_files redefined at /software/webmin/webmin/webmin-lib.pl line 1697.
Subroutine show_restart_page redefined at /software/webmin/webmin/webmin-lib.pl line 1716.
Subroutine cert_info redefined at /software/webmin/webmin/webmin-lib.pl line 1734.
Subroutine cert_pem_data redefined at /software/webmin/webmin/webmin-lib.pl line 1775.
Subroutine cert_pkcs12_data redefined at /software/webmin/webmin/webmin-lib.pl line 1790.
Subroutine get_blocked_users_hosts redefined at /software/webmin/webmin/webmin-lib.pl line 1816.
Subroutine show_ssl_key_form redefined at /software/webmin/webmin/webmin-lib.pl line 1844.
Subroutine parse_ssl_key_form redefined at /software/webmin/webmin/webmin-lib.pl line 1888.
Subroutine parse_ssl_csr_form redefined at /software/webmin/webmin/webmin-lib.pl line 1961.
Subroutine build_installed_modules redefined at /software/webmin/webmin/webmin-lib.pl line 2035.
Subroutine get_latest_webmin_version redefined at /software/webmin/webmin/webmin-lib.pl line 2077.
Subroutine filter_updates redefined at /software/webmin/webmin/webmin-lib.pl line 2110.
Subroutine get_clone_source redefined at /software/webmin/webmin/webmin-lib.pl line 2152.
Subroutine retry_http_download redefined at /software/webmin/webmin/webmin-lib.pl line 2168.
Subroutine list_twofactor_providers redefined at /software/webmin/webmin/webmin-lib.pl line 2199.
Subroutine show_twofactor_apikey_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2209.
Subroutine validate_twofactor_apikey_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2221.
Subroutine show_twofactor_form_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2246.
Subroutine parse_twofactor_form_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2262.
Subroutine enroll_twofactor_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2277.
Subroutine validate_twofactor_authy redefined at /software/webmin/webmin/webmin-lib.pl line 2308.
Subroutine validate_twofactor_apikey_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2354.
Subroutine show_twofactor_form_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2368.
Subroutine parse_twofactor_form_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2382.
Subroutine generate_base32_secret redefined at /software/webmin/webmin/webmin-lib.pl line 2398.
Subroutine enroll_twofactor_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2412.
Subroutine message_twofactor_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2421.
Subroutine validate_twofactor_totp redefined at /software/webmin/webmin/webmin-lib.pl line 2435.
Subroutine canonicalize_ip6 redefined at /software/webmin/webmin/webmin-lib.pl line 2457.
Subroutine list_keys redefined at /software/webmin/webmin/gnupg-lib.pl line 23.
Subroutine list_keys_sorted redefined at /software/webmin/webmin/gnupg-lib.pl line 74.
Subroutine list_secret_keys redefined at /software/webmin/webmin/gnupg-lib.pl line 82.
Subroutine key_fingerprint redefined at /software/webmin/webmin/gnupg-lib.pl line 88.
Subroutine get_passphrase redefined at /software/webmin/webmin/gnupg-lib.pl line 105.
Subroutine put_passphrase redefined at /software/webmin/webmin/gnupg-lib.pl line 116.
Subroutine encrypt_data redefined at /software/webmin/webmin/gnupg-lib.pl line 128.
Subroutine decrypt_data redefined at /software/webmin/webmin/gnupg-lib.pl line 167.
Subroutine sign_data redefined at /software/webmin/webmin/gnupg-lib.pl line 224.
Subroutine verify_data redefined at /software/webmin/webmin/gnupg-lib.pl line 283.
Subroutine read_entire_file redefined at /software/webmin/webmin/gnupg-lib.pl line 327.
Subroutine write_entire_file redefined at /software/webmin/webmin/gnupg-lib.pl line 339.
Subroutine get_trust_level redefined at /software/webmin/webmin/gnupg-lib.pl line 349.
Subroutine delete_key redefined at /software/webmin/webmin/gnupg-lib.pl line 371.
Subroutine default_email_address redefined at /software/webmin/webmin/gnupg-lib.pl line 398.
Subroutine fetch_gpg_key redefined at /software/webmin/webmin/gnupg-lib.pl line 415.
Subroutine search_gpg_keys redefined at /software/webmin/webmin/gnupg-lib.pl line 442.
Use of uninitialized value in -r at /software/webmin/webalizer/webalizer-lib.pl line 16.
..done

Enabling background status collection ..
..done

Attempting to start Webmin mini web server..
Starting Webmin server in /software/webmin
Pre-loaded WebminCore
..done

***********************************************************************
Webmin has been installed and started successfully. Use your web
browser to go to

  http://centos66.ehowstuff.local:10000/

and login with the name and password you entered previously.

4. Access webmin via http://centos66.ehowstuff.local:10000/ or http://IP-Address:10000/ :

How to Setup NetHogs – Monitor Bandwidth Usage Per Process in Linux

NetHogs is a opensource tools to monitor network bandwidth that was used by the process and program in linux operating system. NetHogs does not rely on a special kernel module to be loaded. When you hit the high network traffic issue on your linux server, you can immediately find which PID is causing the issue. NetHogs will give you real time statistics of your network bandwidth of per process usage. Follow this steps to install NetHogs on linux CentOS 6.5 and the sample nethogs usage.

1. Prepare additional repository (EPEL repository).

2. Install nethogs :

[root@oss ~]# yum install nethogs -y

3. NetHogs utility :

[root@oss ~]# nethogs

Sample output :
setup nethogs -1

4. NetHogs command option :
There are a few commad options when using nethogs. Using ‘-d‘ to add a refresh rate. As an example, to set 5 seconds as your refresh rate, then type the command as.

[root@oss ~]# nethogs -d 5

Other options :

-d     delay for refresh rate.
-h     display available commands usage.
-p     sniff in promiscious mode (not recommended).
-t     tracemode.
-V     prints Version info.

5. Monitor specific device (eth0 or eth1) network bandwidth only :

a) Monitor eth0 bandwidth :

[root@oss ~]# nethogs eth0

a) Monitor eth0 and eth1 bandwidth :

[root@oss ~]# nethogs eth0 eth1

Reference :

How to Setup Collectl – Linux Performance Monitoring

Collectl is a linux performance monitoring tools that grabs as much detail as possible from the /proc filesystem and it does a lot more than most other tools. Compare to sar, collectl has some capabilities that sar does not have. Collectl can gather and post-process the performance data and also can save the performance data for later analysis. Please refer to below guide on how you can setup collectl on linux CentOS 6.5 and the sample usage of collectl :

1. Install collectl. Make sure additional repository (EPEL repository) has been installed :
a. For Red Hat based distro :

[root@oss ~]# yum install collectl -y

b. For debian bas distro :

[root@oss ~]# sudo apt-get install collectl -y

2. Display collectl command help :

[root@oss ~]# collectl -h
This is a subset of the most common switches and even the descriptions are
abbreviated.  To see all type 'collectl -x', to get started just type 'collectl'

usage: collectl [switches]
  -c, --count      count      collect this number of samples and exit
  -f, --filename   file       name of directory/file to write to
  -i, --interval   int        collection interval in seconds [default=1]
  -o, --options    options    misc formatting options, --showoptions for all
                                d|D - include date in output
                                  T - include time in output
                                  z - turn off compression of plot files
  -p, --playback   file       playback results from 'file' (be sure to quote
                              if wild carded) or the shell might mess it up
  -P, --plot                  generate output in 'plot' format
  -s, --subsys     subsys     specify one or more subsystems [default=cdn]
      --verbose               display output in verbose format (automatically
                              selected when brief doesn't make sense)

Various types of help
  -h, --help                  print this text
  -v, --version               print version
  -V, --showdefs              print operational defaults
  -x, --helpextend            extended help, more details descriptions too
  -X, --helpall               shows all help concatenated together

  --showoptions               show all the options
  --showsubsys                show all the subsystems
  --showsubopts               show all subsystem specific options
  --showtopopts               show --top options

  --showheader                show file header that 'would be' generated
  --showcolheaders            show column headers that 'would be' generated
  --showslabaliases           for SLUB allocator, show non-root aliases
  --showrootslabs             same as --showslabaliases but use 'root' names

Copyright 2003-2014 Hewlett-Packard Development Company, L.P.
collectl may be copied only under the terms of either the Artistic License
or the GNU General Public License, which may be found in the source kit

3. According to the man page, collectl identifies the following subsystems :

SUMMARY SUBSYSTEMS

OptionDescription
bBuddy information (memory fragmentation)
cCPU information
dDisk
fNFS information
iinode information
jInterrupts
lLustre
mMemory
nNetworks
sSockets
tTCP
xInterconnect
ySlabs

DETAIL SUBSYSTEMS

OptionDescription
CCPU
DDisk
EEnvironmentals via ipmitool
FNFS data
JInterrupts
MMemory node data (including numa)
NNetworks
TSixty-five TCP counters (only in plot format)
XInterconnect
YSlabs
ZProcesses

 

4. Monitor cpu subsystem :

[root@oss ~]# collectl -sc
waiting for 1 second sample...
#< --------CPU-------->
#cpu sys inter  ctxsw
   0   0    34     37
   0   0    56     40
   0   0    38     44
   0   0    31     35
   0   0    36     44
[root@oss ~]# collectl -sC
waiting for 1 second sample...

# SINGLE CPU STATISTICS
#   Cpu  User Nice  Sys Wait IRQ  Soft Steal Idle
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    4    0    0     0   96
      0     0    0    0    0    0    0     0   99
      1     0    0    0    0    0    0     0   99
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     1    0    0    0    0    0     0   99
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100
      0     0    0    0    0    0    0     0  100
      1     0    0    0    0    0    0     0  100

5. Monitor memory subsystem :

[root@oss ~]# collectl -sm
waiting for 1 second sample...
#< -----------Memory----------->
#Free Buff Cach Inac Slab  Map
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
   3G  19M 166M  50M  36M  34M
[root@oss ~]# collectl -sM
waiting for 1 second sample...

# MEMORY STATISTICS
# Node    Total     Used     Free     Slab   Mapped     Anon   Locked    Inact   Hit%
     0    4095M  565208K    3543M   37112K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37112K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51756K 100.00
     0    4095M  565208K    3543M   37108K    9408K   25492K        0   51760K 100.00
     0    4095M  565208K    3543M   37036K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37028K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37028K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37024K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37024K    9408K   25492K        0   51760K 100.00
     0    4095M  565184K    3543M   37016K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36972K    9408K   25492K        0   51760K 100.00
     0    4095M  565168K    3543M   36968K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36932K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00
     0    4095M  565160K    3543M   36900K    9408K   25492K        0   51760K 100.00

6. Monitor disk subsystem :

[root@oss ~]# collectl -sd
waiting for 1 second sample...
#< ----------Disks----------->
#KBRead  Reads KBWrit Writes
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0     16      3
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
      0      0      0      0
[root@oss ~]# collectl -sD
waiting for 1 second sample...

# DISK STATISTICS (/sec)
#           Pct
#Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0      16      1    3    5       5     1    13     10    3
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0
sda              0      0    0    0       0      0    0    0       0     0     0      0    0

7. collectl like iotop :

[root@oss ~]# collectl --top iokb

Sample output :

# TOP PROCESSES sorted by iokb (counters are /sec) 13:35:14
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.30    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.38    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1
   11  root     20     2    0 S     0     0  0  0.00  0.00   0  00:08.15    0    0    0    0 events/0
   12  root     20     2    0 S     0     0  1  0.00  0.00   0  01:21.61    0    0    0    0 events/1
   13  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 cgroup
   14  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 khelper
   15  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 netns
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 async/mgr
   17  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 pm
   18  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.84    0    0    0    0 sync_supers
   19  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.82    0    0    0    0 bdi-default
   20  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/0
   21  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/1
   22  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.15    0    0    0    0 kblockd/0

Display only top 10 processes :

[root@oss ~]# collectl --top iokb,10

Sample output :

# TOP PROCESSES sorted by iokb (counters are /sec) 13:42:37
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.30    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.39    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1

Learn what fields the above list can be sorted :

[root@oss ~]# collectl --showtopopts
The following is a list of --top's sort types which apply to either
process or slab data.  In some cases you may be allowed to sort
by a field that is not part of the display if you so desire

TOP PROCESS SORT FIELDS

Memory
  vsz    virtual memory
  rss    resident (physical) memory

Time
  syst   system time
  usrt   user time
  time   total time
  accum  accumulated time

I/O
  rkb    KB read
  wkb    KB written
  iokb   total I/O KB

  rkbc   KB read from pagecache
  wkbc   KB written to pagecache
  iokbc  total pagecacge I/O
  ioall  total I/O KB (iokb+iokbc)

  rsys   read system calls
  wsys   write system calls
  iosys  total system calls

  iocncl Cancelled write bytes

Page Faults
  majf   major page faults
  minf   minor page faults
  flt    total page faults

Context Switches
  vctx   volunary context switches
  nctx   non-voluntary context switches

Miscellaneous (best when used with --procfilt)
  cpu    cpu number
  pid    process pid
  thread total process threads (not counting main)

TOP SLAB SORT FIELDS

  numobj    total number of slab objects
  actobj    active slab objects
  objsize   sizes of slab objects
  numslab   number of slabs
  objslab   number of objects in a slab
  totsize   total memory sizes taken by slabs
  totchg    change in memory sizes
  totpct    percent change in memory sizes
  name      slab names

8. collectl like top :

[root@oss ~]# collectl --top

Sample output :

# TOP PROCESSES sorted by time (counters are /sec) 13:45:00
# PID  User     PR  PPID THRD S   VSZ   RSS CP  SysT  UsrT Pct  AccuTime  RKB  WKB MajF MinF Command
 3266  root     20  2488    0 R  160M   21M  1  0.00  0.05   5  00:00.70    0    0    0   83 /usr/bin/perl
    1  root     20     0    0 S   18M    1M  0  0.00  0.00   0  00:01.13    0    0    0    0 /sbin/init
    2  root     20     0    0 S     0     0  0  0.00  0.00   0  00:00.02    0    0    0    0 kthreadd
    3  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.04    0    0    0    0 migration/0
    4  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.09    0    0    0    0 ksoftirqd/0
    5  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 migration/0
    6  root     RT     2    0 S     0     0  0  0.00  0.00   0  00:00.31    0    0    0    0 watchdog/0
    7  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.39    0    0    0    0 migration/1
    8  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 migration/1
    9  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.22    0    0    0    0 ksoftirqd/1
   10  root     RT     2    0 S     0     0  1  0.00  0.00   0  00:00.28    0    0    0    0 watchdog/1
   11  root     20     2    0 S     0     0  0  0.00  0.00   0  00:08.18    0    0    0    0 events/0
   12  root     20     2    0 S     0     0  1  0.00  0.00   0  01:21.97    0    0    0    0 events/1
   13  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 cgroup
   14  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 khelper
   15  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 netns
   16  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 async/mgr
   17  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 pm
   18  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.84    0    0    0    0 sync_supers
   19  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.83    0    0    0    0 bdi-default
   20  root     20     2    0 S     0     0  0  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/0
   21  root     20     2    0 S     0     0  1  0.00  0.00   0  00:00.00    0    0    0    0 kintegrityd/1

More advance options can be found in the official collectl documentation :

How to Setup psacct or acct – Monitor User Activity in Linux

It is very important to know what are the activities for applications and users in linux operating system. This will very useful in later time or in case of problems. For this purpose, i would recommend psacct or acct tools to be install. psacct or acct is a free monitoring program to monitor users and applications activity on linux server. This program will display how long user accessing the server, what command are they issuing, how many processes and display logs for commands. psacct and acct are similar tool, psacct is for RPM based linux but acct is for Debian based.

1. If you are runninng Linux CentOS or Redhat, you should use the following command to install pssacct :

[root@oss ~]# yum install psacct -y

But if you are running debian such as Ubuntu, you should install acct package instead of psacct :

[root@oss ~]# sudo apt-get install acct

2. By default psacct is disabled on Linux. We should manually start it :

[root@oss ~]# /etc/init.d/psacct status
Process accounting is disabled.
[root@oss ~]# /etc/init.d/psacct start
Starting process accounting:                               [  OK  ]

Start acct on Debian :

[root@oss ~]# sudo service acct start

3. The psacct or acct package provides several features for monitoring process activities.

Other usage from that come in psacct or acct package :

ac command prints the statistics of user logins/logouts (connect time) in hours.
lastcomm command prints the information of previously executed commands of user.
accton commands is used to turn on/off process for accounting.
sa command summarizes information of previously executed commands.
last and lastb commands show listing of last logged in users.

4. Total Connect Time :

[root@oss ~]# ac
        total      103.61

5. Display the statistics for total login time :

[root@oss ~]# ac -d
Dec  7  total        4.15
Dec  8  total        0.01
Jul 18  total        0.01
Aug  5  total       13.19
Aug  7  total       39.29
Aug 10  total        3.33
Aug 11  total        6.41
Aug 12  total        1.84
Aug 13  total        0.22
Aug 16  total        3.30
Aug 17  total       16.56
Aug 18  total        1.99
Aug 19  total        2.77
Today   total       10.55

6. Total login statistics of each user :

[root@oss ~]# ac -p
        ehowstuff                            0.76
        root                               103.00
        total      103.76

7. Print the summary of commands that were executed by users :

[root@oss ~]# sa
     135   12652.06re       0.00cp    11052k
      12       3.32re       0.00cp    23715k   ***other*
       2       2.78re       0.00cp    27072k   bash
       2       0.00re       0.00cp    26576k   service
       2   12645.72re       0.00cp        0k   flush-8:0*
      29       0.00re       0.00cp     1018k   ac
      23       0.00re       0.00cp    10197k   bash*
      10       0.00re       0.00cp     9709k   id
       6       0.01re       0.00cp    29328k   crond*
       6       0.00re       0.00cp    25232k   basename
       6       0.00re       0.00cp     1642k   lastcomm
       5       0.01re       0.00cp    25248k   sadc
       5       0.00re       0.00cp      981k   consoletype
       3       0.00re       0.00cp     2076k   hostname
       3       0.00re       0.00cp     1595k   grep
       3       0.00re       0.00cp     1561k   tput
       3       0.00re       0.00cp     1020k   dircolors
       3       0.00re       0.00cp     1017k   tty
       2       0.15re       0.00cp    16992k   sshd*
       2       0.09re       0.00cp    25232k   tail
       2       0.00re       0.00cp    28928k   ls
       2       0.00re       0.00cp    26512k   service*
       2       0.00re       0.00cp    25216k   logger
       2       0.00re       0.00cp     1545k   sa

8. Prints the number of processes and the number of CPU minutes :

[root@oss ~]# sa -m
                                      136   12652.06re       0.00cp    10978k
root                                   94   12650.94re       0.00cp    12223k
ehowstuff                              40       0.97re       0.00cp     7752k
sshd                                    2       0.15re       0.00cp    16992k

9. Use command sa -u to display individual users activity :

[root@oss ~]# sa -u
root       0.00 cpu      981k mem accton
root       0.00 cpu    26288k mem touch
root       0.01 cpu    26576k mem psacct
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
root       0.00 cpu     1018k mem ac
sshd       0.00 cpu    16992k mem sshd             *
root       0.00 cpu     2604k mem id
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     2076k mem hostname
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1017k mem tty
root       0.00 cpu     1561k mem tput
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1020k mem dircolors
root       0.00 cpu     2826k mem bash             *
root       0.00 cpu     1595k mem grep
root       0.00 cpu      981k mem consoletype
root       0.00 cpu    27040k mem bash             *
root       0.00 cpu    26288k mem id
root       0.00 cpu    27040k mem bash             *
ehowstuf   0.00 cpu     2604k mem id
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2076k mem hostname
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2604k mem id
ehowstuf   0.00 cpu     2826k mem bash             *
ehowstuf   0.00 cpu     2604k mem id

10. Printing sort by percentage

The command sa -c will show you the highest percentage of users:

[root@oss ~]# sa -c
     233  100.00%   12652.90re  100.00%       0.00cp  100.00%    16512k
      22    9.44%       3.32re    0.03%       0.00cp   44.44%    19491k   ***other*
       2    0.86%       2.78re    0.02%       0.00cp   22.22%    27072k   bash
       3    1.29%   12646.53re   99.95%       0.00cp   11.11%        0k   flush-8:0*
       2    0.86%       0.00re    0.00%       0.00cp   11.11%    26576k   service
       8    3.43%       0.01re    0.00%       0.00cp    5.56%    25248k   sadc
       2    0.86%       0.00re    0.00%       0.00cp    5.56%    26512k   run-parts
      30   12.88%       0.00re    0.00%       0.00cp    0.00%    26512k   sh
      29   12.45%       0.00re    0.00%       0.00cp    0.00%     1018k   ac
      23    9.87%       0.00re    0.00%       0.00cp    0.00%    10197k   bash*
      17    7.30%       0.00re    0.00%       0.00cp    0.00%    25232k   cat
      12    5.15%       0.02re    0.00%       0.00cp    0.00%    29328k   crond*
      10    4.29%       0.00re    0.00%       0.00cp    0.00%     9709k   id
       8    3.43%       0.00re    0.00%       0.00cp    0.00%    25232k   basename
       7    3.00%       0.00re    0.00%       0.00cp    0.00%    29079k   ls
       6    2.58%       0.00re    0.00%       0.00cp    0.00%     1642k   lastcomm
       6    2.58%       0.00re    0.00%       0.00cp    0.00%     1457k   sa
       5    2.15%       0.00re    0.00%       0.00cp    0.00%      981k   consoletype
       4    1.72%       0.00re    0.00%       0.00cp    0.00%    28064k   find
       4    1.72%       0.00re    0.00%       0.00cp    0.00%    25216k   logger
       3    1.29%       0.00re    0.00%       0.00cp    0.00%    26512k   sh*
       3    1.29%       0.00re    0.00%       0.00cp    0.00%    26304k   date
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     2076k   hostname
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1595k   grep
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1561k   tput
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1020k   dircolors
       3    1.29%       0.00re    0.00%       0.00cp    0.00%     1017k   tty
       2    0.86%       0.15re    0.00%       0.00cp    0.00%    16992k   sshd*
       2    0.86%       0.09re    0.00%       0.00cp    0.00%    25232k   tail
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   0anacron
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26480k   awk
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   service*
       2    0.86%       0.00re    0.00%       0.00cp    0.00%    26512k   run-parts*

11. Display last executed commands :
[root@oss ~]# lastcomm
sa                      root     pts/0      0.00 secs Thu Aug 21 00:16
sa                      ehowstuf pts/2      0.00 secs Thu Aug 21 00:14
sa                      root     pts/0      0.00 secs Thu Aug 21 00:12
crond             SF    root     __         0.00 secs Thu Aug 21 00:10
sadc              S     root     __         0.00 secs Thu Aug 21 00:10
anacron            F    root     __         0.00 secs Thu Aug 21 00:01
crond             SF    root     __         0.00 secs Thu Aug 21 00:01
run-parts               root     __         0.01 secs Thu Aug 21 00:01
logger                  root     __         0.00 secs Thu Aug 21 00:01
basename                root     __         0.00 secs Thu Aug 21 00:01
awk                     root     __         0.00 secs Thu Aug 21 00:01
0anacron                root     __         0.00 secs Thu Aug 21 00:01
anacron                 root     __         0.00 secs Thu Aug 21 00:01
date                    root     __         0.00 secs Thu Aug 21 00:01
cat                     root     __         0.00 secs Thu Aug 21 00:01
logger                  root     __         0.00 secs Thu Aug 21 00:01
basename                root     __         0.00 secs Thu Aug 21 00:01
run-parts          F    root     __         0.00 secs Thu Aug 21 00:01
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
getconf                 nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
uptime                  nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
netstat                 nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
mount                   nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
df                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ifconfig                nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
ls                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
fdisk                   nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
crond             SF    nobody   __         0.00 secs Thu Aug 21 00:00
nmon                    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
sh                 F    nobody   __         0.00 secs Thu Aug 21 00:00
sh                      nobody   __         0.00 secs Thu Aug 21 00:00
cat                     nobody   __         0.00 secs Thu Aug 21 00:00
xargs                   nobody   __         0.00 secs Thu Aug 21 00:00
rm                      nobody   __         0.00 secs Thu Aug 21 00:00
find                    nobody   __         0.00 secs Thu Aug 21 00:00
crond             SF    root     __         0.00 secs Thu Aug 21 00:00
sadc              S     root     __         0.00 secs Thu Aug 21 00:00
pkill                   nobody   __         0.00 secs Thu Aug 21 00:00
flush-8:0          F    root     __         0.00 secs Wed Aug 20 23:25
crond             SF    root     __         0.00 secs Wed Aug 20 23:53
sa2                     root     __         0.00 secs Wed Aug 20 23:53
rmdir                   root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
find                    root     __         0.00 secs Wed Aug 20 23:53
sar                     root     __         0.02 secs Wed Aug 20 23:53
date                    root     __         0.00 secs Wed Aug 20 23:53
crond             SF    root     __         0.00 secs Wed Aug 20 23:50
sadc              S     root     __         0.01 secs Wed Aug 20 23:50
sa                      root     pts/0      0.00 secs Wed Aug 20 23:47
sa                      root     pts/0      0.00 secs Wed Aug 20 23:45
ac                      root     pts/0      0.00 secs Wed Aug 20 23:44
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:43
ac                      root     pts/0      0.00 secs Wed Aug 20 23:41
ac                      root     pts/0      0.00 secs Wed Aug 20 23:40
crond             SF    root     __         0.00 secs Wed Aug 20 23:40
sadc              S     root     __         0.00 secs Wed Aug 20 23:40
service                 root     pts/0      0.01 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
service            F    root     pts/0      0.00 secs Wed Aug 20 23:39
consoletype             root     pts/0      0.00 secs Wed Aug 20 23:39
service                 root     pts/0      0.01 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
basename                root     pts/0      0.00 secs Wed Aug 20 23:39
service            F    root     pts/0      0.00 secs Wed Aug 20 23:39
consoletype             root     pts/0      0.00 secs Wed Aug 20 23:39
tail                  X root     pts/0      0.00 secs Wed Aug 20 23:39
bash               F    root     pts/0      0.00 secs Wed Aug 20 23:39
ls                      root     pts/0      0.00 secs Wed Aug 20 23:39
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:39
crond             SF    root     __         0.00 secs Wed Aug 20 23:30
sadc              S     root     __         0.00 secs Wed Aug 20 23:30
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:27
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:26
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:26
flush-8:0          F    root     __         0.00 secs Wed Aug 20 23:19
crond             SF    root     __         0.00 secs Wed Aug 20 23:20
sadc              S     root     __         0.00 secs Wed Aug 20 23:20
flush-8:0          F    root     __         0.02 secs Wed Aug 20 22:50
sa                      root     pts/0      0.00 secs Wed Aug 20 23:13
sa                      root     pts/0      0.00 secs Wed Aug 20 23:13
lastcomm                root     pts/0      0.00 secs Wed Aug 20 23:13
crond             SF    root     __         0.00 secs Wed Aug 20 23:10
sadc              S     root     __         0.00 secs Wed Aug 20 23:10
ac                      root     pts/0      0.00 secs Wed Aug 20 23:06
crond             SF    root     __         0.00 secs Wed Aug 20 23:01
run-parts               root     __         0.00 secs Wed Aug 20 23:01
logger                  root     __         0.00 secs Wed Aug 20 23:01
basename                root     __         0.00 secs Wed Aug 20 23:01
awk                     root     __         0.00 secs Wed Aug 20 23:01
0anacron                root     __         0.00 secs Wed Aug 20 23:01
date                    root     __         0.00 secs Wed Aug 20 23:01
cat                     root     __         0.00 secs Wed Aug 20 23:01
logger                  root     __         0.00 secs Wed Aug 20 23:01
basename                root     __         0.00 secs Wed Aug 20 23:01
run-parts          F    root     __         0.00 secs Wed Aug 20 23:01
crond             SF    root     __         0.00 secs Wed Aug 20 23:00
sadc              S     root     __         0.00 secs Wed Aug 20 23:00
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
sshd              S     root     __         0.05 secs Wed Aug 20 22:57
bash              S     root     pts/1      0.01 secs Wed Aug 20 22:57
su                S     root     pts/1      0.00 secs Wed Aug 20 22:57
bash              S     ehowstuf pts/1      0.03 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
consoletype             ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
grep                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
dircolors               ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
tput                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
tty                     ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
hostname                ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
bash               F    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
id                      ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
sshd              SF    sshd     __         0.00 secs Wed Aug 20 22:59
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
mkdir                   ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ls                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
tail                  X root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
ac                      root     pts/0      0.00 secs Wed Aug 20 22:58
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
consoletype             ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
grep                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
dircolors               ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
tput                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
tty                     ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
hostname                ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
id                      ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
id                      root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
consoletype             root     pts/1      0.00 secs Wed Aug 20 22:57
grep                    root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
dircolors               root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
tput                    root     pts/1      0.00 secs Wed Aug 20 22:57
tty                     root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
hostname                root     pts/1      0.00 secs Wed Aug 20 22:57
bash               F    root     pts/1      0.00 secs Wed Aug 20 22:57
id                      root     pts/1      0.00 secs Wed Aug 20 22:57
sshd              SF    sshd     __         0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:57
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
ac                      root     pts/0      0.00 secs Wed Aug 20 22:56
psacct                  root     pts/0      0.01 secs Wed Aug 20 22:55
touch                   root     pts/0      0.00 secs Wed Aug 20 22:55
accton            S     root     pts/0      0.00 secs Wed Aug 20 22:55

12. Search Logs for Commands :

[root@oss ~]# lastcomm grep
grep                    ehowstuf pts/2      0.00 secs Wed Aug 20 22:59
grep                    ehowstuf pts/1      0.00 secs Wed Aug 20 22:57
grep                    root     pts/1      0.00 secs Wed Aug 20 22:57

How to Setup Sar (Sysstat) – Monitor Linux System Performance

Sysstat contains various utilities to collect and historize performance and monitor server activity on the linux. Sar is part of the sysstat package. by using sar, we can collect, report, or save system resource utilization information. It will help system administrator to troubleshoot performance issues, or to optimize performance. This post will show how to setup and the usage of sar on linux CentOS 6.5.

1. Install sar (systat) :

[root@oss ~]# yum install sysstat -y

2. Verify the sar version using “sar -V”

[root@oss ~]# sar -V
sysstat version 9.0.4
(C) Sebastien Godard (sysstat  orange.fr)

3. Sar usage examples :

a) Check swap usage :

[root@oss ~]# sar -W
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:10:01 PM  pswpin/s pswpout/s
11:20:01 PM      0.00      0.00
11:30:01 PM      0.00      0.00
11:40:01 PM      0.00      0.00
Average:         0.00      0.00

b) Check system load :

[root@oss ~]# sar -q
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:10:01 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
11:20:01 PM         0        86      0.00      0.00      0.00
11:30:01 PM         0        85      0.00      0.00      0.00
11:40:01 PM         0        85      0.00      0.00      0.00
Average:            0        85      0.00      0.00      0.00

c) Collect CPU statistics 3 times within 1 second interval :

[root@oss ~]# sar 1 3
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:46:55 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
11:46:56 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
11:46:57 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
11:46:58 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
Average:        all      0.00      0.00      0.17      0.00      0.00     99.83

d) Displaying the RAM Load:

[root@oss ~]# sar -r
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:10:01 PM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
11:20:01 PM   3670608    254080      6.47     11872    160172     67684      1.12
11:30:01 PM   3670616    254072      6.47     11892    160172     67684      1.12
11:40:01 PM   3670508    254180      6.48     11920    160180     67684      1.12
Average:      3670577    254111      6.47     11895    160175     67684      1.12

e) Display paging statistic :

[root@oss ~]# sar -B
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:10:01 PM  pgpgin/s pgpgout/s   fault/s  majflt/s  pgfree/s pgscank/s pgscand/s pgsteal/s    %vmeff
11:20:01 PM      0.00      0.23      8.21      0.00      4.36      0.00      0.00      0.00      0.00
11:30:01 PM      0.00      0.19      2.70      0.00      1.29      0.00      0.00      0.00      0.00
11:40:01 PM      0.00      0.14      3.75      0.00      1.62      0.00      0.00      0.00      0.00
11:50:01 PM      0.00      0.16      6.60      0.00      2.80      0.00      0.00      0.00      0.00
Average:         0.00      0.18      5.31      0.00      2.52      0.00      0.00      0.00      0.00

f) Display Swap space utilization statistics :

[root@oss ~]# sar -S
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/18/2014      _x86_64_        (2 CPU)

11:10:01 PM kbswpfree kbswpused  %swpused  kbswpcad   %swpcad
11:20:01 PM   2097144         0      0.00         0      0.00
11:30:01 PM   2097144         0      0.00         0      0.00
11:40:01 PM   2097144         0      0.00         0      0.00
11:50:01 PM   2097144         0      0.00         0      0.00
Average:      2097144         0      0.00         0      0.00

4. Monitor previous day sar statictics :

Every sar statictics by default stored in /var/log/sa. Es example :

[root@oss sa]# ls
sa18  sa19  sa20  sa21  sa22  sa23  sa24  sar18  sar19  sar20  sar23

a. Display cpu load on sa22 :

[root@oss sa]# sar -f /var/log/sa/sa22
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/22/2014      _x86_64_        (2 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all      0.04      0.00      0.06      0.06      0.00     99.84
12:20:01 AM     all      0.03      0.00      0.05      0.07      0.00     99.85
12:30:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
12:40:01 AM     all      0.34      0.00      0.71      0.02      0.00     98.93
12:50:01 AM     all      1.67      0.00      3.19      0.01      0.00     95.13
01:00:01 AM     all      0.64      0.00      0.83      0.74      0.00     97.79
01:10:01 AM     all      0.64      0.00      1.51      0.03      0.00     97.83
01:20:01 AM     all      0.35      0.00      0.71      0.13      0.00     98.81
01:30:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
01:40:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
01:50:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.91
02:00:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
02:10:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
02:20:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
02:30:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
02:40:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
02:50:01 AM     all      0.03      0.00      0.04      0.01      0.00     99.92
03:00:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.92
03:10:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
03:20:01 AM     all      0.03      0.00      0.04      0.01      0.00     99.92
03:30:01 AM     all      0.03      0.00      0.04      0.01      0.00     99.92
03:40:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.91
03:50:01 AM     all      0.03      0.00      0.05      0.03      0.00     99.89
04:00:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
04:10:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
04:20:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.92
04:30:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
04:40:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
04:50:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91
05:00:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.92
05:10:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
05:20:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.91
05:30:01 AM     all      0.03      0.00      0.04      0.02      0.00     99.91

05:30:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
05:40:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
05:50:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
06:00:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.91
06:10:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.90
06:20:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
06:30:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
06:40:02 AM     all      0.03      0.00      0.05      0.01      0.00     99.92
06:50:01 AM     all      0.03      0.00      0.04      0.01      0.00     99.92
07:00:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
07:10:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
07:20:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.92
07:30:01 AM     all      0.03      0.00      0.04      0.01      0.00     99.92
07:40:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
07:50:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
08:00:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
08:10:01 AM     all      0.03      0.00      0.05      0.02      0.00     99.90
08:20:01 AM     all      0.03      0.00      0.05      0.01      0.00     99.91
Average:        all      0.10      0.00      0.18      0.03      0.00     99.69

b. Display RAM Load on sa22 :

[root@oss sa]# sar -f /var/log/sa/sa22 -r
Linux 2.6.32-431.el6.x86_64 (oss.ehowstuff.local)       08/22/2014      _x86_64_        (2 CPU)

12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
12:10:01 AM   3807336    117352      2.99      8252     32352     66920      1.11
12:20:01 AM   3804708    119980      3.06      8712     32812     71440      1.19
12:30:01 AM   3804584    120104      3.06      8744     32816     71592      1.19
12:40:01 AM   3799784    124904      3.18      8768     33124     72228      1.20
12:50:01 AM   3799668    125020      3.19      8800     33124     72228      1.20
01:00:01 AM   3723612    201076      5.12     10048    110608     71592      1.19
01:10:01 AM   3718804    205884      5.25     10232    111044     72228      1.20
01:20:01 AM   3711560    213128      5.43     10284    122396     71592      1.19
01:30:01 AM   3711684    213004      5.43     10324    122408     71592      1.19
01:40:01 AM   3711436    213252      5.43     10348    122408     71592      1.19
01:50:01 AM   3711436    213252      5.43     10372    122412     71592      1.19
02:00:01 AM   3711560    213128      5.43     10404    122416     71592      1.19
02:10:01 AM   3711576    213112      5.43     10444    122424     71592      1.19
02:20:01 AM   3711568    213120      5.43     10476    122428     71592      1.19
02:30:01 AM   3711444    213244      5.43     10516    122436     71592      1.19
02:40:01 AM   3711320    213368      5.44     10552    122436     71592      1.19
02:50:01 AM   3711320    213368      5.44     10580    122444     71592      1.19
03:00:01 AM   3711188    213500      5.44     10612    122448     71592      1.19
03:10:01 AM   3711180    213508      5.44     10652    122456     72168      1.20
03:20:01 AM   3711180    213508      5.44     10676    122456     72168      1.20
03:30:01 AM   3710932    213756      5.45     10708    122464     72168      1.20
03:40:01 AM   3710692    213996      5.45     10740    122464     72168      1.20
03:50:01 AM   3710700    213988      5.45     10928    122604     71592      1.19
04:00:01 AM   3710568    214120      5.46     10960    122608     71592      1.19
04:10:01 AM   3710816    213872      5.45     11000    122608     71592      1.19
04:20:01 AM   3710576    214112      5.46     11032    122616     71592      1.19
04:30:01 AM   3710576    214112      5.46     11068    122616     71592      1.19
04:40:01 AM   3710708    213980      5.45     11096    122624     71592      1.19
04:50:01 AM   3710452    214236      5.46     11128    122628     71592      1.19
05:00:01 AM   3710576    214112      5.46     11160    122636     71592      1.19
05:10:01 AM   3710452    214236      5.46     11200    122636     71592      1.19
05:20:01 AM   3710576    214112      5.46     11232    122644     71592      1.19
05:30:01 AM   3710708    213980      5.45     11268    122644     71592      1.19

05:30:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
05:40:01 AM   3710320    214368      5.46     11296    122652     71592      1.19
05:50:01 AM   3710072    214616      5.47     11320    122652     71592      1.19
06:00:01 AM   3710204    214484      5.46     11364    122660     71592      1.19
06:10:01 AM   3710072    214616      5.47     11400    122664     71592      1.19
06:20:01 AM   3710204    214484      5.46     11424    122668     71592      1.19
06:30:01 AM   3710204    214484      5.46     11464    122676     71592      1.19
06:40:02 AM   3709948    214740      5.47     11488    122680     71592      1.19
06:50:01 AM   3710072    214616      5.47     11512    122680     71592      1.19
07:00:01 AM   3710204    214484      5.46     11552    122680     71592      1.19
07:10:01 AM   3709824    214864      5.47     11584    122692     71592      1.19
07:20:01 AM   3709948    214740      5.47     11612    122688     71592      1.19
07:30:01 AM   3709956    214732      5.47     11648    122700     71592      1.19
07:40:01 AM   3709956    214732      5.47     11680    122704     71592      1.19
07:50:01 AM   3709824    214864      5.47     11704    122708     71592      1.19
08:00:01 AM   3709832    214856      5.47     11744    122712     71592      1.19
08:10:01 AM   3709700    214988      5.48     11784    122724     71592      1.19
08:20:01 AM   3709700    214988      5.48     11812    122720     71592      1.19
Average:      3720306    204382      5.21     10794    113138     71580      1.19

5. Other sar options :

[root@oss ~]# sar -h
Usage: sar [ options ] [  [  ] ]
Main options and reports:
        -b      I/O and transfer rate statistics
        -B      Paging statistics
        -d      Block device statistics
        -I {  | SUM | ALL | XALL }
                Interrupts statistics
        -m      Power management statistics
        -n {  [,...] | ALL }
                Network statistics
                Keywords are:
                DEV     Network interfaces
                EDEV    Network interfaces (errors)
                NFS     NFS client
                NFSD    NFS server
                SOCK    Sockets (v4)
                IP      IP traffic      (v4)
                EIP     IP traffic      (v4) (errors)
                ICMP    ICMP traffic    (v4)
                EICMP   ICMP traffic    (v4) (errors)
                TCP     TCP traffic     (v4)
                ETCP    TCP traffic     (v4) (errors)
                UDP     UDP traffic     (v4)
                SOCK6   Sockets (v6)
                IP6     IP traffic      (v6)
                EIP6    IP traffic      (v6) (errors)
                ICMP6   ICMP traffic    (v6)
                EICMP6  ICMP traffic    (v6) (errors)
                UDP6    UDP traffic     (v6)
        -q      Queue length and load average statistics
        -r      Memory utilization statistics
        -R      Memory statistics
        -S      Swap space utilization statistics
        -u [ ALL ]
                CPU utilization statistics
        -v      Kernel table statistics
        -w      Task creation and system switching statistics
        -W      Swapping statistics
        -y      TTY device statistics

6. Other sysstat utilities:

sar collects and displays ALL system activities statistics.
sadc stands for “system activity data collector”. This is the sar backend tool that does the data collection.
sa1 stores system activities in binary data file. sa1 depends on sadc for this purpose. sa1 runs from cron.
sa2 creates daily summary of the collected statistics. sa2 runs from cron.
sadf can generate sar report in CSV, XML, and various other formats. Use this to integrate sar data with other tools.
iostat generates CPU, I/O statistics
mpstat displays CPU statistics.
pidstat reports statistics based on the process id (PID)
nfsiostat displays NFS I/O statistics.
cifsiostat generates CIFS statistics.

How to Setup nmon – Monitor Linux Performance

Nmon (Nigel’s Monitor) is a great performance monitoring tool for Linux operating system.

It was written initially for AIX to monitor system performance. nmon for Linux can be used to collect informations on CPU, memory, network, disk I/O, top processes etc.

System administrator can use nmon as a tuner or benchmark tool that will provide performance information in one go.

It can output the data on the screen or can be save the data into a comma separated file for analysis and longer term data capture.

Steps to setup nmon on linux operating system.

1. How to Add the RPMforge Repository on CentOS 6/RHEL 6 Linux Server

2. Rum yum command to install nmon :

# yum install nmon -y

3. Example of nmon command usage :

Type command :

# nmon

Sample output :
setup nmon

nmon keyboard shortcuts

q – To stop and exit nmon.
h – To see quick help (hint) screen and press h again to remove the hints.
Use the following command to turn on or off stats:
c – See cpu stats.
m – See memory stats.
d – See disk stats.
k – See kernel stats.
n – See network stats.
N – See NFS stats.
j – See file system stats.
t – See top process.
V – See virtual memory stats.
. – See only busy disks/procs.
v – Verbose mode (display as Ok/warning/danger on screen).

Sample outputs :
setup nmon

4. If you prefer to run nmon as a daemon in the background, run the below command, nmon will complete the data file collection and it will save in a file *.nmon file such as oss_140817_2359.nmon with the details of the command as below :

# nmon -f -s2 -c 30
-f : Start data collect mode and output in spreadsheet format.
-s 2 : Wait between 2 seconds or capture data every 2 seconds.
-c30 : Total number of refreshes (30).

How to Setup Monitorix – Network and System Monitoring Tool for Linux

Monitorix is an open source and lightweight system monitoring tool designed to monitor network and system resources in linux/UNIX operating system. Monitorix can collects network and system performce and also resources and then display the informations into graphs. it will help system adn network administrator to detect abnormal activities and detecting bottlenecks. This post will show to setup Monitorix on linux centOS 6.5.

1. Prepare additional repository (EPEL repository).
2. Install required packages :

[root@oss ~]# yum install rrdtool rrdtool-perl perl-libwww-perl perl-MailTools perl-MIME-Lite perl-CGI perl-DBI perl-XML-Simple perl-Config-General perl-HTTP-Server-Simple perl-IO-Socket-SSL -y

3. Install monitorix package :

[root@oss ~]# yum install monitorix -y

Once succesfully installed, please take a look into the configuration file /etc/monitorix.conf to fit your system and enable or disable graphs.

4. Start Monitorix with below command :

[root@oss ~]# service monitorix start

Once started, Monitorix will start gathering the system information based on the configuration set in monitorix.conf file:

5. After a few minutes you should be able to see graph from your browser :

http://IP-Address:8080/monitorix/

install-monitorx-1

install-monitorx-2

install-monitorx-3

How to Install Zabbix 2.2 Server on CentOS 6.5

ZABBIX is an enterprise-class open source monitoring solution designed to monitor servers and various network services. Zabbix will perform simple checks can verify the availability and responsiveness of standard services. It was created by Alexei Vladishev. Follow this step to install zabbix 2.2 server on CentOS 6.5 :

1. Install httpd, php and MySQL :

[root@oss ~]# yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml httpd httpd-devel mysql mysql-server -y

2. Zabbix package files are available at repo.zabbix.com :

[root@oss ~]# wget http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
--2014-08-12 22:19:07--  http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
Resolving repo.zabbix.com... 87.110.183.174
Connecting to repo.zabbix.com|87.110.183.174|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11256 (11K) [application/x-redhat-package-manager]
Saving to: âzabbix-release-2.2-1.el6.noarch.rpmâ

100%[==========================================================>] 11,256      7.09K/s   in 1.6s

2014-08-12 22:19:09 (7.09 KB/s) - âzabbix-release-2.2-1.el6.noarch.rpmâ
[root@oss ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  zabbix-release-2.2-1.el6.noarch.rpm
[root@oss ~]# rpm -Uvh zabbix-release-2.2-1.el6.noarch.rpm
warning: zabbix-release-2.2-1.el6.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing...                ########################################### [100%]
   1:zabbix-release         ########################################### [100%]

3. Install Zabbix server :

[root@oss ~]# yum install zabbix-agent zabbix-web-mysql zabbix-server-mysql zabbix-java-gateway -y

4. Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf. Some PHP settings are already configured.

    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    php_value date.timezone Asia/Kuala_Lumpur

5. Restart zabbix and make zabbix start at boot :

[root@oss ~]# service zabbix-server start
Starting Zabbix server:                                    [  OK  ]
[root@oss ~]# chkconfig zabbix-server on

6. Setup Zabbix database :

mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit

7. Import initial schema and data :

[root@oss ~]# cd /usr/share/doc/zabbix-server-mysql-2.2.5/create

[root@oss create]# mysql -u zabbix -p zabbix < schema.sql
Enter password:
[root@oss create]# mysql -u zabbix -p zabbix < images.sql
Enter password:
[root@oss create]# mysql -u zabbix -p zabbix < data.sql
Enter password:

8. Start zabbix installation wizard :

http://192.168.0.8/zabbix/setup.php
setup zabbix-1

setup zabbix-2

setup zabbix-3

setup zabbix-4

setup zabbix-5

setup zabbix-6

9. If the configuration file is not writable, manually edit database configuration in zabbix_server.conf as below :

# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

10. Open required port at iptables :

[root@oss ~]# netstat -plunt | grep LISTEN
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1124/sshd
tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      4190/zabbix_server
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4074/mysqld
tcp        0      0 :::80                       :::*                        LISTEN      1417/httpd
tcp        0      0 :::22                       :::*                        LISTEN      1124/sshd
tcp        0      0 :::10051                    :::*                        LISTEN      4190/zabbix_server
[root@oss ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Restart iptables :

[root@oss ~]# service iptables restart

11. Zabbix frontend is available at http://IP-address/zabbix in the browser.

The default username/password is Admin/zabbix.

setup zabbix-7

Zabbix server setup completed. You can start to setup zabbix agent now.

How to Install and use Glances – System Monitor In Ubuntu

There are various default system monitor tools in Ubuntu that come with basic functions. However, there is recommended powerful free monitoring called Glances – An eye on your system. Glances is the monitoring tools that used to monitor GNU/Linux or BSD operating system from a command line interface and it uses the library libstatgrab to retrieve information and it is written in Python. The steps on this post was tested on Ubuntu 14.04 linux.

1. How to install glances on Ubuntu :

ehowstuff@ubuntu14:~$ sudo apt-get install glances -y

2. To start glances simply type glances from command line :

ehowstuff@ubuntu14:~$ glances

Monitor-Ubuntu-Glances-1

There are a lot of information retrieved about the resources of your system such as CPU, Load, Memory, Swap Network, Disk I/O and Processes all in one page, by default the color code means:

GREEN : the statistic is “OK”
BLUE : the statistic is “CAREFUL” (to watch)
VIOLET : the statistic is “WARNING” (alert)
RED : the statistic is “CRITICAL” (critical)

3. By default, interval time is set to ’1‘ second. You can change the interval by issue the following command :

ehowstuff@ubuntu14:~$ glances -t 2

4. Once in the glaces monitoring screen, press h to find out more hot keys to gather output information while glances is running.
Monitor-Ubuntu-Glances-2

How to Install Nagios Monitoring Server on CentOS 6.5

Nagios is one of the alternate open source computer, network and infrastructure monitoring system that will help organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios provides host, service and network monitoring capabilities and was designed with scalability and flexibility. With complete monitoring and alerting, nagios allows you to detect and repair problems and mitigate future issues before they affect end-users and customers. This post will show you how you can install Nagios monitoring server on CentOS 6.5

1. Prepare and download EPEL repository :

[root@centos6-05 ~]# wget dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2. Install EPEL repository :

[root@centos6-05 ~]# rpm -Uvh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
1:epel-release           ########################################### [100%]

3. Install Nagis packages, php and httpd web server :

[root@centos6-05 ~]# yum install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd -y

Example:

[root@centos6-05 ~]# yum install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * Webmin: download.webmin.com
 * base: mirror.upsi.edu.my
 * epel: mirror.smartmedia.net.id
 * extras: mirror.upsi.edu.my
 * updates: mirror.upsi.edu.my
Setting up Install Process
Package php-5.3.3-27.el6_5.x86_64 already installed and latest version
Package httpd-2.2.15-29.el6.centos.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package nagios.x86_64 0:3.5.1-1.el6 will be installed
--> Processing Dependency: user(nagios) for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: user(nagios) for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: nagios-common for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: mailx for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: group(nagios) for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: group(nagios) for package: nagios-3.5.1-1.el6.x86_64
--> Processing Dependency: libgd.so.2()(64bit) for package: nagios-3.5.1-1.el6.x86_64
---> Package nagios-plugins-all.x86_64 0:1.4.16-10.el6 will be installed
--> Processing Dependency: nagios-plugins-wave for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-users for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ups for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-time for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-tcp for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-swap for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ssh for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-snmp for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-smtp for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-sensors for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-rpc for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-real for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-procs for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ping for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-pgsql for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-overcr for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-oracle for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-nwstat for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ntp-perl for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ntp for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-nt for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-nagios for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-mysql for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-mrtgtraf for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-mrtg for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-mailq for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-log for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-load for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ldap for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ircd for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-ide_smart for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-icmp for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-http for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-hpjd for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-game for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-fping for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-flexlm for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-file_age for package: nagios-plugins-all-1.4.16-10.el6.x86_64
--> Processing Dependency: nagios-plugins-dummy for package: nagios-plugins-all-1.4.16-10.el6.x86_64
..
..
..

Installed:
  nagios.x86_64 0:3.5.1-1.el6                     nagios-plugins-all.x86_64 0:1.4.16-10.el6
  nagios-plugins-nrpe.x86_64 0:2.14-5.el6         nrpe.x86_64 0:2.14-5.el6

Dependency Installed:
  dmidecode.x86_64 1:2.11-2.el6                    fontconfig.x86_64 0:2.8.0-3.el6
  fping.x86_64 0:2.4b2-10.el6                      gd.x86_64 0:2.0.35-11.el6
  libgssglue.x86_64 0:0.1-11.el6                   libtalloc.x86_64 0:2.0.7-2.el6
  libtdb.x86_64 0:1.2.10-1.el6                     libtevent.x86_64 0:0.9.18-3.el6
  libtirpc.x86_64 0:0.2.1-6.el6_4                  lm_sensors.x86_64 0:3.1.1-17.el6
  mailx.x86_64 0:12.4-7.el6                        nagios-common.x86_64 0:3.5.1-1.el6
  nagios-plugins.x86_64 0:1.4.16-10.el6            nagios-plugins-breeze.x86_64 0:1.4.16-10.el6
  nagios-plugins-by_ssh.x86_64 0:1.4.16-10.el6     nagios-plugins-cluster.x86_64 0:1.4.16-10.el6
  nagios-plugins-dhcp.x86_64 0:1.4.16-10.el6       nagios-plugins-dig.x86_64 0:1.4.16-10.el6
  nagios-plugins-disk.x86_64 0:1.4.16-10.el6       nagios-plugins-disk_smb.x86_64 0:1.4.16-10.el6
  nagios-plugins-dns.x86_64 0:1.4.16-10.el6        nagios-plugins-dummy.x86_64 0:1.4.16-10.el6
  nagios-plugins-file_age.x86_64 0:1.4.16-10.el6   nagios-plugins-flexlm.x86_64 0:1.4.16-10.el6
  nagios-plugins-fping.x86_64 0:1.4.16-10.el6      nagios-plugins-game.x86_64 0:1.4.16-10.el6
  nagios-plugins-hpjd.x86_64 0:1.4.16-10.el6       nagios-plugins-http.x86_64 0:1.4.16-10.el6
  nagios-plugins-icmp.x86_64 0:1.4.16-10.el6       nagios-plugins-ide_smart.x86_64 0:1.4.16-10.el6
  nagios-plugins-ircd.x86_64 0:1.4.16-10.el6       nagios-plugins-ldap.x86_64 0:1.4.16-10.el6
  nagios-plugins-load.x86_64 0:1.4.16-10.el6       nagios-plugins-log.x86_64 0:1.4.16-10.el6
  nagios-plugins-mailq.x86_64 0:1.4.16-10.el6      nagios-plugins-mrtg.x86_64 0:1.4.16-10.el6
  nagios-plugins-mrtgtraf.x86_64 0:1.4.16-10.el6   nagios-plugins-mysql.x86_64 0:1.4.16-10.el6
  nagios-plugins-nagios.x86_64 0:1.4.16-10.el6     nagios-plugins-nt.x86_64 0:1.4.16-10.el6
  nagios-plugins-ntp.x86_64 0:1.4.16-10.el6        nagios-plugins-ntp-perl.x86_64 0:1.4.16-10.el6
  nagios-plugins-nwstat.x86_64 0:1.4.16-10.el6     nagios-plugins-oracle.x86_64 0:1.4.16-10.el6
  nagios-plugins-overcr.x86_64 0:1.4.16-10.el6     nagios-plugins-perl.x86_64 0:1.4.16-10.el6
  nagios-plugins-pgsql.x86_64 0:1.4.16-10.el6      nagios-plugins-ping.x86_64 0:1.4.16-10.el6
  nagios-plugins-procs.x86_64 0:1.4.16-10.el6      nagios-plugins-real.x86_64 0:1.4.16-10.el6
  nagios-plugins-rpc.x86_64 0:1.4.16-10.el6        nagios-plugins-sensors.x86_64 0:1.4.16-10.el6
  nagios-plugins-smtp.x86_64 0:1.4.16-10.el6       nagios-plugins-snmp.x86_64 0:1.4.16-10.el6
  nagios-plugins-ssh.x86_64 0:1.4.16-10.el6        nagios-plugins-swap.x86_64 0:1.4.16-10.el6
  nagios-plugins-tcp.x86_64 0:1.4.16-10.el6        nagios-plugins-time.x86_64 0:1.4.16-10.el6
  nagios-plugins-ups.x86_64 0:1.4.16-10.el6        nagios-plugins-users.x86_64 0:1.4.16-10.el6
  nagios-plugins-wave.x86_64 0:1.4.16-10.el6       net-snmp-utils.x86_64 1:5.5-49.el6
  ntp.x86_64 0:4.2.6p5-1.el6.centos                ntpdate.x86_64 0:4.2.6p5-1.el6.centos
  openssh-clients.x86_64 0:5.3p1-94.el6            qstat.x86_64 0:2.11-9.20080912svn311.el6
  rpcbind.x86_64 0:0.2.0-11.el6                    samba-client.x86_64 0:3.6.9-167.el6_5
  samba-common.x86_64 0:3.6.9-167.el6_5            samba-winbind.x86_64 0:3.6.9-167.el6_5
  samba-winbind-clients.x86_64 0:3.6.9-167.el6_5

Complete!

4. Make httpd and nagios software auto start at boot :

[root@centos6-05 ~]# chkconfig httpd on
[root@centos6-05 ~]# chkconfig nagios on

5. Start httpd and nagios software :

[root@centos6-05 ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@centos6-05 ~]# service nagios start
Starting nagios: done.

6. Set Nagios Admin Panel Password:

[root@centos6-05 ~]# htpasswd -c /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

7. Navigate over to your IP address http://IPADDRESS/nagios and login using above “nagiosadmin” > However, you still able to change /etc/nagios/cgi.cfg and redefine authorized admin anytime later.

[root@centos6-05 ~]# vi /etc/nagios/cgi.cfg
..
..
authorized_for_system_information=nagiosadmin
..
..