ps命令是Process Status的缩写,用于查看当前系统的经过景况。可以搭配kill指令随即行车制动器踏板、杀死不供给的程序

 

#!/bin/bash

1、用法

上篇说了主DNS正向拆解解析

#Date 2017/11/11

ps
[选项]

高中档是有个小标题标,什么难点啊?

#mail caoyf1992@163.com

2、常用命令选项

请问当大家输入wwww或ww或更加多w的时候它还能够深入分析出来呢?

[ $(id -u) != “0” ] && echo “Error: You must be root to run this
script” && exit 1

a      展现现行反革命终端机下的具有程序,包罗其余客商的前后相继
-A    展现全数进度
c      列出程序时,突显每一个程序真的的下令名称,而不分包路线,参数或常驻服务的标示
e      列出程序时,展现各种程序所利用的环境变量
-f      显示UID,PPIP,C与STIME栏位
-H    展现树状结构,表示程序间的相互关系
-N    展现全部的主次,除了举行ps指令终端机下的先后之外
u      以客户为主的格式来展现程序情状
x      显示全体程序,不以终端机来区分

抑或不输入w的时候仍然为能够剖判吗?

export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

3、实例

上篇未有概念是解析不了的,怎么定义呢?相当粗略,插足图中命令就可

sed -i “s/SELINUX=enforcing/SELINUX=disabled/”  /etc/selinux/config

1卡塔尔国查看当前终端的进度

图片 1

setenforce 0

[root@mini ~]# ps
   PID TTY          TIME CMD
  1271 pts/0    00:00:00 bash
  1669 pts/0    00:00:00 ps

小技巧

which  ntpdate

