The infrastructure agent is an PHP application that can be run as a Windows service in order to facilitate communication and task handling between SimpleOne instance and external systems.
Concept
In SimpleOne, communication among the instance and customer infrastructure (for example, LDAP servers or mail servers) is implemented using the "server-agent" technology.
It is used for collaboration when integration with customer software is needed. Main aims of this collaboration are:
- Information synchronization on SimpleOne instance with predefined templates.
- Information synchronization on customer instances with predefined templates.
Tip |
---|
Technically, these These templates are PowerShell scripts implementing that implements some tasks to handle. |
System Requirements
Either A server or agent have been developed as a very lightweight application and do not require many system resources, such as CPU, RAM or hard disk space.
Software requirements
Software | HW Requirements (minimum) | SW Requirements |
---|
Agent | - CPU: 1.4 GHz 64-bit processor.
- RAM: 512 MB
- HDD: 32 GB
- Internet connection: 10/100/1000 Mbit/sec
Info |
---|
Agent The agent system requirements are limited to OS system requirements. |
| - Microsoft Windows server (2012r2 or higher)
- PHP interpreter (version 7.2 or higher)
- cURL library
|
Tip |
---|
Infrastructure The infrastructure server is configured on the SimpleOne instance as a dictionary record, implementing appropriate business server and client logic. |
Interaction procedure
Interaction configuring, if simplified, can be represented as described belowTo configure the interaction, complete the following steps:
- Install infrastructure agent on Microsoft Windows server in a customer infrastructure.
- Configure the infrastructure server on the SimpleOne instance.
- Configure the tasks for the infrastructure agent.After that
As a result, the interaction
begins.Agent is configured and starts. The agent sends requests to the server to get a job assignment.
Request The request interval can be configured via Windows Task Scheduler
(generally, it is 1 minute). The interval is usually equal to one minute.
- If there are no tasks to run, the agent performs further attempts within the intervals configured.
- If there are any some tasks to run, the agent starts executing them in turn.
- Whether tasks were completed successfully or not, the agent will connect connects to the server to report on the execution.
Note |
---|
You need to allow enable the "agent→server" connections in your firewall rules. |
You can find graphical principles of this process on the diagram below:
Image Modified
Anchor |
---|
| Infrastructure server |
---|
| Infrastructure server |
---|
|
Setting Set up the infrastructure server
To add the server parameters into the appropriate table, complete the following steps:
- Navigate to MID servers → MID server.
- Click New and fill in the form.
- Click Save or Save and Exit to apply the changes.
MID Server form fields
Field | Mandatory | Description |
---|
Name | Y |
The Specify the infrastructure server name displayed on the list. |
Hostname | Y |
The Specify the hostname of the external server to which to connect. |
Last Connect | YThe date and time of the latest connect. This field is populated automatically and always read-only. | The username user with access to the infrastructure agent functionality. |
Tip |
---|
Infrastructure agent contains two .bat files: - one for adding the infrastructure agent starting up to add the launch of the infrastructure agent into the external server schedule;
- and one for removing to remove it from the scheduler.
This functionality allows monitoring task processing with you to monitor the execution of a task at a given specified interval. |
To configure your infrastructure agent, you need to find the .env configuration file in the \bin directory where the infrastructure agent was installed. Copy your *.env.example file into the *.env one and modify it in appropriate with your instance settings.
Example of the configuration file:
MID_API_USERNAME=admin
MID_API_PASSWORD=123456
MID_API_SERVERID=157237947616342741
MID_API_ENDPOINT=https://instance.example.com/rest
Infrastructure Server configuration file description
Field | Description |
---|
MID_API_USERNAME | The system user name username with granted access to the infrastructure the functionality of the infrastructure agent functionality. |
MID_API_PASSWORD | The password of the appropriate specified user. |
MID_API_SERVERID | The server ID of the server configured earlier in the that is configured in the MID Server table. |
MID_API_ENDPOINT | Link to the SimpleOne instance. |
Add scripts
After you set up your infrastructure agent, you need to configure the PowerShell scripts for it.
Note |
---|
Learning how to develop PowerShell scripts is out of scope of this article; please refer to PowerShell product documentation. |
- Navigate to MID Servers → MID Scripts.
- Click New and fill in the form.
- Click Save or Save and Exit to apply the changes.
MID Script form fields
Field | Mandatory | Description |
---|
Name | Y |
The infrastructure Specify the infrastructure server name displayed on the list. |
Description | N |
Brief script descriptionAdd a brief description of the script. |
Is Active | N | Select this checkbox to |
make active or inactiveType your script here, handling Specify a script that handles the necessary tasks and |
duties related to responsibilities associated with the corresponding activities. Tip |
---|
In these scripts, you can use variables |
|
facilitating to facilitate the data exchange |
|
within customer across the client infrastructure and the SimpleOne |
|
instance bundleAs an For example, you can make |
|
such a this definition in your MID Script: Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | MID Script |
---|
| $title='Title:\n';Write-Host($title);Write-Host($param1); |
Then the value |
|
for of the title variable should be transferred |
|
into in the Request field of the related MID Queue record: Code Block |
---|
language | text |
---|
title | MID Queue Request |
---|
| {"param1":"String value"} |
After the script |
|
executionis executed, the Response field in the related MID Queue record is equal to: Code Block |
---|
language | text |
---|
title | MID Queue Response |
---|
| Title:
String value |
|
|
Set up a taskTo set up a job on the external infrastructure element, you need to create a record in the MID Queue (sys_mid_queue) table. For this, please complete the steps below.
- Navigate to MID Servers → MID Queue.
- Click New and fill in the form.
- Click Save or Save and Exit to apply the changes.
MID Queue form fields
Field | Mandatory | Description |
---|
Request | N |
Type the the the Server The server response containing the output of the command |
output the the stdout response) and other feedback. This field is populated automatically. |
Description | N |
A Specify a brief description of the job |
descriptionReference to the Specify a record containing information about |
the infrastructure server configured earlier in the the previously configured infrastructure server in the MID Server table. |
Script | Y |
Reference to the Specify a record containing |
the infrastructure the infrastructure script that |
was set up you configured earlier in the MID Script table. |
Status |
NY | The job status. This field is populated automatically. Available options: - Created – the job was just created but not yet been processed.
- Processing – the job is processing now, and no error code
|
was - is returned.
- Done – the job
|
was - is completed successfully, and the 0 error code
|
0 was - is returned.
- Error – the job
|
was - is completed with errors, and any other error code
|
was Tip |
---|
- If there is more than one job in the queue, they
|
|
will be - are executed sequentially, one
|
|
by one- after another, from old to new.
- If an external server
|
|
is responding for - respond within a minute, the script will
|
|
be terminated by timeout- time out. Note: in this case, the corresponding task
|
|
will the run - execute a job manually if necessary. To do this, run the command:
Code Block |
---|
php.exe bin\agent mid:run-job |
Where run:job is a job name you need to |
|
executebe executed. Note: bin\agent is |
|
a pathway relatively the path relative to the installation folder of the infrastructure agent. |
|
In the case of the another please ; otherwise. Otherwise, the job may not be executed. |
|
Processed at | N | The date and time when the request was processed. |