Introduction:
The monitoring agent includes a range of plugins designed to monitor various aspects of your servers, including CPU, Memory, Disk, Network, and Processes. Additionally, it provides plugins for monitoring services such as MongoDB, PHP-FPM, NGiNX, and Apache2/httpd.
In addition to these pre-built plugins, you have the option to monitor other metrics on your server by developing your own plugin. These custom plugins are written in either Python 2 or Python 3. To determine the Python version your agent is running, navigate to the plugin directory and run "agent360 info" to unveil the Python version in use.

Time depends on your coding experience
Base
The base of a plugin is as follows:
#!/usr/bin/env
python import plugins
class Plugin(plugins.BasePlugin):
__name__ = 'fridge'
def run(self, *unused):
results = {'milk': 10, 'eggs': 4}
return results
if __name__ == '__main__':
Plugin().execute()
This is a simple example plugin. You have to save the plugin to the plugins
directory. You can find out your plugin directory by running the agent360 info
command:
Version: 1.1.18
Plugins enabled: memory, diskusage, process, loadavg, network, cpu, ping, iostat, swap, system
Plugins directory: /usr/local/lib/python2.7/dist-packages/agent360/plugins
Server: 53bad1a222c9eea0378a4567
Save the plugin title under the same value as the __name__. For example, in this case, we would save the plugin to /usr/local/lib/python2.7/dist-packages/agent360/plugins/fridge.py
Now we can test the plugin by running the following command: sudo -u agent360 agent360 test fridge
It will return results similar to the following:
fridge:
{"eggs": 4,"milk": 10}
If this doesn’t work, try to run this plugin as root to check if there is a permission issue.
fridge:
{"eggs": 4,"milk": 10}
If the test is successful, you can enable the plugin by editing the configuration file, usually located at /etc/agent360.ini
. Add a new section to this file called [fridge] (same as the name value in your plugin file).
[fridge]
enabled = yes
Using configuration values
You might need to use configuration values in your plugin, for example an address to connect to.
These values can be stored in the /etc/agent360.ini configuration file. In the last example, we could add an address:
[fridge]
enabled = yes
location = http://192.168.0.100/fridge.json
We can now retrieve the configuration values in the plugin.
Require additional assistance?
Our dedicated Australian support team is ready to help. Reach out to us via email at [email protected] or by submitting a support ticket through your Zeniar Portal.