2卡塔尔国查看所经过  (上面只列出部分卡塔尔国

图片 2

if [ $? -eq 0 ];then

[root@mini ~]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.8 127968  6480 ?        Ss   14:27   0:01 /usr/lib/systemd/systemd --switched-root --system --d
root          2  0.0  0.0      0     0 ?        S    14:27   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    14:27   0:00 [ksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S<   14:27   0:00 [kworker/0:0H]
root          7  0.0  0.0      0     0 ?        S    14:27   0:00 [migration/0]
root          8  0.0  0.0      0     0 ?        S    14:27   0:00 [rcu_bh]

 

    /usr/sbin/ntpdate time1.aliyun.com

4、head说明

上面包车型大巴话反向深入解析

    echo “*/5 * * * * /usr/sbin/ntpdate -s
time1.aliyun.com”>>/var/spool/cron/root 

user      用户名
uid        用户号
pid        进程号
ppid      父进度号
size      内部存款和储蓄器大小,Kbytes字节.
vsize      
总设想内存大小,bytes字节(包蕴code+data+stack)
share         总分享页数
nice      进度优先级(缺省为0,最大为-20)
priority(pri)   内核调解优先级
pmem     进度共享的大意内部存款和储蓄器数的比重
trs       
 程序实施代码驻留大小
rss          
进度使用的总物理内存数,Kbytes字节
time      进度实践起到今天总的CPU暂用时间
stat       进度情状
command        推行命令的简短格式

反向拆解解析正是IP →
名称

else

stat表明:D:不可中断,奇骏:运转,S:中断,T:停止,Z:僵死,W:无驻留页,
<:高优先级进程, N:低优先级进程, L:内部存款和储蓄器锁页

环境

最少两台主机叁个DNS服务器,一个客商机,近似43.7当服务器,43.6当客商机

设置开启服务就背着了

    yum install ntpdate -y

 

校订区域的配备文件

vim /etc/named.rfc1912.zones
#
#

图片 3

始建图上反向深入深入分析文件

vim 192.168.43.zone
#

图片 4

重读配置文件

rndc reload
#
#

看下文件的权位

图片 5

发掘权限不对

更正区域文件权限

chown  :named 192.168.43.zone
#把这个文件加入到named组

图片 6

重启服务

systemctl restart named
#

测试

图片 7

备考:照常理来讲,测验的时候
应该反着写地址 7.168.192.in-…那样

dig
–x 是特意测量检验反向深入分析的,就可如图中写法

 

    /usr/sbin/ntpdate time1.aliyun.com

    echo “*/5 * * * * /usr/sbin/ntpdate -s
time1.aliyun.com”>>/var/spool/cron/root 

fi

clear

echo
“##########################################”

echo “Auto Install smokeping-2.6.11          ##”

echo “Press Ctrl + C to cancel                ##”

echo “Any key to continue                    ##”

echo
“##########################################”

read -n 1

/etc/init.d/iptables status >/dev/null 2>&1

if [ $? -eq 0 ]

then

iptables -I INPUT -p tcp –dport 80 -j ACCEPT &&

iptables-save >/dev/null 2>&1

else

    echo -e “\033[32m iptables is stopd\033[0m”

fi

IP=`/sbin/ifconfig|sed -n ‘/inet
addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/1p’|sed -n ‘1p’`

sed -i “s/SELINUX=enforcing/SELINUX=disabled/”  /etc/selinux/config

setenforce 0

rpm -Uvh

1>/dev/null

yum -y install perl perl-Net-Telnet perl-Net-DNS perl-LDAP
perl-libwww-perl perl-RadiusPerl perl-IO-Socket-SSL perl-Socket6
perl-CGI-SpeedyCGI perl-FCGI perl-CGI-SpeedCGI perl-Time-HiRes
perl-ExtUtils-MakeMaker perl-RRD-Simple rrdtool rrdtool-perl curl fping
echoping  httpd httpd-devel gcc make  wget libxml2-devel libpng-devel
glib pango pango-devel freetype freetype-devel fontconfig cairo
cairo-devel libart_lgpl gcc libart_lgpl-devel mod_fastcgi wget wqy-*

if [ -d /opt ];then

    cd /opt

else

    mkdir -p /opt && cd /opt

fi

wget -c

tar -xvf smokeping-2.6.11.tar.gz 1>/dev/null

cd /opt/smokeping-2.6.11

./setup/build-perl-modules.sh /usr/local/smokeping/thirdparty

./configure -prefix=/usr/local/smokeping

/usr/bin/gmake install  1>/dev/null

cd /usr/local/smokeping

mkdir cache data var 1>/dev/null

touch /var/log/smokeping.log

chown -R apache:apache cache data var

chown -R apache:apache /var/log/smokeping.log

mv /usr/local/smokeping/htdocs/smokeping.fcgi.dist 
/usr/local/smokeping/htdocs/smokeping.fcgi

mv /usr/local/smokeping/etc/config.dist  /usr/local/smokeping/etc/config

cp -f /usr/local/smokeping/etc/config
/usr/local/smokeping/etc/config.back

sed -i “s/some.url/IP/g” /usr/local/smokeping/etc/config

chmod 600 /usr/local/smokeping/etc/smokeping_secrets.dist

 

if [ -d /opt ];then

    cd /opt

else

    mkdir -p /opt && cd /opt

fi

wget -c -O /opt/fping-4.0.tar.gz

tar zxvf fping-4.0.tar.gz

cd fping-4.0

./configure –prefix=/usr/local/fping

make && make install

sed -i “s#`grep fping /usr/local/smokeping/etc/config`#binary =
/usr/local/fping/sbin/fping#g” /usr/local/smokeping/etc/config

sed -i “148i’–font TITLE:20:”WenQuanYi\ Zen\ Hei\ Mono”‘\,”
/usr/local/smokeping/lib/Smokeping/Graphs.pm

cp -rf /etc/httpd/conf/httpd.conf  /etc/httpd/conf/httpd.conf.back

cat >> /etc/httpd/conf/httpd.conf <<‘EOF’

Alias /cache “/usr/local/smokeping/cache/”

Alias /cropper “/usr/local/smokeping/htdocs/cropper/”

Alias /smokeping “/usr/local/smokeping/htdocs/smokeping.fcgi”

<Directory “/usr/local/smokeping”>

AllowOverride None

Options All

AddHandler cgi-script .fcgi .cgi

Order allow,deny

Allow from all

DirectoryIndex smokeping.fcgi

</Directory>

EOF

 

if [ -f /etc/init.d/smokeping ];then

    echo “/etc/init.d/smokeping is exist”

else

    touch /etc/init.d/smokeping

    cat > /etc/init.d/smokeping <<‘EOF’

    #!/bin/bash

    #chkconfig: 2345 80 05

    # Description: Smokeping init.d script

    # Create by : Mox

    # Get function from functions library

    . /etc/init.d/functions

    # Start the service Smokeping

    smokeping=/usr/local/smokeping/bin/smokeping

    prog=smokeping

    pidfile=${PIDFILE-/usr/local/smokeping/var/smokeping.pid}

    lockfile=${LOCKFILE-/var/lock/subsys/smokeping}

    RETVAL=0

    STOP_TIMEOUT=${STOP_TIMEOUT-10}

    LOG=/var/log/smokeping.log

 

    start() {

        echo -n $”Starting $prog: “

        LANG=$HTTPD_LANG daemon –pidfile=${pidfile} $smokeping
$OPTIONS

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && touch ${lockfile}

        return $RETVAL

    }

 

 

    # Restart the service Smokeping

    stop() {

        echo -n $”Stopping $prog: “

        killproc -p ${pidfile} -d ${STOP_TIMEOUT} $smokeping

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

    }

 

    STOP_TIMEOUT=${STOP_TIMEOUT-10}

    LOG=/var/log/smokeping.log

 

    start() {

        echo -n $”Starting $prog: “

        LANG=$HTTPD_LANG daemon –pidfile=${pidfile} $smokeping
$OPTIONS

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && touch ${lockfile}

        return $RETVAL

    }

 

 

    # Restart the service Smokeping

    stop() {

        echo -n $”Stopping $prog: “

        killproc -p ${pidfile} -d ${STOP_TIMEOUT} $smokeping

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

    }

 

    case “$1” in

    start)

        start

    ;;

    stop)

        stop

    ;;

    status)

        status -p ${pidfile} $httpd

        RETVAL=$?

    ;;

    restart)

        stop

        start

        ;;

    *)

        echo $”Usage: $prog {start|stop|restart|status}”

        RETVAL=2

 

    esac

 

