cacti – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Fri, 11 Oct 2013 03:55:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 Top 15 System and Performance Monitoring Tools for Linux https://tecadmin.net/linux-system-and-performance-monitoring-tools/ https://tecadmin.net/linux-system-and-performance-monitoring-tools/#comments Fri, 11 Oct 2013 03:55:34 +0000 https://tecadmin.net/?p=2762 System monitoring is the primary responsibility of every System Administrator. I think every system admin must know few command line and few automatic system monitoring tools. In this article, I am providing 15 monitoring tools and i hope it will help you. #1. Top ( A Linux Command ) Top is the basic and frequently [...]

The post Top 15 System and Performance Monitoring Tools for Linux appeared first on TecAdmin.

]]>
System monitoring is the primary responsibility of every System Administrator. I think every system admin must know few command line and few automatic system monitoring tools. In this article, I am providing 15 monitoring tools and i hope it will help you.

#1. Top ( A Linux Command )

Top is the basic and frequently used command. It shows all real time statics of running process and monitor system performance. I had used it during my study time and I am still using it. This command comes with most Linux/Unix versions. Top provides Process PID, CPU and Memory usage, Swap Memory, cache size, Buffer Size etc.

 # top

Monitoring Tools - Top Command

Read more – How to read Top command output

#2. ps

ps command provides the details of current running processes. ps also provides many options to get results more specific results

  # ps -e

  PID TTY          TIME CMD
    1 ?        00:00:01 init
    2 ?        00:00:00 kthreadd
    3 ?        00:00:00 migration/0
    4 ?        00:00:00 ksoftirqd/0
    5 ?        00:00:00 migration/0
    6 ?        00:00:00 watchdog/0
    7 ?        00:00:00 events/0
    8 ?        00:00:00 cpuset
    9 ?        00:00:00 khelper
   10 ?        00:00:00 netns
   11 ?        00:00:00 async/mgr
   12 ?        00:00:00 pm
   13 ?        00:00:00 sync_supers
   ...
To List all Processes on Server
# ps aux
To List all Processes of Specific User
# ps -u <user_name>

#3. netstat (network statistics)

netstat is very useful tool for printing network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.

For example following command will provide list of all listening TCP and UDP ports with there services name.

# netstat -tulnp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address     Foreign Address     State       PID/Program name
tcp        0      0 0.0.0.0:111       0.0.0.0:*           LISTEN      1371/rpcbind
tcp        0      0 0.0.0.0:39698     0.0.0.0:*           LISTEN      1458/rpc.statd
tcp        0      0 0.0.0.0:22        0.0.0.0:*           LISTEN      1683/sshd
tcp        0      0 127.0.0.1:631     0.0.0.0:*           LISTEN      1556/cupsd
tcp        0      0 127.0.0.1:25      0.0.0.0:*           LISTEN      1771/master
tcp        0      0 :::80             :::*                LISTEN      2247/httpd
tcp        0      0 :::22             :::*                LISTEN      1683/sshd
udp        0      0 0.0.0.0:47307     0.0.0.0:*                       1440/avahi-daemon
udp        0      0 0.0.0.0:111       0.0.0.0:*                       1371/rpcbind
udp        0      0 0.0.0.0:631       0.0.0.0:*                       1556/cupsd
udp        0      0 0.0.0.0:41242     0.0.0.0:*                       1458/rpc.statd
udp        0      0 0.0.0.0:698       0.0.0.0:*                       1371/rpcbind
udp        0      0 :::111            :::*                            1371/rpcbind

#4. Nagios

Nagios open source and powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.

Using Nagios we can easily monitor host systems, local or remote services, network peripherals etc. It also provides a high level notification system via email, sms etc.

Read the Tutorial: Install Nagios and NagiosQL on CentOS, RHEL System

#5 vnStat

vnStat is a console-based network traffic monitor for Linux based system.It counts bandwidth ( transmit and received ) on network interface and stored in own database. vnStat also provides a PHP based web interface to show network statics in well formed graphs.

  • Show Statistics for a day
# vnstat -d

 eth0  /  daily

         day         rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
      05/07/13    213.12 MiB |  837.71 MiB |    1.03 GiB |  120.06 kbit/s
     ------------------------+-------------+-------------+---------------
     estimated       256 MiB |    0.98 GiB |    1.23 GiB |

  • Show Statistics for a Month
# vnstat -m
  • Show Statistics for a Hour
# vnstat -h
  • Show Statistics in Real Time
# vnstat -l

Read More: Install vnStat and vnStat PHP on CentOS, RHEL Linux

#6 vmstat

vmstat command displays information about Processes, Memory, Paging, Block IO, Traps, and CPU Activity.

