CN114637557A - Script service method based on heterogeneous operating system - Google Patents

Script service method based on heterogeneous operating system Download PDF

Info

Publication number
CN114637557A
CN114637557A CN202210269201.6A CN202210269201A CN114637557A CN 114637557 A CN114637557 A CN 114637557A CN 202210269201 A CN202210269201 A CN 202210269201A CN 114637557 A CN114637557 A CN 114637557A
Authority
CN
China
Prior art keywords
agent
script
shell
command
shell process
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210269201.6A
Other languages
Chinese (zh)
Inventor
曾东若
白岳
郭家华
冯六军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING NANTIAN SOFTWARE CO LTD
Yunnan Nantian Electronics Information Corp ltd
Original Assignee
BEIJING NANTIAN SOFTWARE CO LTD
Yunnan Nantian Electronics Information Corp ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING NANTIAN SOFTWARE CO LTD, Yunnan Nantian Electronics Information Corp ltd filed Critical BEIJING NANTIAN SOFTWARE CO LTD
Priority to CN202210269201.6A priority Critical patent/CN114637557A/en
Publication of CN114637557A publication Critical patent/CN114637557A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

A script service method based on a heterogeneous operating system is characterized in that an idle shell process pool is set, a plurality of shell processes started along with the start of Agent software are taken as idle shell processes to be placed in the idle shell process pool to wait for the execution of a script command, the efficiency of executing the shell script command by the Agent in the operation and maintenance process of an IT system can be improved, and system resources occupied by the Agent when executing the shell script command are controlled.

Description

