OnPrem Agent v1.0.3
25min
!! the onprem agent cmd and onprem agent get result actions mentioned in the following steps are available only for accounts that acquire the onprem agent subscription the procesio on premises agent or for short onprem agent is a software application that can run both on linux or windows operating systems that monitor commands (further on called tasks) sent by a process action from a procesio process, executes the command, and gives back feedback on the result of the executed command so that it can be available in the process this guide will help you to understand how the mechanism works, how to install the onprem agent and how to configure the onprem agent cmd & onprem agent get results process actions this is the first version of the procesio on premises agent that allows remote execution of actions from procesio to a remote local machine that procesio does not have direct access to improved versions of the agent or of the entire mechanism might mean changes in the process or in the agents' configuration the current mechanism works as described in the following image step 1 install and configure the onprem agent the onprem agent is a stand alone application that needs to be copied on a remote machine where you want to execute commands from a procesio process and then configured to run at the operating system startup the agent is written in net6 c# 1\ download the onpremagent net6 1 0 3 zip file and extract its contents in the location you want to install the agent into the agent file will be provided for accounts that acquire the onprem agent subscription the file contents are as follows file/folder name version details agent netcore exe 1 0 3 the actual windows agent that needs to be executed at system startup agent netcore dll 1 0 3 the actual linux agent library that needs to be executed at system startup procesio agent settings txt 1 0 3 configuration file read by the agent the moment it is started in order to load the parameters secretagentkey, httpdefault & proxy (only if it is the case) logs where the agent logs are stored other files & folders please do not modify or delete the files/folders that come in the above zip archive as the agent will not function without those 2\ edit the following files procesio agent settings txt the content of this file is as follows secretagentkey httpdefault https //gefeeauth azurewebsites net/procesioagentserver php https //gefeeauth azurewebsites net/procesioagentserver php please change the value of the “secretagentkey” with some random complicated secret key you need to write the secret key immediately after the “ “ if you write for example secretagentkey thisi$0ran40mk3y the secret key will be “ thisi$0ran40mk3y“, so it will contain a space if the internet connection on the machine where you install the agent runs through a proxy, then you can add an additional parameter where you can set up the proxy server through you what the agent to connect to the internet proxy 127 0 0 1 3\ only for linux pre requisites before running the agent on linux environments please make sure you have the operating system up to date and the dotnet6 from microsoft installed to do that, please execute the following commands in the terminal // update os sudo apt upgrade y sudo apt upgrade fix missing //install dot net 6 wget https //packages microsoft com/config/ubuntu/20 04/packages microsoft prod deb sudo dpkg i packages microsoft prod deb sudo apt install y dotnet sdk 6 0 sudo apt install y dotnet runtime 6 0 dotnet version 4\ starting the agent for windows run the agent netcore exe file, directly or from the cmd 1agent netcore exe for linux run the following command in the terminal 1dotnet agent netcore dll 5\ setting up the agent to run on os startup for windows tbd for linux tbd 6\ getting the hostname for windows open the cmd and for linux open the terminal and type 1hostname the result of this command will be used to configure the procesio process that will execute commands on a certain agent step 2 configure a process to execute commands on premises you will have to navigate to https //procesio app https //procesio app/ login to the platform using your credentials and set the workspace to the workspace you have shared with your colleagues go to the process designer menu and choose to create new 1\ configure the process & variables give a name to your process, such as go to the custom actions tab in the actions panel you should be able to see the onprem agent cmd and onprem agent get result actions drag them on the canvas and connect the process as seen below go to process variables add the following variables as seen in the next image for the purpose of this example, please configure the default values for the endpoint , secretkey , and agentssid variables you cand have those variables populated from other processes as well if you want for the purpose of this example, please populate the default values of the variables as follows endpoint https //gefeeauth azurewebsites net/procesioagentserver php https //gefeeauth azurewebsites net/procesioagentserver php secretkey here you should put it exactly as you set up the secretagentkey in the procesio agent settings txt file from step 1, 2 edit the following files agentssid here you should put the hostname of the machine where the agent was installed please refer to step 1, 6 getting the hostname 2\ configure the action “onprem agent cmd“ click on the action in the canvas and the action’s property panel will be displayed to the right of the screen you will notice that the action has 2 configuration tabs, as follows command and configuration please configure each of the tabs as follows configuration tab the working directory parameter you can configure as you like, giving it a folder path on the machine where that agent runs you can configure it as a variable or hard coded, as you like this parameter sets the working directory of the command prompt for time out (seconds) parameter if you set 0 or <0 values it will consider 600 seconds (10 minutes) the task id parameter is an output parameter that returns the id of the task that was sent to the on premise agent to execute this parameter will be needed for the onprem agent get result action command tab in this section, you can either execute a file or execute commands if you execute a file, the commands to execute field will be ignored all fields in this section are optional if you execute a file, you can also add arguments for executing the specified file, by adding them in the arguments for the file to execute field 3\ configure the action “onprem agent get results“ this action has only one tab (configuration) and it has the following parameters the taskid parameter which is an input for this action comes from the output of the onprem agent cmd action 4\ configure the decisional you need to configure the decisional action so that if the task was not finished it should try again to check the status we did this with this configuration retriesallowed > 0 means that the process should not try to get the result more than the number set in the variable retriesallowed this condition prevents infinite loops taskstatus = 0 or taskstatus = 1 means that the status of the task is toexecute (0) or executing (0) and for that reason, the process should use a delay action to wait some time before trying again to check the status 5\ configure the delay action you need to configure the delay action to be relevant to the task that you know you are running if the task you are going to run will execute fast (less than one second or a few seconds), it would be a good idea to set the delay to one or more seconds if the task you are going to run will execute in a few minutes you should set the delay to one or more minutes if the task you are going to run will take a few hours or longer you should adapt the delay to be relevant for the execution time of the task as a rule of thumb, adapt the delay time you set so the process will execute the minimum possible number of actions 6\ configure the retriesallowed action this action is a numerical add operation action and it is intended to decrease by 1 the variable retriesallowed for every retry the process makes to get the result of the task the purpose of this is to prevent infinite loops for tasks that might get stuck or take indefinite time to finish 7\ save, validate & run the process now, you can save, validate & run the process go to the instance of the process by clicking check instance (it will be displayed for 3 seconds after you run the process) in the instance view, you will be able to see the outputs of the process in the dataresults output, it will be included all the information which is also visible if you were to execute those commands in a command prompt, except for the errors in the errorresults output, it will be included all the errors which come from executing the commands takslogs is a list of all the logs of the agent service if any generally, it will be in the case of errors inside the agent service taskstatus will give the status of the task 0 toexecute 1 executing 2 successfullyexecuted 3 finishedwitherrors 4 timedout taskid is the id of the task sent to be executed by the agent enjoy!