# vmstat 

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1392620 108972 436948    0    0    15     4   17   20  0  0 99  0  0

You can also specify to show vmstat output on regular interval. Following example will show output on each 5 seconds.

# vmstat 1

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0 1392612 108980 436948    0    0    15     4   17   20  0  0 99  0  0
 0  0      0 1392604 108988 436944    0    0     0    12   22   24  0  0 100  0  0
 0  0      0 1392604 108988 436948    0    0     0     0   12   15  0  0 100  0  0
 0  0      0 1392604 108988 436948    0    0     0     0   18   24  0  0 100  0  0

<

h4 class=”heading1″>#7 Munin

<

h4>

Munin is a networked resource monitoring tool that can help analyze resource trends. Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface.

Monitoring Tools Munin Setup

Read More: Installing Munin Network Monitoring in CentOS RHEL and Fedora

#8. Iostat

The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates.

Check below output of simple iostat command, Its showing cpu details and attached disk statistics.

# iostat 

Linux 2.6.32-220.el6.i686 (tecadmin.net)        10/07/2013      _i686_  (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.07    0.00    0.29    0.17    0.00   99.47

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
scd0              0.00         0.01         0.00        392          0
sda               0.79        28.94         8.12    1178216     330444
dm-0              1.97        28.71         8.12    1168554     330376
dm-1              0.01         0.06         0.00       2576          0

Check statics of specific disk in system.

# iostat -d /dev/sda -m 
Linux 2.6.32-220.el6.i686 (tecadmin.net)        10/07/2013      _i686_  (1 CPU)

Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
sda               0.78         0.01         0.00        575        161

-m : is used for show results in megabytes per second.

#9. Cacti

Cacti is an open-source, web-based network monitoring and graphing tool designed to harness the power of RRDTool’s data storage and graphing functionality.

Cacti also provides a “data input” mechanism which allows users to define custom scripts that can be used to gather data.

Read More: Install Cacti ( Network Graphing Tool ) on CentOS and RHEL System

#10. Htop

Htop is an alternative of top command but it provides interactive system-monitor process-viewer and more user friendly output than top.

htop also provides a better way to navigate to any process using keyboard Up/Down keys as well as we can also operate it using mouse. To use simply type htop command on terminal

 # htop

Monitoring Tools - Htop

#11. iotop

iotop is useful command to find out which processes are increasing load on hard disks. iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python ≥ 2.7 and a Linux kernel ≥ 2.6.20.

  # iotop

Monitoring Tools - iotop

<

h4 class=”heading1″>#12. uptime

uptime command tells how long the system has been running along with some additional information

# uptime 

21:15:44 up 1 day,  6:56,  4 users,  load average: 0.17, 0.43, 0.48

Additionally it shows how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

#13. Strace

strace is an useful command for system administrators for solving problems with programs mainly with binary files ( for which the source is not available ).

For example we use ‘ls’ command to list files and directories but we can not edit source code of this command. In case this command not worked properly we have no option to modify its code but we can trace the but we can system calls and signals generated by this command.

# strace ls 
execve("/bin/ls", ["ls"], [/* 26 vars */]) = 0
brk(0)                                  = 0x9558000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7871000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=57422, ...}) = 0
mmap2(NULL, 57422, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7862000
close(3)                                = 0
...
...

To view only read system calls use -e option

# strace -e read ls 
read(3, "177ELF111331220303A004"..., 512) = 512
read(3, "177ELF1113312003300004"..., 512) = 512
read(3, "177ELF111331340lp004"..., 512) = 512
read(3, "177ELF111331p366320064"..., 512) = 512
read(3, "177ELF1113331@23623004"..., 512) = 512
read(3, "177ELF111331`312+004"..., 512) = 512
read(3, "177ELF111331260|,004"..., 512) = 512
read(3, "177ELF111331Pn337004"..., 512) = 512
read(3, "nodevtsysfsnnodevtrootfsnnodevtb"..., 1024) = 368
read(3, "", 1024)

<

h4 class=”heading1″>#14. sar

sar command is useful for collect, report, or save system activity information.

Default sar command shows activity of CPU like below.

# sar 

Linux 2.6.32-220.el6.i686 (tecadmin.net)        10/08/2013      _i686_  (1 CPU)

12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all      0.01      0.00      0.09      0.01      0.00     99.89
12:20:01 AM     all      0.02      0.00      0.08      0.02      0.00     99.88
Average:        all      0.01      0.00      0.09      0.01      0.00     99.89

To view activity of Ethernet cards use following command.

# sar -n DEV 

Linux 2.6.32-220.el6.i686 (tecadmin.net)        10/08/2013      _i686_  (1 CPU)

12:00:01 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
12:10:01 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:10:01 AM      eth0      1.76      0.00      0.18      0.00      0.00      0.00      0.00
12:20:01 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
12:20:01 AM      eth0      1.83      0.02      0.19      0.00      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         eth0      1.79      0.01      0.19      0.00      0.00      0.00      0.00

#15. zabbix

Zabbix is an Open Source software for Performance monitoring for your network. It provides agents for all platforms. Zabbix has great capability of collection of data, creating graphs and network maps.

zabbix-network-graph

Zabbix provides many other important features useful for monitoring. Read more about zabbix feature.

Read More Install Zabbix Network Monitoring on CentOS/RHEL and Fedora

The post Top 15 System and Performance Monitoring Tools for Linux appeared first on TecAdmin.

]]>
https://tecadmin.net/linux-system-and-performance-monitoring-tools/feed/ 2
Install Cacti ( Network Graphing Tool ) on CentOS and RHEL System https://tecadmin.net/install-cacti-on-centos-rhel-systems/ https://tecadmin.net/install-cacti-on-centos-rhel-systems/#respond Sat, 18 May 2013 10:11:02 +0000 https://tecadmin.net/?p=1391 Definition from Cacti official site: Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles [...]