Script service method based on heterogeneous operating system
Technical Field
The invention belongs to the field of IT system operation and maintenance, relates to a method for managing and executing a script program by an Agent, and particularly relates to a script service method based on a heterogeneous operating system.
Background
In the operation and maintenance process of the IT system, Agent software is installed on each monitored and managed computer and is used for communicating and interacting with a server or proxy, executing commands issued by the server and monitoring and managing a target computer. When a server issues a script execution command to an Agent, the current Agent implementation mode is that the Agent starts a shell process, and the shell executes the script command. And after the script command is executed, the shell process returns a result to the Agent and then exits.
The current implementation has the following problems: 1) because the process is started by consuming resources and time, when the Agent executes the script program each time, the Agent needs to start a shell process first, then the shell executes the script command, and the shell process is closed after the command execution is finished, so that the execution efficiency of the script program is low, and more time is needed. 2) When a large amount of script programs need to be executed in a short period of time, the agents simultaneously start a plurality of shell processes to execute script tasks. When the started shell process is too much, a large amount of CPU and memory resources of the monitored management host computer are consumed, the occupation of the CPU and the memory of the host computer is possibly beyond the design limit of monitoring management, and the execution of the normal task of the host computer is further influenced.
Disclosure of Invention
Aiming at the defects or shortcomings of the prior art, the invention provides a script service method based on a heterogeneous operating system.
The technical solution of the invention is as follows:
a script service method based on a heterogeneous operating system is characterized in that an idle shell process pool is arranged in a monitored management host computer provided with Agent software, the idle shell process pool comprises a plurality of shell processes which are started in advance along with the start of the Agent software, and each shell process which is started in advance serves as an idle shell process and waits for the Agent to take out the idle shell process in the idle shell process pool to execute a script command.
The monitored management host is connected with the server through the Agent, a script command task queue module is arranged in the Agent, script commands transmitted from the server and script commands initiated locally by the Agent enter the script command task queue to be queued at first, the Agent takes out the script command tasks from the head of the queue, takes out shell processes from an idle shell process pool and submits the script command tasks to the shell processes to be executed.
The step of submitting the script command task to the shell process to execute comprises the step of transmitting the script command from a shell process standard input interface to the shell process by the Agent, inputting a display starting command, inputting the script command, and inputting a display ending command.
The corresponding shell programs are available for different operating systems, so that the script service method has universality and can support various operating systems.
The operating system of the monitored management host is windows, linux, AIX or HP-UX.
The number of the initial starting shell processes is determined by parameter configuration, and the server modifies the value of the parameter by issuing a command to the Agent.
The server modifies the number of the shell processes online by issuing commands to the Agent, and the Agent starts or stops a certain number of shell processes newly, so that the number of the shell processes providing script command execution service is the same as the number specified by the server commands.
The method comprises the following steps:
step 1, a server downloads a script program file to an Agent;
step 2, the Agent stores the script program file to the local;
step 3, after the server transmits the script command and the parameters to the Agent, the Agent puts the received script command into a task queue, and the Agent puts the locally initiated script command such as timed execution into the task queue;
step 4, the Agent sets a special thread pool to wait for the arrival of a task in the task queue, takes out the task once the task arrives, and takes out an idle shell process from the idle shell process pool, if no idle shell process exists, the Agent waits;
step 5, the Agent transmits the script command from the shell process standard input interface to the shell process, firstly inputs a display starting command, then inputs the script command and finally inputs a display ending command;
and 6, reading output information from the shell process standard output interface by the Agent, confirming the task execution state, when the information of the display ending command is read, indicating that the script command is executed, returning the shell process to the idle shell process pool, registering the execution result in a log and returning the log to the script command initiator.
The invention has the following technical effects: the script service method based on the heterogeneous operating system can improve the efficiency of executing the shell script command by the Agent in the operation and maintenance process of the IT system and control the system resources occupied by the Agent when executing the shell script command by setting the idle shell process pool and putting a plurality of shell processes started along with the start of the Agent software into the idle shell process pool as idle shell processes to wait for executing the script command.
The invention has the following beneficial effects: 1. because the shell process is started in advance, the shell process is not required to be started and closed once when one shell program is executed, the execution efficiency of the script program can be improved, and the execution efficiency is improved by 10 times under a certain test environment and a certain test case through testing. 2. Because the script commands are queued first and then distributed to the shell processes with fixed quantity to be executed, the number of the shell processes for executing the script tasks cannot expand due to the simultaneous arrival of a large number of tasks, and the current limiting function is achieved, so that the occupation of system resources can be kept within a reasonable interval range. 3. Different operating systems all have corresponding shell programs, so that the script service method has universality and can support various operating systems.
Drawings
Fig. 1 is a schematic diagram of an architecture formed by implementing a script service method based on a heterogeneous operating system according to the present invention, and including a server and a monitored management host. The method comprises the steps that Agent software and a plurality of shell processes started along with the Agent software are installed in a monitored management host computer in the graph 1 to wait for execution of a script command, the monitored management host computer is connected with a server/proxy through the Agent, a script command task queue module is arranged in the Agent, the shell processes are all used as idle shell processes to enter an idle shell process pool, and the Agent executes a script command task taken out of the script command task queue module by taking out the idle shell processes from the idle shell process pool.
FIG. 2 is a flow chart of a script service method based on heterogeneous operating systems according to the present invention. FIG. 2 includes step 1, where the server downloads the script program file to the Agent; step 2, the Agent stores the received file to the local; step 3, after transmitting the script command and the parameter to the Agent by the server, putting the received script command into a task queue by the Agent, and putting the locally initiated script command such as timed execution and the like into the task queue by the Agent; step 4, the Agent sets a special thread pool to wait for the arrival of the task in the task queue, takes out the task once the task arrives, and takes out an idle shell process from the idle shell process pool, if no idle shell process exists, the Agent waits; step 5, the Agent transmits the script command from the shell process standard input interface to the shell process, firstly inputs a display starting command, then inputs the script command and finally inputs a display ending command; and 6, reading output information from the shell process standard output interface by the Agent, confirming the task execution state, when the information of the display ending command is read, indicating that the script command is executed, returning the shell process to the idle shell process pool, registering the execution result in a log and returning the log to the script command initiator.
Detailed Description
The invention is explained below with reference to the figures (fig. 1-2) and examples.
Fig. 1 is a schematic diagram of an architecture formed by implementing a script service method based on a heterogeneous operating system according to the present invention, and including a server and a monitored management host. FIG. 2 is a flow chart of a script service method based on heterogeneous operating systems according to the present invention. Referring to fig. 1 to 2, in a script service method based on a heterogeneous operating system, an idle shell process pool is set in a monitored management host installed with Agent software, the idle shell process pool includes a plurality of shell processes that are started in advance with the Agent software, and each shell process that is started in advance is taken out as an idle shell process in the idle shell process pool in a waiting manner for the Agent to execute a script command. The monitored management host is connected with the server through the Agent, a script command task queue module is arranged in the Agent, script commands transmitted from the server and script commands initiated locally by the Agent enter the script command task queue to be queued at first, the Agent takes out the script command tasks from the head of the queue, takes out shell processes from an idle shell process pool and submits the script command tasks to the shell processes to be executed.
The step of submitting the script command task to the shell process to execute comprises the steps of transmitting the script command from a shell process standard input interface to the shell process by the Agent, inputting a display starting command, inputting a script command, and inputting a display ending command. The corresponding shell programs are available for different operating systems, so that the script service method has universality and can support various operating systems. The operating system of the monitored management host is windows, linux, AIX or HP-UX. The number of the initial starting shell processes is determined by parameter configuration, and the server modifies the value of the parameter by issuing a command to the Agent. The server modifies the number of the shell processes online by issuing commands to the Agent, and the Agent starts or stops a certain number of shell processes newly, so that the number of the shell processes providing script command execution service is the same as the number specified by the server commands.
The method comprises the following steps: step 1, a server downloads a script program file to an Agent; step 2, the Agent stores the script program file to the local; step 3, after the server transmits the script command and the parameters to the Agent, the Agent puts the received script command into a task queue, and the Agent puts the locally initiated script command such as timed execution into the task queue; step 4, the Agent sets a special thread pool to wait for the arrival of a task in the task queue, takes out the task once the task arrives, and takes out an idle shell process from the idle shell process pool, if no idle shell process exists, the Agent waits; step 5, the Agent transmits the script command from the shell process standard input interface to the shell process, firstly inputs a display starting command, then inputs the script command and finally inputs a display ending command; and 6, reading output information from the shell process standard output interface by the Agent, confirming the task execution state, when the information of the display ending command is read, indicating that the script command is executed, returning the shell process to the idle shell process pool, registering the execution result in a log and returning the log to the script command initiator.
The invention provides a script service method based on a heterogeneous operating system, which is used for improving the efficiency of executing shell script commands by an Agent in the operation and maintenance process of an IT system and controlling system resources occupied by the Agent when the Agent executes the shell script commands, and comprises the following technical means:
when the Agent is started, a certain number of shell processes are started, and a script command is waited to be executed. When a script command arrives, an idle shell process is found, the script command is transmitted to the shell process to be executed, and output information of the shell process executing the script command is received. And after the execution of one script command is finished, the shell process enters an idle state and waits for the arrival of the next script command.
And setting an idle shell process pool and managing idle shell processes. The shell process enters an idle shell process pool after being started, when a script command needs to be executed, an Agent takes out an idle shell process from the idle shell process pool to execute the script command, and after the script command is executed, the shell process enters the idle shell process pool to wait for the next script task.
When the Agent executes the script command, before the script command is executed, the script command is added with a script command for displaying the start and the end of the script execution after the script command is executed. The Agent checks the standard output of the shell process, thereby acquiring the information that a script command is executed and executed.
When the script command is to execute a script program file, the server and the Agent have two interactions, and the server downloads the script program file to the Agent for the first interaction and the Agent stores the script program file locally. And for the second interaction, the server downloads the script command and the parameters of the calling script program file to the Agent, and the Agent immediately organizes and executes the script command and the parameters.
The number of the initial starting shell processes is determined by parameter configuration, and the server can modify the value of the parameter by issuing a command to the Agent. The server can also modify the number of the shell processes online by issuing commands to the Agent, and the Agent starts or stops a certain number of shell processes newly, so that the number of the shell processes providing the service of executing the script commands is the same as the number specified by the server commands. When the Agent stops the shell process, only the process entering the idle shell process pool is stopped, and the Agent is used for ensuring that the executing task is not interrupted.
And setting a script command task queue. The script execution command transmitted from the server and the script execution command locally initiated by the Agent enter the script command task queue to be queued. And the Agent takes out the script command task from the head of the queue, takes out the shell process from the idle shell process pool, and submits the script command task to the shell process for execution. And waiting if no script command task or no idle shell process exists.
And starting corresponding shell programs aiming at different operating systems, for example, starting a cmd program for windows, starting an sh program for linux, and starting the corresponding shell programs for AIX, HP-UX and other operating systems. Some operating systems have multiple shell programs, and in order to reduce operation and maintenance workload, the same shell program is recommended to be started for the same operating system.
As shown in fig. 1, each monitored and managed computer is installed with Agent software for communicating with a server or proxy, executing a command issued by the server, and monitoring and managing a target computer. When the Agent is started, a certain number of shell processes can be started at the same time, and the processes can enter an idle shell process pool to wait for executing a script command task. The number of the initial starting shell processes is determined by parameter configuration, and the server can modify the value of the parameter by issuing a command to the Agent. The server can also modify the number of the shell processes online by issuing commands to the Agent, and the Agent starts or stops a certain number of shell processes newly, so that the number of the shell processes providing the service of executing the script commands is the same as the number specified by the server commands. When the Agent stops the shell process, only the process entering the idle shell process pool can be stopped, and the Agent is used for ensuring that the task which is being executed is not interrupted. And starting corresponding shell programs aiming at different operating systems, for example, starting a cmd program for windows, starting an sh program for linux, and starting the corresponding shell programs for AIX, HP-UX and other operating systems. Some operating systems have multiple shell programs, and in order to reduce operation and maintenance workload, the same shell program is recommended to be started for the same operating system.
And setting a script command task queue. The script execution command transmitted from the server and the script execution command initiated locally by the Agent enter the script command task queue to be queued. And the Agent takes out the script command task from the head of the queue, takes out the shell process from the idle shell process pool, and submits the script command task to the shell process for execution. And waiting if no script command task or no idle shell process exists.
The script command execution flow is shown in fig. 2. The script command can be a script program file executed or other shell commands. When the script command is to execute a script program file, the script program file needs to be transmitted to the Agent by the server.
Fig. 2 depicts the case when the script command is to execute a script program file.
And the server downloads the script file to the Agent.
And the Agent receives the file and then stores the file to the local.
The script command task queue holds two types of sources of tasks: script execution commands transmitted from the server and script execution commands initiated locally by the Agent.
The script command and the parameters are transmitted to the Agent by the server and put into the task queue by the Agent.
The script execution command initiated locally by the Agent is used for putting a script command task and the like executed regularly into a task queue by the Agent.
The Agent sets a thread pool, and the number of threads in the pool is equal to the number of the shell processes in principle. And reading the script command in the task queue by the thread to execute the task.
And the thread reads the task in the task queue and acquires an idle shell process from the idle shell process pool, and if no idle shell process exists, the thread waits until the idle shell process is acquired.
The shell process's standard io operations have a standard input (stdin), a standard output (stdout), a standard error (stderr), correspond through three streams in the java language, getOutputStream (), getInputStream (), getErrorStream ().
For each task in the task queue, the Agent respectively adds a display start command and a display end command before and after the Agent. And transmitting the script commands to the shell process through a standard input interface of the shell process.
And the Agent reads the output information from the standard output interface of the shell process, confirms the task execution state, indicates that the script command is executed when the information of the display ending command is read, returns the shell process to the idle shell process pool, and registers the execution result in a log and returns the log to the transaction initiator.
Those skilled in the art will appreciate that the invention may be practiced without these specific details. It is pointed out here that the above description is helpful for the person skilled in the art to understand the invention, but does not limit the scope of protection of the invention. Any such equivalents, modifications and/or omissions as may be made without departing from the spirit and scope of the invention may be resorted to.

