Multiple scenarios for Shell monitoring Web services

Source: Internet
Author: User

1. Ports

Local: Ss.netstat,lsof

Remote: TELNET,NMAP.NC

2. Number of local processes

3.header (Http,curl), simulating the user's way

4.URL (Wget,curl). How to impersonate a user

5.php,java Write the monitoring program, simulate the user's way (Let development provide)



Sample Judging conditions

[[email protected] ~]# lsof -i :80|wc -l     #本地端口    2[[email protected] ~]# nmap 127.0.0.1 -p 80    # Remote Port starting nmap 5.51  ( http://nmap.org )  at 2017-06-28 14:13  cstnmap scan report for localhost  (127.0.0.1) host is up  (0.000080s  latency). port   state service80/tcp open  httpnmap done: 1 ip  address  (1 host up)  scanned in 0.05 seconds[[email protected] ~]#  nmap 127.0.0.1 -p 80|wc -l8[[email protected] ~]# nmap 127.0.0.1  -p 80|grep open|wc -l  1[[email protected] ~]# ps -ef|grep  nginx |wc -l     #进程12 [[Email protected] ~]# culr -i  -s -w  " %{http_code} " -o /dev/null 127.0.0.1200       #curl [[email  Protected] ~]# wget --spider --timeout=10 --tries=2 127.0.0.1 &>/dev /null[[email protected] ~]# echo $?      #wget看返回值0

Case Shell

#!/bin/bashhttp_code= ' Culr-i-s-w "%{http_code}"-o/dev/null 127.0.0.1 ' if [$http _code-ne]then echo ' web is Erro "Else echo" web is ok "fi

This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1942710

Multiple scenarios for Shell monitoring Web services

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.