liuxiaoyun111 发表于 2018-8-26 11:56:55

shell监控web服务的多种方案

# lsof -i :80|wc -l    #本地端口  
2
  
# nmap 127.0.0.1 -p 80    #远程端口
  

  
Starting Nmap 5.51 ( http://nmap.org ) at 2017-06-28 14:13 CST
  
Nmap scan report for localhost (127.0.0.1)
  
Host is up (0.000080s latency).
  
PORT   STATE SERVICE
  
80/tcp openhttp
  

  
Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
  
# nmap 127.0.0.1 -p 80|wc -l
  
8
  
# nmap 127.0.0.1 -p 80|grep open|wc -l
  
1
  
# ps -ef|grep nginx |wc -l    #进程
  
12
  
# culr -I -s -w "%{http_code}" -o /dev/null 127.0.0.1
  
200      #curl
  
# wget --spider --timeout=10 --tries=2 127.0.0.1 &>/dev/null
  
# echo $?   #wget看返回值
  
0


页: [1]
查看完整版本: shell监控web服务的多种方案