Claims (8)

1. A script service method based on a heterogeneous operating system is characterized in that an idle shell process pool is arranged in a monitored management host computer provided with Agent software, the idle shell process pool comprises a plurality of shell processes which are started in advance along with the start of the Agent software, and each shell process which is started in advance serves as an idle shell process and waits for the Agent to take out the idle shell process in the idle shell process pool to execute a script command.
2. The script service method based on the heterogeneous operating system according to claim 1, wherein the monitored management host is connected with the server through an Agent, a script command task queue module is arranged in the Agent, both a script command transmitted from the server and a script command initiated locally by the Agent enter a script command task queue to queue up, the Agent takes out a script command task from the head of the queue, takes out a shell process from an idle shell process pool, and submits the script command task to the shell process for execution.
3. The script service method based on the heterogeneous operating system according to claim 2, wherein the submitting of the script command task to the shell process for execution comprises the Agent transmitting the script command from a shell process standard input interface to the shell process, inputting a display start command, inputting the script command, and inputting a display end command.
4. The method of claim 1, wherein there are corresponding shell programs for different operating systems, so that the method is universal to support various operating systems.
5. The method of claim 1, wherein the os of the monitored management host is windows, linux, AIX, or HP-UX.
6. The script servization method based on the heterogeneous operating system according to claim 1, characterized in that the number of initial startup shell processes is determined by parameter configuration, and the server modifies the value of the parameter by issuing a command to the Agent.
7. The script service method based on the heterogeneous operating system according to claim 1, wherein the server modifies the number of shell processes online by issuing commands to the Agent, the Agent newly starts or stops a certain number of shell processes, so that the number of shell processes providing the service of executing script commands is the same as the number specified by the server commands, and when the Agent stops the shell processes, only the processes entering the idle shell process pool are stopped, so as to ensure that the task being executed is not interrupted.
8. The script servization method based on the heterogeneous operating system according to claim 1, characterized by comprising the following steps:
step 1, a server downloads a script program file to an Agent;
step 2, the Agent stores the script program file to the local;
step 3, after the server transmits the script command and the parameters to the Agent, the Agent puts the received script command into a task queue, and the Agent puts the locally initiated script command such as timed execution into the task queue;
step 4, the Agent sets a special thread pool to wait for the arrival of the task in the task queue, takes out the task once the task arrives, and takes out an idle shell process from the idle shell process pool, if no idle shell process exists, the Agent waits;
step 5, the Agent transmits the script command from the shell process standard input interface to the shell process, firstly inputs a display starting command, then inputs the script command and finally inputs a display ending command;
and 6, reading output information from the shell process standard output interface by the Agent, confirming the task execution state, when the information of the display ending command is read, indicating that the script command is executed, returning the shell process to an idle shell process pool, registering an execution result in a log and returning the log to a script command initiator.
CN202210269201.6A 2022-03-18 2022-03-18 Script service method based on heterogeneous operating system Pending CN114637557A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210269201.6A CN114637557A (en) 2022-03-18 2022-03-18 Script service method based on heterogeneous operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210269201.6A CN114637557A (en) 2022-03-18 2022-03-18 Script service method based on heterogeneous operating system

