Find a solution for obtaining the Local intranet IP address (not the visitor IP address)

Source: Internet
Author: User
Scenario: a total of 10 web servers are provided by one F5. Each server is LNMP. When an exception is thrown for a function, an alert message is sent to several owners. Requirement Description: we want to add the IP address of the machine for which the request is processed in the alarm text message. But the problem... Scenario Description:
A total of 10 web servers are provided by one F5. Each server is LNMP. When an exception is thrown for a function, an alert message is sent to several owners.

Requirement Description:
We want to add the IP address of the machine before the request is processed in the alarm text message.
But the problem is to use exec/passthru. The command line is fine. When an http request is sent, the returned value is null, and the error code ID is 127. Colleagues, we also want to use the configuration file to express the local IP address, but this will cause unnecessary trouble to switch the data center and server in the future.

Please give us a solution.

Reply content:

Scenario Description:
A total of 10 web servers are provided by one F5. Each server is LNMP. When an exception is thrown for a function, an alert message is sent to several owners.

Requirement Description:
We want to add the IP address of the machine before the request is processed in the alarm text message.
But the problem is to use exec/passthru. The command line is fine. When an http request is sent, the returned value is null, and the error code ID is 127. Colleagues, we also want to use the configuration file to express the local IP address, but this will cause unnecessary trouble to switch the data center and server in the future.

Please give us a solution.

Isn't it a good idea to use a configuration file to record local IP addresses? Add a scheduled script or startup task to each server to regularly write the local IP address to the configuration file. Retrieving text messages from the configuration file will not have much impact on changing servers in the data center in the future.

$ _ SERVER ['server _ ADDR '] cannot meet your requirements?

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.