7.2.2. Create Files

There are some files and folders required to create the new Plugin:

7.2.2.1. Plugin folder

First, a folder must be created in /usr/share/opennac/api/application/models/Plugins/{plugin_name}.

  • The name of the folder must be the Plugin name.

7.2.2.2. Plugin execution file

Inside the folder previously created, create the following file: /usr/share/opennac/api/application/models/Plugins/{plugin_name}/{plugin_name}.php

  • The name of the file must be the plugin name and must end with .php because OpenNAC Enterprise uses PHP language.

  • The content of this file will be explained in the section Plugin execution (backend).

7.2.2.3. Configuration params file

Inside the folder previously created, create the following file: /usr/share/opennac/api/application/models/Plugins/{plugin_name}/{plugin_name}.json

  • The name of the file must be the plugin name and must end with .json because OpenNAC Enterprise will parse the content as JSON to generate the frontend of the Plugin.

  • The content of this file will be explained in the section Fields file in JSON format (frontend).

Example: In the following image, a plugin named openPorts has been created.

[root@principal ~]# ll /usr/share/opennac/api/application/models/Plugins/openPorts/
total 16
-rw-r--r-- 1 apache apache  2979 Jul 21 15:06 openPorts.json
-rw-r--r-- 1 apache apache 15592 Jul 21 15:06 openPorts.php