Publications (1)

Publication Number Publication Date
CN114637557A true CN114637557A (en) 2022-06-17

Family

ID=81949869

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210269201.6A Pending CN114637557A (en) 2022-03-18 2022-03-18 Script service method based on heterogeneous operating system

Country Status (1)

Country Link
CN (1) CN114637557A (en)

Similar Documents

Publication Publication Date Title
EP0709777B1 (en) Method of and apparatus for debugging multitask programs
US20160260040A1 (en) Computer Device, Method, and Apparatus for Scheduling Business Flow
CN112965755B (en) Initialization method and device of multi-core processor, electronic equipment and storage medium
JPH0594317A (en) Input output interrupt processing system of virtual machine
CN116841655A (en) Script execution method, script execution device, script execution equipment, storage medium and script execution product
CN114637557A (en) Script service method based on heterogeneous operating system
CN109062686B (en) Multi-process management method, storage medium, electronic device and system
CN111580858A (en) Method and system for regularly releasing codes
CN113127162B (en) Automatic task execution method and device, electronic equipment and computer storage medium
CN112579460B (en) Multi-level debugging method based on multi-core embedded system
CN102736949A (en) Scheduling of tasks to be performed by a non-coherent device
CN112988365B (en) Thread management method, device, equipment and medium
JPS6336023B2 (en)
CN110134453B (en) Server configuration overloading method and server
CN118069382A (en) Embedded redundancy computer software synchronous debugging system and method
JP2535664B2 (en) Waiting method for satisfying processing conditions
JPH0449146B2 (en)
CN115080443A (en) RPA remote debugging method, device, equipment and medium
CN115168094A (en) Data checking method, device, equipment, system, storage medium and product
CN115309463A (en) Method for guiding and configuring AMP system
JP2842609B2 (en) Program execution schedule processing method
CN117435310A (en) Scheduling method and electronic equipment
CN115373808A (en) Data acquisition method, data acquisition device, computer storage medium and computer system
CN116227393A (en) Verification method, verification device, electronic equipment and storage medium
CN116166566A (en) Test case multithreading scheduling method, system and test management device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination