# PandoraFMS IBM-I plugin # Introduction **Ver.** 09-08-2022 With the Pandora\_IBM-I plugin in collaboration with "Control for i" you can monitor an IBM i partition and obtain different metrics in a simple and configurable way. The commands to be executed will be defined in a configuration file, obtaining the possibility of defining monitoring templates executing several of these at the same time against the configured partition. **Type**: Server plug-in / can also be configured as an agent plug-in. # Compatibility matrix
**Systems tested** CentOS 7 / RHEL 8 / RockyLinux 8
**Systems where it should work** Any linux system
# Pre requisites - A PandoraFMS enterprise instance - Pandora FMS Data Server enabled - Pandora FMS Plugin Server enabled. - Have an installation of the control4i software in the IBM-i partition to monitor - Have the control4i client to use in conjunction with this plugin. # Parámeters
**Parámetro****Descripción**
-c, --chckpathPath of check\_Control4i (Required)
-H,--hostIP address of the IBM i host on which the command is to be executed (Required)
-C, --confPath of the conf file with the commands (required)
-p,--portIf the default port 7357 cannot be used, it is possible to indicate which port will be used.
-t,--timeoutSpecifies the duration (in number of seconds) that the plugin waits for a response from the host before indicating an error. The default value is 10 seconds.
-v,--versionSpecify the version of the communication mode to be used between the plugin and the partition o V01 (default value) can be used for the vast majority of commands. o V02 (available as of February 2022) transmits the time of the monitoring server in addition to the command. the command. This parameter must be specified for the CTCHKTIM command.
-a, --agent\_aliasTo give a name to the agent that will contain the modules of the custom queries.
-m, --module\_prefixPrefix for modules generated by the plugin (optional) by default: 'IBM-i\_'.
--tentacle\_addressIp of the tentacle server to send the data to (optional)
--tentacle\_port Tentacle port Default 41121 (optional)
-A, --use\_alias\_as\_nameUse agent alias as agent name (flag)
-g,--groupPandora FMS target group (optional)
--data\_dirPandora FMS data directory. By default it is /var/spool/pandora/data\_in/ (optional)
--as\_agent\_pluginIt is optional, if you want the plugin to be an agent plugin and put the modules in the pandora agent, execute this with a 1 (optional)
**pandora\_ibmi.conf** In this file the commands that you want to execute with check\_Control4i and that will return the data that we will see in the PandoraFMS console will be introduced. You should introduce one command per line. Example of conf file: ``` #Configuration file example with control4i built in commands #check if control4i is running ctchksbs control4i #The CTCHKCFGST command checks that a configuration item (line, controller or device) is in the expected state. CTCHKCFGST *ALL *LIN *ACTIVE #The CTCHKCPU command checks power usage by the system, all the jobs in a list of subsystems or by one or several jobs. CTCHKCPU #The CTCHKCPU command checks power usage by the control4i SBS. CTCHKCPU *SBS 2 80 90 control4i #The CTCHKDSK command is used to monitor system ASP disk space usage, A Warning alert will be generated if the disk % used has increased by 5% over a period of 24 hours. A Critical Alert will be generated if the disk % used has increased by 8% over a period of 24 hours. CTCHKDSK ASP(*SYSBAS) EVOL_W(5) EVOL_C(8) EVOL_TIME(24) #The CTCHKJOB command is used to check whether a job is active or inactive, check for CTAUTO Job CTCHKJOB CTAUTO *ANY #The CTCHKLOG command is used to count the number of error messages in a specific time. CTCHKLOG 12 #The CTCHKPING command is used to check that a corresponding server is available (via the PING command) from the IBM i partition. CTCHKPING '127.0.0.1' #The CTCHKPRB command is used to generate an alert when a system problem is detected. System problems are visible with the WRKPRB command. CTCHKPRB #The CTCHKSAV command is used to check that the backups were made correctly. CTCHKSAV ``` # Manual execution ``` pandora_ibmi.py [-h] -H HOST -C CONF [-c CHCKPATH] [-p PORT] [-t TIMEOUT] [-v VERSION] [-a AGENT_ALIAS] [-g GROUP] [-m MODULE_PREFIX] [-A] [--data_dir DATA_DIR] [--tentacle_port TENTACLE_PORT] [--tentacle_address TENTACLE_ADDRESS] [--as_agent_plugin AS_AGENT_PLUGIN] ``` [![image-1663751395728.png](https://pandorafms.com/guides/public/uploads/images/gallery/2022-09/scaled-1680-/image-1663751395728.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2022-09/image-1663751395728.png) # Configuration in PandoraFMS ## Install the plugin on the PandoraFMS server The operating procedure below is based on the use of PandoraFMS enterprise. The operations below need to be carried out when installing Control For i for the first time on an already operational PandoraFMS solution. ### Search for the name of the directory containing the plugins In PandoraFMS by default the path for server plugins is /usr/share/pandora\_server/util/plugin but a custom path could by used, on this guide we are going to use the default one and create a directory called pandora\_ibm for example to put there all the necessary files.
mkdir /usr/share/pandora\_server/util/plugin/pandora\_ibm
### Transfer the plugin to PandoraFMS Server The installation of the Control For i product created the /Ctl4i directory which contains the plugin and configuration file to install on the PandoraFMS server. Transfer the plugin and the configuration file from the “/Ctl4i” directory of the IBM i partition to the directory containing the plugins in PandoraFMS. In our example: “/usr/share/pandora\_server/util/plugin/pandora\_ibm”. If we download the package from the PandoraFMS library, an updated version of the Control4i client will be provided on the same package, so we could avoid transfer data from IBM i partition to the PandoraFMS server. To download the pandora\_ibmi plugin, Control4i client and confs files go to the PandoraFMS library: (url: [https://pandorafms.com/library/pandorafms-ibm-i-enterprise-plugin/](https://pandorafms.com/library/pandorafms-ibm-i-enterprise-plugin/)) and click on the package link to download a zip file including the necessary files. Then transfer these files to the directory defined on the PandoraFMS server ### Change the port to use (possibly) If port 7357 is already being used, the port to be used for communication between the PandoraFMS plugin and the agent on the IBM i partition may be changed. The default port is defined in the check\_Control4i\_Config file located in the same directory as the plugin that has just been transferred. Edit the content of this file and change the port number. A specific port can also be used by defining on the pandora\_ibmi plugin definition, which calls the check\_Control4i plugin by passing it the parameter -p followed by the port number to use. ### Check that the check\_Control4i client is working properly In the IBM i partition, check that the CONTROL4I subsystem is active. If not, start it with the CTSTRSBS command. In the PandoraFMS server terminal could execute:
\# cd /usr/share/pandora\_server/util/plugin/pandora\_ibm \# ./check\_Control4i -H <IBM i partition ip> -c "ctchksbs control4i" CTL1015 - The CONTROL4I subsystem is in \*RUN state
Make sure the check\_Control4i and the pandora\_ibmi binaries has execution rights, in case not just execute:
chmod +x check\_Control4i chmod +x pandora\_ibmi
If the returned message is: CTL1015 - The CONTROL4I subsystem is in \*RUN state The plugin operation is validated. ![](https://lh5.googleusercontent.com/r1KoWcOfdAM2LuWOs-v73Sxy1RvZ7sTXz_TAUexTKhnPepMW2Q7ONs-IRUSm2MkNEJBh7hlLYHvuhk2EzG5DUkYahtfWMtcr_hSBNX7zLQNhQNQn3M0RT4xTa3Q-MYQ0C3y2h5D2uZ9PJeu0jY9W0EMO37VANucKFQlKlh4kCTcZv4EwqJ0EXEd61Q) During the first use, you may receive no answer from the IBM I partition. Run the same command 3 times before to look for another cause. The reason is that when the agent starts (job CTAGENT) the 3 first demands are rejected, for a technical reason. ![](https://lh3.googleusercontent.com/v3uKA26nApG9-fsdQLKc4JFu-4X7MYlfw2zCNnhVmNu68Uvr64nQq76uRs34M1WpAoJIEs3QhIQCWnIzDM_uhVP6lwpIBceYP2D-qMURr4qC9jnPbnLqkx-K44Orqbt3wHw7pGRtvYBL2ljrk1mfydFNwXCSj4-WlchvG4sl5mHlohdl9XEtPVg_GQ) ### Configure the pandora\_ibmi conf file To get metrics using the pandora\_ibmi plugin we should modify the pandora\_ibmi.conf definition file, whit the commands we want to execute on the IBM i partition, to get a full list of available commands could address the IBM i check commands document. In order to execute a basic checks to our IBM i partition we will define a couple of commands on the configuration file, which is included by default: ![](https://lh4.googleusercontent.com/3zUzLiqZcWGpFIlCx7Pl0--1OwePXiZyxcWs1DWTSWKnkYswjJWCgRBBzp86qJBBbMrtdmsHowAI1V01y72efuUZJ305k20QUOOBX08cj2FMOkTCm1sN9eCFMoUzCeBZZJiKpzcCvqv6LWdawZnlBrdbn6f7cwiMW7G6RELolDRwb26TqX9juzGJOw) ### Execute pandora\_ibmi manually To execute pandora\_ibmi manually simply download de zip file, uncompress it on the desired path and move it to it, in our case /usr/share/pandora\_server/util/plugin/pandora\_ibm then execute the pandora\_ibmi with the host ip from our IBM i partition and the definition conf file as parameters.
./pandora\_ibmi -H 10.10.10.1 --conf pandora\_ibmi.conf
Remember, there are a couple of optional parameters we can use, like the agent alias, a custom port, module prefix, etc. But the mandatory ones are host ip and command definition conf file This is a server plugin so if we didn't get any error and a value of 1 is returned, that means every runs correctly and the agent (with default name in this case) was created on our PandoraFMS server retrieving the data of all commands defined on the command definition conf file. ![](https://lh5.googleusercontent.com/9itcHUXDeUAX-a5u1xXt5NTlYA0MGuF4v4vFyGgAXss1oe316156CoQ-ipPbxgzbfJnZ-bP19W01bxxmMqRr74v_atCkAg60vV4RjLhlEEeCdU9ODqN1TeEcDVMUrqlQyqAqylZKAVXXg56OudSGXhLodNxDTcp3JK9k9pSd0Nkb7nSoTONc7gKpCg) ![](https://lh4.googleusercontent.com/9XhZwhWDy1iaN2WeOPhj5pU2lDR7vTtRChpvMMwuac4Ucfncmlx-nN7LccA-zkFzVxtW2B-JcZwFoWts_VNbB6OWtGwvx8U_QnrlBWU-hBgham9jI8Ts1F-73KZFByoR2xyT5ujGbPy9gGR6D0kq5i14n6pgNq0Bqd8l3fSEBdoMKxkc7_JCo8mSJQ) ![](https://lh5.googleusercontent.com/u9crBC-iqYmJYVX4u2DzPzw1fHOCAOX3jdmGm7S0OrsE6SQ4AmSOMRekIIXnnjaf3F98OjfF7wJMQQcxTWUOOayMUfRGVLT6pNnuoRa--uywclOa3h_KVa30iRV4vhFARghHxXCvqDa8ltxooylnqBULJV3p_vIrYF1ZOLagjeuMQOYaojnXmt8Gmg) ### Configuring monitoring on PandoraFMS web Console We have configured our IBM i partition and chek the pandora\_ibmi and the check\_Control4i are working, so now we should configure the plugin in the web console in order to use to monitor IBM i. Once we log in into the web console as an administrator user, the first step is to access the console. In the Servers section, we access the Plugins tab. In this tab will appear all the server plug-ins that are installed by default with Pandora FMS. Click on Add. ![](https://lh6.googleusercontent.com/0mtImcaBKGV6_n0XuydGEZzSXpBotH-gUNgtYaQTP-guxSkvgT6I3rDBCv_QIM9jLRvAkxfDnVoFzpd-uxuwKNK3gXxOZ5o155_5bxtXGFCBCQhGwW6JFRY1e7Sal56ZGhYsz-GCDHt3lK0ksBIj3vmjqj4t61zL4EXy9m_cbIogF93FMlQsDtX2kw) The following window will be used to configure the plug-in before registering it. The first section is general options, where we can set the name we want to give to the plug-in, the type of plug-in, standard or Nagios, the maximum execution time of the plug-in and a brief description. In the next section we define the path where the plug-in is located and a series of macros, which are equivalent to the parameters of which the plug-in is composed, we will define the minimum necessary for this example and an adding just an extra optional parameter as agent alias. ![](https://lh5.googleusercontent.com/PcUnvR_TOAAtKhyJUo7CByrFKBKN2NqmKuUkWWHatjFFbwmZy1rseHOiIZ55haTqAx5DCA5xp9_jAPkVe3l8_KCG99ze761E-UN-hjbNvIeWKLaMiRKjxohYQmFLpoX96wFlTWB7XoCbWJq5vnWgngMq1O87V07rZSyQte3uQpVNsSLOFv9zxbChug) For more information about macros and how they work please visit the online documentation about it: [https://pandorafms.com/manual/es/documentation/08\_technical\_reference/05\_anexo\_server\_plugins\_development?s\[\]=field1#macros\_de\_plugin](https://pandorafms.com/manual/es/documentation/08_technical_reference/05_anexo_server_plugins_development?s%5B%5D=field1#macros_de_plugin) Finally, if we have added execution parameters, this section will be used to define these parameters by means of macros. We can also add default values to these macros, so that they will be used in case we do not provide a parameter. In this case, since the only mandatory parameter is the token parameter, the other two will be configured with default values. ![](https://lh5.googleusercontent.com/PJYyjWRcL42rF2thMQqqAxxlTDiGxFRoVbWv5IOLjSWEb4Acc_eJxPFV-miq3ZYrXiDGvEWJiSGtKKAImuGtqJdfu_yYS4WOjwX4bdUvK_evERCC4jq051Vt3eC2qzA5bj14Ou10pqaQ_3wNR_Kn48LUd-dBKVCPaJId-zPteQILtvmXu0EecfMn3w) Once we have finished, click on Create. Now we hace our plugin defined ready for deployment. Deploy the server plugin into an agent on PandoraFMS. Complete documentation about server plugins deployment could be found on: [https://pandorafms.com/manual/en/documentation/03\_monitoring/03\_remote\_monitoring#monitoring\_with\_server\_remote\_plugins](https://pandorafms.com/manual/en/documentation/03_monitoring/03_remote_monitoring#monitoring_with_server_remote_plugins) Here, we will deploy the server plugin configured before on a test agent, in order to show the basic configuration needed to make it work. The first step is to access the web console. In the resources section, we access the manage agent tab. ![](https://lh5.googleusercontent.com/028nh511o7s7Y_i4nIthuMb7Wm3b_tVNmOQM0cnU4ps219kkU0rxp24_CXdvernVMwSy9leIcKjYcCebCpuMA2JSDnl8_06XaJPvnqVRqqoZ1b78Qqr03k-tRXirVIP5bsvArbtipt6EXueKfwGZH5XKIxpygiHZy6NnlHQAoGWaGSGWlzehozq-cw) Here we could select the agent to deploy the plugin or create a new one, in our case we are going to create a new one. Click on create agent and fulfil the name, group and needed fields, then click on create. ![](https://lh6.googleusercontent.com/8t1rCCXK3EyAQlbaYBV_pR1IdZZE4QGapD3TKo4vWsh0GGgy7qCuiChM2bxliRQ1uy_ipsFwYuRk8OnRFdv2oiQoFUCubThTbKWKm2ZHxdXNrKlilhfz7v6Dqnun8CziMGa7s4rvoq68oXMflBlB9mBO1hpOvYbMjtWAM2jwS-OIoaXfcva6hc8bTg) Once created, a toolbar is available on the upper right side, go to the modules tab, select the type ‘create a new plugin server module’, then clic on create. ![](https://lh6.googleusercontent.com/TI8ELR_NIhVtbuHBJJvBmDKlFijP9pb41UgDR6aAb-Ew_b8kzDQ3FySRMbtH8SpPZNsyXgDVs1TcCrKzZm0BjLQ4jBNs5CrQAcUndadjNhbrtw_Fa1gagZYXbgwAP22ZmXhpUY0TssP1RebCkXFpjMmXXBCMIZj7TgYuavUBCmDOQ7NYmNkyyT8MXA) Select the pandora\_ibmi plugin we defined before ![](https://lh6.googleusercontent.com/-vCtmPeSxXqzs9g1b3F7wnBm75qminRqZBlvAJ-DKdPaqLSxNp6mUwb0sFgRl1qwRaT8d4Y6RXE0HD1Iahngt6PdGj6kadnYuo1WJoVtNAoE0vzhDZCpeJ0jbIttHIFijlMPMjKwxcZ5IIoaCz40eYunkMTNXS2AKsjU7XQakb9VCtKlXQx9jFp0EA) Then give it a module name and fullfill the fields configured on the macros for this execution, click on create. ![](https://lh5.googleusercontent.com/-to7A1Znx-TInajKhoBPs1RXEY7peUu3fIIYp4C5lsaB7N15FskclFQeOZQ4YOv4_yoov_mdUEv6ysmmZ78SxjIgzOB_vRpYtEg84iZ9UPZhR2Y8rBm6LiLzKbNkIapLTFFY0c3R3y7aVF2c9cv9dZWCSQ7JL4sFqlROp9wZ_d7t2qMh5TxD8o-DQg) That's it the plugin is already configured, wait a couple of seconds and then go to the eye on the upper right side to see the execution results. Once is executed, the plugin generates a new agent with all the commands defined on the command definition conf file: ![](https://lh5.googleusercontent.com/GQxvmukRkx2eIltiZiKFdT4rgfgX7p3gJfgn792ANe0fchAofjNWBj-Mi2Ebq_G7wCpXe1u5ikR3f4N-fsbRfs-LGfLmEzw6Q7WI5E8FyodgguSPyVJWzIMiaMy-1TJUQJLuupnLE_abGlY1JtLgZfnXL68BIpFSGkHg_o1XK20411FOVEPukRjGDA) From now, we can use the same template and definition to point as many IBMi partition as we want, just defining a new module with different IP addresses or even different command definition conf file for different modules. # Modules generated by the plugin The plugin will create an agent with a customizable name with the `--agent_name` parameter or with the default name "Pandora\_IBM-I" that will contain all the modules of the execution. The modules returned will depend on the commands described in the pandora\_ibmi.conf file, a single command can return from one module up to six, depending on the values returned in the command execution.