Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below with reference to embodiment and attached drawing, to thisInvention is further described.
In the present invention, monitoring data is directly obtained from third party's interface by local web browser, without taking via monitoringBusiness device is obtained, and to reduce the burden of monitoring server, is avoided slow because causing to show when number of users is larger, high concurrent accessesThe problem of slow or failure.Referring to Fig. 1, the method schematic flow chart of monitoring data is shown for the present invention comprising following steps:
Step 101, batch processing script is run, the local web browser for showing monitoring data is started.
Batch processing (bat) script is run, other programs can be called.Specifically, in this step, batch processing is runScript, for starting local web browser, the web browser for realizing monitoring data displaying.The visit of the web browserAsk that address is local address, the other users in same local area network can access local web browser by the local address.
After determining the concrete function that web browser to be realized, generating and providing the web browser of the function is this fieldWhat technical staff was easily achieved, it seldom repeats here.
Step 102, the interface IP address that user inputs in the web browser is received.
In the present invention, web browser provides the input entrance of interface IP address, and user can enter rear input interface address.
Step 103, monitoring data is obtained from third party's interface according to the interface IP address of input.
The interface IP address of input directly corresponds to third party's interface, and web browser is according to interface IP address from corresponding third partyInterface obtains monitoring data.
Step 104, it arranges according to setting format to the monitoring data of acquisition.
The setting format can be the format of web browser default, and user can also as required carry out setting formatAdjustment.
Step 105, the monitoring data after arrangement is shown.
In the present invention, batch processing script is run, the local web browser for showing monitoring data is started;Receive userThe interface IP address inputted in the web browser;Monitoring data is obtained from third party's interface according to the interface IP address of input;According to settingThe formula that fixes arranges to the monitoring data of acquisition;Monitoring data after showing arrangement.Using the present invention program, by localWeb browser directly obtains monitoring data from third party's interface, without being obtained via monitoring server, reduces monitoring clothesThe burden of business device avoids because of the problem of causing to show slowly or fail when number of users is larger, high concurrent accesses, improves prisonControl the displaying efficiency of data;Also, after obtaining monitoring data, arranges, make to the monitoring data of acquisition according to setting formatExhibition method is more flexible.
The present invention program can be shown for the monitoring data of various data formats;A certain specific data can also be directed toThe monitoring data of format is shown, such as is only shown to the monitoring data of JSON data format, specifically:
In Fig. 1 process, after step 103 obtains monitoring data, this method further include: judge whether monitoring data is JSONData format, if it is, executing described the step of arranging according to setting format to the monitoring data of acquisition;Otherwise, it mentionsShow that user re-enters, returns to step 102.
JSON, that is, JavaScript object representation (JavaScript Object Notation), JSON data format isA kind of data interchange format of lightweight is easy to the parsing and generation of machine, net using the text formatting for being totally independent of languageNetwork transmission speed is fast, and more and more data-interfaces are carried out data transmission using JSON format.The prison obtained from third party's interfaceWhen control data are JSON data format, only by standard data format, wherein including the representation of key-value pair, it cannot make oneIntuitively know its data information.Therefore, for the monitoring data of JSON format, the present invention uses following implementation:
Pre-establish the mapping relations between key-value pair and ip alias;
After step 103 obtains monitoring data, this method further include: extract the key-value pair in monitoring data;It is closed according to mappingSystem determines ip alias corresponding with key-value pair;
Described to show that the monitoring data after arrangement includes: corresponding each ip alias shows the monitoring data after arrangement.
Further, the present invention can also preset the corresponding parameter threshold of parameters, and parameter threshold write-in is matchedSet file;After step 103 obtains monitoring data, this method further include:
Judge whether the parameters data in monitoring data are greater than corresponding parameter threshold, if it is, generating alarmInformation shows warning message.
Further, the present invention can also preset the periodic refreshing time, and configuration file is written in the periodic refreshing time;After the monitoring data shown after arranging, this method further include:
Start the timer about the periodic refreshing time, judge whether the periodic refreshing time reaches, is held if it is, returningThe step of row interface IP address according to input obtains monitoring data from third party's interface.
The present invention can also be added interface IP address, to show the monitoring data of more interface elements, specifically:
Trap address addition request;
The address element that user inputs in local web browser is received, the address element includes that need to add at leastOne interface IP address;
Step 103-105 can be then executed, to show the monitoring data obtained from the interface element of addition.
The monitoring data of displaying is varied, can obtain as needed, for example, performance data of server, commodity parameter numberAccording to or weather temperature supplemental characteristic.
The content of parameter that the performance data of server includes is, for example, CPU usage, memory usage, disk occupancyWith at least one in network inputs output information.
In Fig. 1 process step 104, the rule that can be defaulted according to web browser arranges to monitoring data, it is also possible thatThe monitoring data of acquisition is arranged using hypertext markup language (HTML, HyperText Markup Language) 5 standardsCloth.
HTML 5 has canvas element drag function, can be using one section of HTML code as a unity element, in painting canvasUpper any dragging, addition and duplication, realize diversified displaying, and can realize the topology diagram between element.
Below by the process of Fig. 2, the method for showing monitoring data to the present invention is illustrated comprising following stepIt is rapid:
Step 201, batch processing script is run.
In this example, batch processing script is run, for starting local web browser.Start web browser need it is some itPreceding additional step, comprising: after operation bat script, call main method, calculate port occupancy situation of current computer etc.;It opensDynamic web browser, and the configuration data defaulted in loading configuration file, are stored in memory as global variable.
Step 202, start the local web browser for showing monitoring data.
In this example, preset periodic refreshing time and the corresponding parameter threshold of parameters, by parameter threshold andConfiguration file is written in the periodic refreshing time;It is written the global variable in update memory about web browser after configuration file, usesThreshold decision is carried out in subsequent step.This example also pre-establishes the mapping relations between key-value pair and ip alias, such as wrapsInclude: key-value pair { ip: " 172.17.24.205 " corresponding alias is " shop ", key-value pair { ip: " 172.17.34.79 " correspondingAlias be " special topic ", key-value pair { ip: " 172.17.26.67 " corresponding alias is " backstage ", key-value pair { ip: "172.22.205.74 " corresponding alias is " front end processor ".
Step 203, the interface IP address that inputs in the web browser of user is received, according to the interface IP address of input from thirdSquare interface obtains monitoring data.
The monitoring data of this case-based system is that JSON format correspondingly in this step, inputs http agreement to be treatedJSON data format interface URL.
Step 204, judge whether monitoring data is JSON data format, if so, thening follow the steps 205;Otherwise, it promptsUser re-enters, and returns to step 203.
Step 205, the key-value pair in monitoring data is extracted, determines that ip corresponding with key-value pair is other according to mapping relationsName.
Step 206, trap address addition request receives the address element that user inputs in local web browser, describedAddress element includes at least one interface IP address that need to be added.
Element is the address of the objects such as server, some commodity, the city of required monitoring.
After receiving address element, it can be executed according to step 203-205, to obtain monitoring data and determine ip alias.
Step 207, it arranges according to setting format to the monitoring data of acquisition.
If obtaining the monitoring data of multiple interface IP addresses, it is directed to each interface IP address, is extracted from monitoring dataParameters data arrange to parameters data according to setting format.
The setting format can be the format of web browser default, and user can also as required carry out setting formatAdjustment.For example, for the case where monitoring data is performance data of server comprising CPU usage, memory usage, diskThe multiple parameters such as occupancy and network inputs output information, the sequencing of the settable parameter arrangement of user.
Step 208, the monitoring data after arrangement is shown.
In this example, the data topology figure of monitoring data is generated using 5 standard of HTML, shows the data topology figure of generation.As shown in figure 3, monitoring data is performance data of server for the monitoring data example shown.The interface Fig. 3 current presentation is prisonData are controlled, user can also click " threshold value setting ", " refreshing setting " on interface as needed, to carry out parameter threshold and timingThe setting of refresh time.
Step 209, judge whether the parameters data in monitoring data are greater than corresponding parameter threshold, if it is,Warning message is generated, shows warning message.
Parameter values within a certain range when just it is paid close attention to, corresponding threshold value has been arranged in advance.Such as monitoring cpuUtilization rate, parameter threshold 80%;If it exceeds 80%, then alarm is shown on displayed page.
Step 210, timer of the starting about the periodic refreshing time, judges whether the periodic refreshing time reaches, if so,Then feedback step 203;Otherwise it continues waiting for.
The periodic refreshing time is the time interval that monitoring data refreshes, and what is refreshed is obtained from third party's interfaceJson data.
The object of monitoring may include:
1. server performance monitor
According to different server ip address is inputted, added for information such as the CPU of server, memory, disk, network I/OsThreshold values is monitored, can intuitively check the current behaviour in service of each server.
2. Article Surveillance
According to different SKU (SPU) IP address is inputted, monitoring valve is added for information such as promotion price, the market prices of commodityValue, can intuitively check the current information of commodity.Wherein, SKU, that is, commodity stocks unit is Stock Keeping UnitAbbreviation, SPU, that is, standardized product unit is the abbreviation of Standard Product Unit.
3. weather temperature monitors
According to IP address of the input about different cities, obtain to the Weather information under Yingcheng City, for temperature, humidity,The threshold values (just needing to pay close attention to when to some range or critical point) of the information such as wind speed addition monitoring, can intuitively check each cityThe weather integral status in city.
In this example, http protocol is accessed by Http client, interface data can be obtained in batches, and parse JSON dataFormat;Compatible all JSON formatted data interfaces, lightweight green application, decompression.By reading local profile, thanCompared with the state of the corresponding interface data and threshold values, and realize the periodic refreshing function of the topological diagram on painting canvas or table.Also, it realizesLocalization client carries out the starting of weblication, realizes that the change of configuration comes into force without restarting.
Referring to fig. 4, the terminal structure schematic diagram of monitoring data is shown for the present invention, which includes starting trigger unitAnd web browser;
The starting trigger unit;Batch processing script is run, the web browser for showing monitoring data is started;
The web browser after starting, receives the interface IP address that user inputs in the web browser;According to connecing for inputPort address obtains monitoring data from third party's interface;It arranges according to setting format to the monitoring data of acquisition;Show arrangementMonitoring data afterwards.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the inventionWithin mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.