Mist Plugin
This server plugin monitors the status of devices registered in each zone of Mist Cloud.
- Introduction
- Compatibility Matrix
- Prerequisites
- Configuration
- Plugin execution and parameters
- How to create Mist apitoken
- How to know the "Organization ID"
- Configuration in Pandora FMS
- Modules generated by the plugin
Introduction
Ver. 130721
This plug-in is used to monitor devices registered in Mist Cloud.
It connects to the Mist cloud service to get data about registered zones and devices and sends this data to the Pandora FMS server from which it has been executed.
Type: Server plug-in
Compatibility Matrix
Systems tested | CentOS 7 |
Systems where it should work |
Any Linux operating system that has a Pandora FMS server installed. |
Prerequisites
To be able to execute this plug-in it's necessary:
- Pandora FMS Data Server enabled.
- Pandora FMS Plugin Server enabled.
- Account created in Mist
- APItoken created in Mist API (this documentation explains how to create it)
Configuration
Both the Data Server and the Plugin Server are enabled by default in Pandora FMS. However, if we would like to check that we have both servers enabled, or we are not sure, we can access to the Pandora FMS server configuration file, located in /etc/pandora/pandora_server.conf.
dataserver 1
pluginserver 1
Depending on the speed of the internet connection of the Pandora Server with the Mist API and the number of devices in your environment, the plugin can take more or less time to extract the necessary information. To avoid unnecessary timeouts, it is advisable to increase the value of the "plugin_timeout" token also in /etc/pandora/pandora_server.conf file to at least "20":
plugin_timeout 20
Once we've finished editing this file, we must restart the server service:
/etc/init.d/pandora_server restart
Plugin execution and parameters
The plugin needs execution permissions to be launched:
chmod +x pandora_mist
The execution and the parameters of the plugin are:
./pandora_mist -t <token> -o <org_id> [ -g <group> ] [ -p <prefix> ] [ --data_dir <data_dir> ]
Parameter | Description |
-h | Shows plugin help screen |
-t <token>, --token <token> | Mandatory. Mist API token |
-o <org_id>, --org <org_id> | Mandatory. Mist organization ID from which to extract the information of the zones |
-g <group>, --group <group> |
Group where agents created will belong. Default: Mist |
-p <prefix>, --prefix <prefix> | Prefix in the created agent names. Default: Mist |
--data_dir <data_dir> | Pandora FMS data directory. Default: /var/spool/pandora/data_in |
If the execution was successful we should see '1' data when running the plugin.
How to create Mist apitoken
APItoken is a mandatory parameter to authenticate in Mist API and that the plugin is able to extract the data to create the modules and agents.
Create a new apitoken
Being logged in your Mist account, open a new tab in the same browser and go to this url to launch "Getall Create Apitoken":
https://api.eu.mist.com/api/v1/self/apitokens
(url may depend of your region)
Press on "POST" button to create a new apitoken:
Show all apitoken created
To show all apitokens created, we can use the sale API call as we used to create them:
https://api.eu.mist.com/api/v1/self/apitokens
We will need "key" value of any working apitoken to use in our plugin.
How to know the "Organization ID"
The plugin extracts the data of all sites and devices registered in a Mist Organization. It is mandatory to send as parameter the "organization ID" of your Mist API account. If your environment has more than one Organization, it is necessary to launch the plugin one time for each of those organizations.
You can see your organization ID being logged in your Mist account and going to Organization>Settings:
On this screen you can find and copy the "Organization ID" just bellow "Organization Name":
Configuration in Pandora FMS
This is a server plugin distributed in pspz2 format, so the integration in Pandora FMS is very easy and can be done entirely from the console. It is necessary to download the file "mist-plugin.pspz2" from Pandora FMS library. With this file downloaded:
As default, the agents created by the plugin will be stored in a Group named "Mist". If you don't want to change that group, the first step is to create "Mist" group. It can be done in Profiles>Manage agent groups and clicking on "Create group":
With the "Mist" group created (remember that it is optional), go to Servers>Register plugin:
In this screen press on "Select file" and look for "mist-plugin.pspz2" file. After pressing on "Upload" button the server plugin must be created:
Now it is necessary to create the server plugin module that will launch the mist plugin and update the modules created by it in each time interval.
Go to modules view in the agent where you want to store and control this plugin launch module (or create a new agent to store the module). You can go directly to that view in Resources>Manage agents and Modules bellow the agent name:
On this Modules view select the Type "Create a new plugin server module" and press on Create:
On this Module creation view select:
-Name: [name desired for module plugin]
-Type: Generic boolean
-Plugin: Mist Plugin
After selecting "Mist Plugin" in the box, the fields "apitoken", "organization ID", "group", "prefix" and "data dir" will be loaded. Fill them with the data that you want, but remember "apitoken" and "organization ID" are mandatory for plugin execution and must be filled with the correct data of your Mist API:
After pressing on Create, the module that will launch the mist plugin will be created. If there is any problem with Mist connection or with the token, the value of the module will be "0" and will go to Critical. If everything is fine, the module value must be "1":
Modules generated by the plugin
If there is no connection error, the plugin will create an agent for each zone created in the Mist account that matches the org_id passed as parameter. For each one of those agents:
- The agent alias is: [prefix configured as parameter]_[site_name]_[site_country_code]
- The agent name is: [same prefix as before]_[site_name]_[site_country_code]_[site_id]
- The agent group is the configured as parameter (default "Mist")
Modules created will be:
Module name | Description |
Total devices connected | Total devices connected |
Total devices not connected | Total devices not in "connected" status |
[device_type]_[device_name]_[device_MAC] | IP: [device_ip]. Status: [device_status] |
A module will be created for each device that has each zone configured in the Mist Cloud, of boolean type and will be in "OK" status whenever its status is "connected".
The [device_type], [device_name] and [device_MAC] values are extracted directly from the Mist Cloud.