# Plugin Linode

# Introduction

Ver. 120521  
This plug-in is used to monitor instances in Linode.   
It connects to the Linode cloud service to get data about the running instances and sends this data to the Pandora FMS server from which it has been executed.  
Type: Server plug-in

# Compatibility matrix

<table id="bkmrk-systems-tested-cento"><tbody><tr><td>**Systems tested**

</td><td><span style="font-weight: 400;">CentOS 7</span>

</td></tr><tr><td>**Systems where it should work**

</td><td><span style="font-weight: 400;">Any Linux operating system that has a Pandora FMS server installed.</span>

</td></tr></tbody></table>

# Prerequisites

To be able to execute this plug-in you need:

- Pandora FMS Data Server enabled.
- Pandora FMS Plugin Server enabled.
- Account created in Linode
- Read token of the Linode API

# 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.

<span id="bkmrk--2">![](https://lh3.googleusercontent.com/v3Xj1aINq4t-G8kbcRC-A5Cae0IV-42hldP26JAK0_wguQcQRAo3bWRfOsHhaf8MtZ82-DVFnTUA7NSWS8tsRRpYkeH5I62jE4wnGKhqTK3kgH2JYw9s18lZuDsnu7SCAr2v9N1d)</span>

<span id="bkmrk--3">![](https://lh6.googleusercontent.com/zPyYJILD3-BeDXJCYP7gBBGVKb_-mZehLVvDe7nctb3YMwh7Jljr2mPgxBo5lb0sZszWpAiyQppVqcc25caeo_8J5yjhFOpdSG71MM2kYMDvioqw9O7vCsXxB8PwcZPqOx-6oiBw)</span>

<span id="bkmrk-once-we%27ve-finished--0">Once we've finished editing this file, we must restart the server.  
</span>

```
/etc/init.d/pandora_server restart
```

<span id="bkmrk--4">  
</span><span id="bkmrk--5"></span>

# General plugin parameters

```
./pandora_linode -t <token> [ -g <group> ] [ --data_dir <data_dir > ]
```

If the execution was successful we should see a '1' when running the plugin.

[![image-1621345536762.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621345536762.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621345536762.png)

# Plugin specific parameters

This plug-in has these four parameters:

<table id="bkmrk-parameter-descriptio"><tbody><tr><td>**Parameter**

</td><td>Description</td></tr><tr><td><span style="font-weight: 400;">-h, --help</span>

</td><td><span style="font-weight: 400;">Show help</span>

</td></tr><tr><td><span style="font-weight: 400;">-t TOKEN, --token TOKEN</span>

</td><td><span style="font-weight: 400;">Is **mandatory**. Used to enter the token to connect to the Linode service.</span>

</td></tr><tr><td><span style="font-weight: 400;">-g GROUP, --group GROUP</span>

</td><td><span style="font-weight: 400;">Pandora FMS target group</span>

</td></tr><tr><td><span style="font-weight: 400;">--data\_dir DATA\_DIR</span>

</td><td><span style="font-weight: 400;">Pandora FMS data directory. Default is /var/spool/pandora/data\_in/</span>

</td></tr></tbody></table>

# Configuration in Pandora

Ideally, to run any server plug-in, the plug-in should be located in the following path /usr/share/pandora\_server/util/plugin/

<span id="bkmrk--11">![](https://lh4.googleusercontent.com/VuZ8eeIh0DhpItogtX5OvoWXC-m9tFWJAOyC9cOOvCTcXo9P-XfFxBakFJ_rHuNMAbe-5dt2HEeWlPA23yshjjH9-k8QofJxYzYlEuMWxZkCXDqQ_fgou5mrRegjyy3_jA-O5EO3)</span>

<span id="bkmrk-once-this-is-done%2C-w-0">Once this is done, we must change the owner and permissions of the plug-in so that they can be executed by the server. To do this we use the following commands:</span>

```
chown pandora:root pandora_linode
chmod 755 pandora_linode
```

<span id="bkmrk--12">![](https://lh6.googleusercontent.com/fM5bgM4nO4lyUAwmJkE2nzt6cAuM98ElNlXxiIuimWoNHuR5pU7_awaF1S08B6-Hm7nLkeA_vPdakwZ0WF7rtWx1nUH4Jy_jnC8UZLUgANLr2WQX_8OPP8wXyWv4ppZM_RoBEg9W)</span>

<span id="bkmrk-it-should-look-like--0">It should look like this.</span>

<span id="bkmrk--13">![](https://lh6.googleusercontent.com/RlyWAzpH9iLZYV3uOxh6A5hlhfBn2Sd_any4utbJVfASomxZX71DgquurVr2p8VQbrRqAIoSQb8Ak3Vt4UljYPrPx6ZhNTZYhlqOD--dloRygtuimrwNVS1kACaE97MxtGpyWgjC)</span>

Next we will proceed to register the plug-in. In this case we will do the registration manually.

The first step is to access the console. In the Servers section we access the Plugins tab.<span id="bkmrk--14"></span>

<span id="bkmrk--15">![](https://lh4.googleusercontent.com/ZLwxESev5gA-M8rsx77RQVuJlDGvTfZrEarE5JMJEf_CirYgel7Q2Ifk1ntExG9MSgN5GxbEz2CxhZa-iw--rRL2xEW6rT5k9Q063SkynrdtrEnjzsTjXWSwbw1OmVurFOmxdkSi)</span>

In this tab will appear all the server plug-ins that are installed by default with Pandora FMS.

Click on Add.

  
<span id="bkmrk--16"><span id="bkmrk--17">![](https://lh6.googleusercontent.com/qsA_T3Zyae6qzjHvmih54i6UiVLGVqSDuMl7_XBCTfNQ7wb8iMm6O-MQYpVuyjB6o9KU54qlt0bYY7ZNFdZ2PQPXMSo1UAiu6H9bI_4ehOb_7TXxRzGn2Yy_Rwpx_6IUHa76AZwf)</span></span>

<span id="bkmrk-the-following-window-0"><span id="bkmrk-the-following-window-1">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.</span></span>

<span id="bkmrk--18">![](https://lh5.googleusercontent.com/Ut2FJMHz_gR46lR5DGHjfGxAyHkYTreKWNGTGzIO0S2-GInpwEQ3zdQpLqrMNTLfSSV2chJRbOyt3413a0sjNUQov-PGf2Bge8RJ1NZuE9m8UMuRZhERpXoYGRUy9pjUJkATZBuz)</span>

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.

<span id="bkmrk--19">![](https://lh6.googleusercontent.com/RE15rC1PxkhwVsxEXRGE4NIVbKYzKvfO8a1taN-1J5f522mzUhloTXBSc1wHhh_F7h0K8BBtrxYjNnZ9qx02YQ0xrtdeJGDVi45QZEzuKHY6RydzW6FTPs-4OUja3kTLi0fL4KJZ)</span>

<span id="bkmrk-finally%2C-if-we-have--0">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.</span>

[![image-1621346903209.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621346903209.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621346903209.png)

<span id="bkmrk-once-we-have-finishe-0">Once we have finished, click on Create.</span>

Next we are going to create a server plug-in module.

To do this we go to Resources &gt; Manage Agents and click on 'Modules'.

[![image-1621346963658.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621346963658.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621346963658.png)

Choose type 'Plugin server module' and click on Create.

[![image-1621347034187.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621347034187.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621347034187.png)

<span id="bkmrk-%C2%A0-1"> In the plug-in configuration section we can fill in several fields. Select the plug-in and add the token. As the fields group and data directory are defined by default, there is no need to modify them.</span>

[![image-1621347863700.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621347863700.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621347863700.png)

Once finished we click on Create.

If we have configured it well, the result will be as follows:

[![image-1621347382569.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621347382569.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621347382569.png)

# Modules generated by the plugin

As we have said before, to know if the plug-in has worked, the module must return a 1.

<span id="bkmrk--2">![](https://lh3.googleusercontent.com/M0-Xay7uyoBytBEXNDPPQImNQBKB1zSoYjXisKbYteifspGP8v99pJRyLKkdg7RrTAiNojInZs826oL95ee_KTd51bVQAV9zO_MGk-wy2StSdt9-fAlpapLxX3pKsH7Nl5WNQeWq)</span>

<span id="bkmrk-in-this-case%2C-the-pl-0">In this case, the plug-in creates several agents, one for each instance in linode, each with its corresponding modules.</span>

<span id="bkmrk--3">![](https://lh5.googleusercontent.com/tEvY8-aYbUdXy4WpKYicYDUKoXAt7LHKa5N98gNVBJGAqwIpXZjbWp4w3e-B5qZHlrXI-KSPyRZpQM2THOLZnAd4aRJ9Su9GpDq7uHexfHoX3er6UpBJ1QhgqixyrcbMdcg-BMJ-)</span>

Example of module listing within the agent 'Linode centos-eu-west'.

<span id="bkmrk--4">![](https://lh5.googleusercontent.com/2aAVronm2GaOWrbzYYMT8VVhbF2mF_gM-UHP0t_lOouPKWfc3Yqw3YD6J88JG9qA1WooPEi_QXMSqg7XG63KAtoLabS3yjdYSqMz9dwBuMunZJQ90A2KOL12WLLtoXH6BQxRSJpv)</span>

<table border="1" id="bkmrk-nombre-del-m%C3%B3dulo-de" style="border-collapse: collapse; width: 100%; height: 354px;"><tbody><tr style="height: 29px;"><td style="width: 50%; height: 29px;">**Module name** </td><td style="width: 50%; height: 29px;">**Description**</td></tr><tr style="height: 35px;"><td style="width: 50%; height: 35px;">CPU\_Load

</td><td style="width: 50%; height: 35px;">Percentage of CPU used</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Input/Output statistics IO</td><td style="width: 50%; height: 29px;">Blocks written</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Last Update</td><td style="width: 50%; height: 29px;">Last update date</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Linode Type</td><td style="width: 50%; height: 29px;">Instance size, image..</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Linode\_Status</td><td style="width: 50%; height: 29px;">Linode is running status</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Region</td><td style="width: 50%; height: 29px;">Instance location</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Running\_Status</td><td style="width: 50%; height: 29px;">Linode is running status</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Traffic netv4 in</td><td style="width: 50%; height: 29px;">Input stats for IPv4, measured in bits/s</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Traffic netv4 out</td><td style="width: 50%; height: 29px;">Output stats for IPv4, measured in bits/s</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Traffic netv4 private\_in</td><td style="width: 50%; height: 29px;">Private IPv4 input statistics, measured in bits/s</td></tr><tr style="height: 29px;"><td style="width: 50%; height: 29px;">Traffic netv4 private\_out</td><td style="width: 50%; height: 29px;">Private IPv4 output statistics, measured in bits/s</td></tr></tbody></table>