The post Install Cacti ( Network Graphing Tool ) on CentOS and RHEL System appeared first on TecAdmin.

]]>
Definition from Cacti official site:

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

Step 1: Set Up Apache, MySQL and PHP

In order to install cacti you required a webserver, database and PHP to work. If you have already installed it skip this step else follow below commands.

# yum install httpd httpd-devel
# yum install mysql mysql-server
# yum install php php-pear php-common php-gd php-devel php-mbstring php-cli php-mysql
Step 2: Install other Required Packages

Cacti required RRDTool to retrieve manage data ,PHP SNMP module to access data and net-snmp. Use following commands to install it.

# yum install rrdtool php-snmp net-snmp-utils p net-snmp-libs php-pear-Net-SMTP
Step 3: Start Services

Start all the required services to work with them using following commands.

# service httpd start
# service mysqld start
# service snmpd start

Configure all services to auto start on system boot.

# chkconfig --levels 345 httpd on
# chkconfig --levels 345 mysqld on
# chkconfig --levels 345 snmpd on
Step 4: Install Cacti on RHEL/CentOS Systems

Install cacti on your system using yum package manager.

# yum install cacti
Step 5: Setup MySQL database and User Accounts

Setup MySQL database and user account for cacti installation and assign priviledges to user on database.

# mysql -u root -p
mysql> create database cacti;
mysql> GRANT ALL on cacti.* to cactiusr@'localhost' IDENTIFIED BY 'SecretPassword';
mysql> FLUSH PRIVILEGES;
mysql> quit;
Step 6: Restore Cacti Database

Use below command to restore default cacti database

# mysql -u cactiusr -p cacti < /usr/share/doc/cacti-0.8.8a/cacti.sql

It may change location of cacti.sql file as per version installed of cacti. Use below command to locate file.

# rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-0.8.8a/cacti.sql
Step 7: Edit Database Configuration File

Make below changes in cacti database configuration file to connect application with database.

# vi /etc/cacti/db.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiusr";
$database_password = "SecretPassword";
$database_port = "3306";
$database_ssl = false;
Step 8: Configure Aapche to Network Accessible

Edit cacti apache configuration file to make is accessible over network.

# vim /etc/httpd/conf.d/cacti.conf
Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
       <IfModule mod_authz_core.c>
                # httpd 2.4
               Require host 192.168.1.0/32
       </IfModule>
       <IfModule !mod_authz_core.c>
                # httpd 2.2
               Order deny,allow
               Deny from all
               Allow from 192.168.1.0/32
       </IfModule>
</Directory>
Step 9: Enable Cacti Cron

Edit /etc/cron.d/cacti in editor and un comment following line.

# vi /etc/cron.d/cacti

*/5 * * * *     cacti   /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Step 10: Start Cacti Web Installer.

Access Cacti url in your brower, First time it will redirect to web installer. Follow the steps as per below screenshots.

URL: http://192.168.1.190/cacti/

cacti-install-step-1

cacti-install-step-2

cacti-install-step-3

After Finish the setup, it will redirect to loign scren, use below given username and password to login. At first login it will force to change password.

Username: admin
Password: admin

Thanks for reading this article. If you get this article helpful, please don't forgot to share it.

The post Install Cacti ( Network Graphing Tool ) on CentOS and RHEL System appeared first on TecAdmin.

]]>
https://tecadmin.net/install-cacti-on-centos-rhel-systems/feed/ 0