Monitor the running state of a cloud service

Source: Internet
Author: User

If you deploy a cloud service program and use PAAs services (such as service bus or SQL Server, etc.), occasionally we will find an error message in the log that cannot resolve the hostname, basically because of the network flash, we need to add retry logic in the code, detailed description , please refer to:

The Transient Fault handling application Block

Service Bus Retry Guidelines

About the site, we need to crawl the problem when the network packet to troubleshoot, if you miss the time of the problem, then the network problem is difficult to troubleshoot. Based on this background, there is a developed gadget that everyone can use, the specific functions are as follows:

    1. Copy the program to an instance of the cloud service to run
    2. When the program runs, it detects if the network Monitor Tool is installed in the specified location, and if no installation is found, the program automatically downloads and starts the installation program.
    3. The program starts after a few seconds to send a GET request to the service bus, if the call has an exception will try a few more times, if the configured number of retry, the system will call the Network Monitor tool to crawl 90 second packet, When the packet is completed, the packet is uploaded to the configured storage account. The message is then sent to the specified mailbox, which contains the download link for the Network Pack log (if the call takes longer than the configured time or the return value is not 200, the corresponding action is taken)
    4. The specific parameters are described as follows:

<add key= "Netmoninstalldir" value= "d:\Program Files\Microsoft Network Monitor 3"/> The installation path of the Network Monitor tool, The cloud service instance is currently configured at the current location by default

<add key= "LogPath" value= "D:\Monitor"/> <!--It is the folder path for the auto-run--> program log

<add key= "Tracetimes" value= "2"/><!--trace times, define how many times would it capture network trace--> if net After the work monitor too has captured 2 log files and sent them, the monitor exits.

<add key= "Rertynumbertimes" value= "2"/><!--define how many times when we get error--> if an exception is found, the number of retry

<add key= "Timerseconds" value= "5"/><!--check the Network/target URL every * * * seconds--> monitoring interval

<add key= "TargetUrl" value= "https://xxxxx.servicebus.chinacloudapi.cn"/> Monitored URLs

<add key= "Targethttpcode" value= "$"/><!--expected HTTP return code-->

<add key= "Limitseconds" value= "/><!--criterion time to judge if it is slow performance--> if the request time is more than the set value, then Will grab the package and send an email

<add key= "Mailnotification" value= "1"/><!--0 for false, 1 for true-->

<add key= "mailrecipients" value= "[email protected]; [email protected]"/><!--use; To add more--> set the recipient of the message

<add key= "Mailhostname" value= "smtp.**.com"/> Set the host for the mailbox

<add key= "Mailport" value= "* * *"/> Set the port of the mailbox

<add key= "Mailsendername" value= "* *"/> The sender of the mailbox

<add key= "Mailsenderpassword" value= "*"/> Mailbox Sender's password

<add key= "Storageaccountname" value= "*"/><!--* for null--> storage account

<add key= "Storageaccountkey" value= "*"/><!--* for null--> storage account password

<add key= "Storagecontainername" value= "Parsedns"/> The container name used in the store

<add key= "DownloadURL" value= "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/> Download the address of the Network Monitor tool, it is recommended that you modify the

<add key= "FirstRun" value= "true"/> After you first run and downloaded the Network Monitor tool installed, we recommend that you change this parameter to FALSE and rerun the monitor. This way, the monitor will start automatically when you reboot this instance.

The information that the program runs is recorded in the log, the contents are as follows: 10/9/2015 9:57:25 PM Network Check is running ... | OK | 3 | http://test11111.chinacloudsites.cn/

OK is the return result of the call, 3 indicates that the request took 3 seconds

Program Download Address: HTTP://PAN.BAIDU.COM/S/1SJQJOLF

Monitoring the health status of a cloud service

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.