Nagios detects HTTP and HTTPS plug-ins, Python detects http and HTTPS plugins

Source: Internet
Author: User

A program that detects HTTP and HTTPS states and returns time, and the plugins that Nagios can use

The code is full of comments, and if it is unclear and where there is a mistake, please point out

#!/bin/env python#coding:utf8########################################################################### file name: check_http_status.py#description:  uses Python's Pycurl module to get the return status and return time of the URL #author:pangli# mail:[email protected]######################################################################### #import  pycurlimport fcntlimport sysimport osimport StringIOimport timefrom  Optparse  import optionparsertime = int (Time.time ()) data_path =  Os.path.split (Os.path.realpath (__file__)) [0] +  "/http_data/" #判断数据文件夹是否存在if  not  Os.path.isdir (Data_path):     os.makedirs (Data_path) #返回代码: 200-207 success Status, 300-307 redirect status, Here also divided into the success of the code_rule = [200, 201, 202, 203, 204, 205, 206, 207,  300, 301, 302, 303, 304, 305, 306, 307]usage =  "python  % (Script_name) s -u <url|ipaddress> -w <connecttime,totaltime> -c <connecttime,totaltime> -t  

Execution results show

Nagios detects HTTP and HTTPS plug-ins, Python detects http and HTTPS plugins

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.