EOF

fi

 

cat > /usr/local/smokeping/etc/config <<‘EOF’

*** General ***

 

owner    = caoyf

contact  = caoyf1992@163.com

#mailhost = smtp.163.com:25

#mailusr  = xuel@linuxidc

#mailpwd  = anchnet@123.com

#sendmail = /usr/sbin/sendmail

# NOTE: do not put the Image Cache below cgi-bin

# since all files under cgi-bin will be executed … this is not

# good for images.

imgcache = /usr/local/smokeping/cache

imgurl  = cache

datadir  = /usr/local/smokeping/data

piddir  = /usr/local/smokeping/var

cgiurl  =

smokemail = /usr/local/smokeping/etc/smokemail.dist

tmail = /usr/local/smokeping/etc/tmail.dist

# specify this to get syslog logging

syslogfacility = local0

# each probe is now run in its own process

# disable this to revert to the old behaviour

# concurrentprobes = no

 

*** Alerts ***

to = 8578545954@qq.com

from = qsd@lenxxx.com.cn

 

+someloss

type = loss

# in percent

pattern = >0%,*12*,>0%,*12*,>0%

comment = loss 3 times  in a row

 

+rttdetect

type = rtt

 #in milli seconds

pattern =
<10,<10,<10,<10,<10,<100,>100,>100,>100

edgetrigger = yes

comment = routing messed up again ?

 

+lossdetect

type = loss

# in percent

pattern = ==0%,==0%,==0%,==0%,>20%,>20%,>20%

edgetrigger = yes

comment = suddenly there is packet loss

 

+miniloss

type = loss

# in percent

pattern = >0%,*12*,>0%,*12*,>0%

edgetrigger = yes

#pattern = >0%,*12*

comment = detected loss 1 times over the last two hours

 

#+rttdetect

#type = rtt

# in milliseconds

#pattern = <1,<1,<1,<1,<1,<2,>2,>2,>2

#comment = routing messed up again ?

 

+rttbad

type = rtt

# in milliseconds

edgetrigger = yes

pattern = ==S,>20

comment = route

 

+rttbadstart

type = rtt

# in milliseconds

edgetrigger = yes

pattern = ==S,==U

comment = offline at startup

*** Database ***

 

step    = 60

pings    = 20

 

# consfn mrhb steps total

 

AVERAGE  0.5  1  1008

AVERAGE  0.5  12  4320

    MIN  0.5  12  4320

    MAX  0.5  12  4320

AVERAGE  0.5 144  720

    MAX  0.5 144  720

    MIN  0.5 144  720

 

*** Presentation ***

charset = utf-8

template = /usr/local/smokeping/etc/basepage.html.dist

 

+ charts

 

menu = 排行榜

title = 排行榜

 

++ stddev

sorter = StdDev(entries=>4)

title = 综合指数排名

menu = 综合指数排名

format = 综合指数 %f

 

++ max

sorter = Max(entries=>5)

title = 最大延迟排名

menu = 最大延迟排行

format = 最大延迟时间 %f 秒

 

++ loss

sorter = Loss(entries=>5)

title = 丢包率排名

menu = 丢包率排行

format = 丢包 %f

 

++ median

sorter = Median(entries=>5)

title = 平均延迟排名

menu = 平均延迟排名

format = 平均延迟 %f 秒

发表评论

电子邮件地址不会被公开。 必填项已用*标注