Linux operation and maintenance of the necessary utility models 13, got it ~

This article describes several Linux operation and maintenance of the more practical tools, I hope to help Linux operation and maintenance personnel.

  1. View process consumes bandwidth - Nethogs

Nethogs is a network traffic monitoring tool at a terminal can visually display the bandwidth occupied by each process.
Download: http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/download

[
root@localhost
~]#
yum

y install libpcap

devel ncurses

devel

[
root@localhost
~]#
tar zxvf nethogs

0.8
.
0tar
.
gz

[
root@localhost
~]#
cd nethogs

[
root@localhost nethogs
]#
make
&&
make install

[
root@localhost nethogs
]#
nethogs eth0

  1. Hard disk read performance test - IOZone

IOZone is a Linux file can read and write performance test tools to test different operating system, file system performance.
Download: http://www.iozone.org/src/current/

[
root@localhost current
]#
tar xvf iozone3_420
.
tar

[
root@localhost
~]#
cd iozone3_420
/
src
/
current
/

[
root@localhost current
]#
make linux

[
root@localhost current
]#

./
iozone

a

n
512m

-
g
16g

-
i
0

-
i
1

-
i
5

-
f
/
mnt
/
iozone

Rb

./
iozone
.
xls

-a fully automatic mode
-n set minimum file size (Kbytes) of the automatic mode.
-g automatic mode is set using the maximum file size Kbytes.
-i to specify which tests to run.
-f specify the name of the file is automatically deleted after the test is completed
-R generate Excel to standard output
-b Specify the output to the specified file

3. Real-time monitoring of disk IO-IOTop

IOTop command is designed to display the hard disk IO command interface style similar to the top command.

[
root@localhost
~]#
yum

y install iotop

  1. Network traffic monitoring - IPtraf

IPtraf analysis is run on a simple network status under Linux tools.

[
root@localhost
~]#
yum

y install iptraf

5. Network traffic monitoring - IFTop

iftop real-time traffic monitoring tool is similar to the following top of linux. More intuitive than iptraf.
Download: http://www.ex-parrot.com/~pdw/iftop/

[
root@localhost
~]#
tar zxvf iftop

0.17
.
tar
.
gz

[
root@localhost
~]#
cd iftop

0.17

[
root@localhost iftop

0.17
]#

./
configure

[
root@localhost iftop

0.17
]#
make
&&
make install

[
root@localhost iftop

0.17
]#
iftop

[
root@localhost iftop

0.17
]#
iftop

i eth0

Specifies the network interface monitoring

TX: sending traffic
RX: receiving traffic
TOTAL: Total flow
Cumm: iftop to the current running time total flow
peak: peak flow
rates: represent the past average flow rate of 2s 10s 40s

  1. Real-time process monitoring - HTop

HTop is an interactive process under Linux browser can be used to replace the top command of Linux.
-ivh RPM http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm (install third-party YUM source)

[
root@localhost
~]#
yum

y install htop

7, system resource monitoring - NMON

NMON is a widely used in a variety of AIX and Linux operating system monitoring and analysis tools
Download: http://sourceforge.jp/projects/sfnet_nmon/releases/

[
root@localhost
~]#
chmod
+
x nmon_x86_64_rhel6

[
root@localhost
~]#
mv nmon_x86_64_rhel6
/
usr
/
sbin
/
nmon

[
root@localhost
~]#
nmon

  1. Monitor multiple log - MultiTail

MultiTail is to open multiple windows simultaneously monitor multiple software used to implement the log file, the tail command similar functionality in the console.
-ivh RPM http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm (YUM install third-party source)

[
root@localhost
~]#
yum

y install multitail

[
root@localhost
~]#
multitail

e
"fail"

/
Var
/
log
/
Secure
# Filter keywords monitor

[
root@localhost
~]#
multitail

l
"ping baidu.com"

# Command behind the monitor - l command to be executed

[
root@localhost
~]#
multitail

in
/
was
/
log
/
messages

i
/
var
/
log
/
Secure
# -i to specify a file name

  1. SSH brute force protection - Fail2ban

Fail2ban can monitor your system logs and error logs information matches the regular expression matching of the corresponding mask action under normal circumstances is to call the firewall shield
download: http://www.fail2ban.org/wiki/index.php/Downloads

[
root@localhost
~]#
cd fail2ban

0.8
.
11

[
root@localhost fail2ban

0.8
.
11
]#
python setup
.
py install

[
root@localhost fail2ban

0.8
.
11
]#
cd files
/

[
root@localhost files
]#
cp
./
redhat

initd
/
etc
/
init
.
d
/
fail2ban

[
root@localhost files
]#
service fail2ban start

[
root@localhost files
]#
chkconfig

add fail2ban

[
root@localhost files
]#
chkconfig fail2ban on

Note: You need to configure iptables utility, if the restart iptables have to restart fail2ban, because the principle is to call fail2ban iptables real-time blocking the outside world ***.

[
root@localhost
~]#
grep

v
"^#"

/
etc
/
fail2ban
/
jail
.
conf
|
grep

v
"^$"

[
DEFAULT
]

ignoreip

127.0
.
0.1
/
8

Ignore the local IP

bantime

600

# Conform to the rules after blocking time

find time

600

How long to perform in line with the rules of the blockade as 600 seconds is performed up to 3 times

maxretry

3

The maximum number of attempts

backend

auto

# Log modification detection logs gamin, polling and auto three

usedns

warn

[
ssh

iptables
]

enabled

true

It is disabled by default false

filter

sshd

action

iptables
[
name

SSH
,
port

ssh
,
protocol

tcp
]

sendmail-whois [name = SSH, dest = recipient mailbox, sender = sender's mailbox, sendername = "Fail2Ban"]

logpath

/var/
log
/
sshd
.
log

In response to the error log general / var / log / secure

maxretry

5

Try to override the global number of errors in maxretry

Note: By default, all applications are closed protection, we need to manually open. fail2ban.conf is a log file information, jail.conf file is protected by concrete action and service configuration information.

[
root@localhost
~]#
touch
/
var
/
log
/
sshd
.
log

[
root@localhost
~]#
service fail2ban restart

[
root@localhost
~]#
fail2ban

client status

View monitor is turned on

Status

|-

Number
of jail
:

1

`- Jail list: ssh-iptables

[Root @ localhost ~] # iptables -L #iptables filtering rule table has fail2ban

fail2ban-SSH tcp -- anywhere anywhere tcp dpt:ssh

  1. Terminal connection session persistence - Tmux

Tmux is an excellent terminal software reuse is more similar to GNU Screen aspect ratio Screen, flexible and efficient. To ensure that does not affect the task runtime dropped connection SSH.

-ivh RPM http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm (install third-party YUM source)

  1. Page display disk space usage - Agedu

Download: http://www.chiark.greenend.org.uk/~sgtatham/agedu/

[
root@localhost
~]#
tar zxvf agedu

r9723
.
tar
.
gz

[
root@localhost
~]#
cd agedu

r9723

[
root@localhost
~]#

./
configure

[
root@localhost
~]#
make
&&
make install

[
root@localhost
~]#
agedu

s
/

# -S Scan

[
root@localhost
~]#
agedu

w

address
192.168
.
0.10
:
80

# -W enter a link to this page

[
root@localhost
~]#
agedu

w

address
192.168
.
0.108080

-
auth none
# - auth closed without certification if the port number will generate a random access browser

  1. Security scanning tools - NMap

NMap scanning and network connections under Linux packet sniffer is used to scan the Internet computer network connection open.
Download: http://nmap.org/download.html

[
root@localhost
~]#
tar jxvf nmap

6.40
.
taking
.
bz2

[
root@localhost nmap

6.40
]#

./
configure

[
root@localhost nmap

6.40
]#
make
&&
make install

[
root@localhost
~]#
nmap
192.168
.
0.10

# Obtain basic information

[
root@localhost
~]#
nmap

The
192.168
.
00:10

# Get System Version Information

[
root@localhost
~]#
nmap

A
192.168
.
0.10

# Get comprehensive information system

[
root@localhost
~]#
nmap
192.168
.
0.0
/
24

Obtain basic information about the work of a network device

-sSTCP scanning
-sV version detection system

13.Web stress test - Httperf

Httperf more powerful than ab, be able to test out the maximum amount of web services and hosted service can identify potential problems; for example: memory usage, stability. The biggest advantage: You can specify the law of stress testing, a virtual reality environment.
Download: http://code.google.com/p/httperf/downloads/list

[
root@localhost
~]#
tar zxvf httperf

0.9
.
0tar
.
gz

[
root@localhost
~]#
cd httperf

0.9
.
0

[
root@localhost httperf

0.9
.
0
]#

./
configure

[
root@localhost httperf

0.9
.
0
]#
make
&&
make install

[
root@localhost
~]#
httperf

hog

server

192.168
.
0.202

--
uri
=/
index
.
html

on one

conns

10000

--
wsess

10
,
10
,
0.1

Parameter Description:
--hog: Let httperf produce multi-connection as possible, httperf based on the hardware configuration, generate regular access connection
--num-conns: number of connections, 10,000-General to initiate a request
--wsess: Numerical simulation time a user opens a Web page , 10 represents the first generation session connection 10, the second connector 10 indicates each session request is performed 10 times, 0.1 represents the interval between each session connection request / s

This article comes from "no royal road to knowledge, learning no shortcuts!" Blog

Reprinted Statement: This article reproduced from "CU technical community" search "ChinaUnix2013" to follow.
Python full-stack + + crawlers + automated data analysis block chain + AI + Go-around program June 24, 2019 is about to commence, the impact Linux 120 days of operation and maintenance 300,000 annual salary, changing the speed of about ~ ~ ~ ~

Reproduced in: https: //blog.51cto.com/10515219/2403074

Guess you like

Origin blog.csdn.net/weixin_33895695/article/details/91656175