Pandora: Documentation en: Remote Monitoring

From Pandora FMS Wiki
Jump to: navigation, search

Go back to Pandora FMS documentation index

1 Remote Monitoring

1.1 Introduction

The Pandora FMS Network Server is an essential piece of Pandora FMS, because it allows remote checks to be conducted from a central point. The Data Server and the Network Server are conducting the tasks assigned to them through a multiprocess queue system. A network server can also work with other network servers, balance the load and act as a support device in case another network server fails, conducting the work the failing server was supposed to do. If you would like to know more about High Availability (HA) under Pandora FMS, please take a look at the chapter.

Our Network Servers only work with assigned network modules. Because there are network tests to perform, the Network Server should of course have complete visibility (IP addresses and ports) over the devices we're going to perform the tests on. It's completely futile to perform tests against a system with ports which can't be seen or for which we don't have the proper paths. The existence of firewalls (or the problems generated though the existence of these kinds of devices) or pre-existing paths in the network have nothing to do with Pandora FMS or with a specific configuration of it.

Remote-monitoring.jpg

1.2 Remote Network Modules

The Pandora FMS Network Modules conduct remote monitoring tasks. The remote execution of tasks can be summarized in three blocks:


ICMP Tests

These tests consist of whether a machine answers to a 'ping' ('remote_icmp_proc') or the latency of a system in milliseconds ('remote_icmp'). In both cases, the tests are conducted by the network server to which the agent which contains these network modules is assigned.


TCP Tests

In this test, we're going to remotely check if a system has opened the TCP port which was specified in the module definition. Additionally, a text string can be sent (using the string '^M' to replace the 'CR'). By receiving a response sub string, you're able to check if the communication is alright. This method allows easy protocol checks to be implemented. We can check if a server is 'alive' by sending the following string:

GET / HTTP/1.0^M^M

We suggest waiting a moment to be able to receive the '200 OK' string here.


SNMP Tests

It's possible to launch SNMP petitions remotely (called 'SNMP Polling') which are accessible and have activated SNMP services to obtain data like: 'state of the interfaces' and 'consumed network bandwidth by interface', etc. If you want to know more about SNMP, please consult the section for SNMP with Pandora FMS here.

Pandora 1.3 Network&DataServer Arch.png

In conclusion it's quite obvious that the network server is the one which conducts the different network tests assigned to each agent. Each agent is assigned to a Network Server - and it's this Network Server which executes the task and transfers the results to the DB of Pandora FMS.

1.3 General Configuration of a Module for Network Monitoring

To remotely monitor any kind of equipment or an equipment service (FTP, SSH, etc.), you're required to create the corresponding agent to monitor the service first.

Info.png

When talking about creating an agent, it is not referring to installing a software agent in the target machine, but to create an agent in the Pandora FMS interface.

 


Please go to the Pandora FMS section for console administration and click on Resources > Manage agents:



Anvi.jpg


In the following screen, please click on Create agent:

Bibi.jpg


Please enter the proper data to define your new agent and click on Create:

Raro.jpg


Once you have created the agent, please click on the drop down menu of the modules. Please select 'Create a new network module' in it and click on the Create button:

Sasa.jpg


Please select a network component module in the following form: Look for the check you need in the drop-down menu on the right. In this example, we've selected 'Host Alive' which represents a ping for the machine. It's a simple check to tell if the machine is connected to the internet or not.



Alive.jpg


We're going to leave the advanced options for later. Make sure the modules have obtained the agent's IP address. You're also able to enter a different IP address here. Once you have finished defining the module, press the Create button.

In the following screen, all modules for the agent are shown. On the picture below, you can see the preset Keepalive (which was created along with the agent) and the module 'Host Alive' added:

Kiji.jpg


As you can see, there is a warning attached to the modules. The warning only means that no data has been received by the module yet, because it's just been added a few moments ago. Once the modules begin to receive data, the warning disappears.

To see the data from the newly created module, just click on the 'view' button on the top right and look at the bottom where the data is going to appear if it starts to receive anything:

Keso.jpg

To perform another kind of network check, we suggest proceeding exactly as described above, but with a different kind of module.

1.4 ICMP Monitoring

The previous example was one of ICMP monitoring. These are the more basic and simple checks which give us important and precise information. There are two kinds of ICMP checks:

  • icmp_proc, host (ping) check which allows to come to know if an IP address responds or not.
  • icmp_data or latency check. It basically tells us the time in milliseconds it takes to respond to an ICMP basic query.

1.5 TCP Monitoring

The TCP check allows to check the state of a port or a TCP service.

There are two specific fields for TCP tests:


Tcpfields.JPG


By default, the TCP check is simply a test for whether the destination port is open or not. You're also able to send a text string and wait to receive something which will be processed directly as data.

It's possible to send a text string (using the «^M» string to replace the CR) and to wait if you're going to receive an answer substring to check whether the communication is functioning properly or not. This allows simple protocol checks to be implemented. If you want to check whether a server is alive or not, you may send the following string:

 GET / HTTP/1.0^M^M 

Then just wait to receive the string:

200 OK

This string is coded in 'TCP send' and 'TCP receive' fields.

TCP send

The field to configure the parameters intended to be sent to the TCP port. It accepts the '^M' string as a replacement for the sending of a CR. To send several strings in a row in a send/response manner, you're required to separate them by the character:

TCP receive

The field to configure the text strings which we expect to receive on the TCP connection. If they send/receive in several steps, each step should be separated by the '|' (pipe) character.

By means of the Pandora FMS TCP check, you're able to perform more things than just to inspect whether a port is open or waiting for an answer from a simple request or not. It's possible to send data, wait to receive something, to send something afterwards, wait to send something. Only if all the processes are conducted in the right way, are we able to validate the results.

To use the Pandora FMS Dialog and Response Checking System, you may separate the different petitions by the | ('pipe') character.

This is an example of an SMTP conversation:

R: 220 mail.supersmtp.com Blah blah blah
S: HELO myhostname.com
R: 250 myhostname.com
S: MAIL FROM: 
R: 250 OK
S: RCPT TO: 
R: 250 OK
S: DATA
R: 354 Start mail input; end with .
S: .......your mail here........
S: .
R: 250 OK
S: QUIT
R: 221 mail.supersmtp.com Service closing blah blah blah

If you want to check the first protocol points, the necessary fields to emulate this conversation would be:

TCP Send

HELO myhostname.com^M|MAIL FROM: ^M| RCPT TO: ^M

TCP Receive

250|250|250

If the three first steps are OK (code 250), then the SMTP is working properly. You're not required to send a complete mail here (but you could, in any case). This allows for protocol-based TCP checks which could be used for any protocol which utilizes plain text conversations.

1.6 SNMP Monitoring

1.6.1 Introduction to SNMP Monitoring

When we talk about SNMP monitoring, the most important thing is to separate the testing concepts (polling) and the traps. The SNMP testing means ordering Pandora to conduct a 'snmpget' command against an SNMP device such as a router or a switch (or even a computer with an installed SNMP agent). This is a synchronous operation (every X seconds). Receiving an SNMP trap, on the other hand, is an asynchronous operation (that might or might not happen in a million years). It's commonly used to receive 'alerts' coming from a device, e.g. if a switch knocks down a port or its fan is too hot.

To use the SNMP monitoring test, you're only required to add an SNMP module under Pandora which creates a new network module. The majority of the SNMP items which report data in the incremental way ('generic_data_inc'), e.g. when it asks for a value, it reports the 'global' quantity of information, if a total of bytes gets collected from the moment the device starts. This would be necessary to extract the last quantity of bytes known from the one which is working and gets divided by the seconds from the last known data. This dividing is going to provide the required data for displaying 'bytes per second' display. This operation is done with Pandora using generic data inc.

Using the SNMP Traps is something completely different. It's possible to receive traps from any device without the necessity of configuring anything (except the SNMP console). If a trap gets received, it's going to appear on the SNMP console.

It is possible to define an alert, based on OID (the code that identifies a trap, something similar to 3.4.1.1.4.5.24.2), in an IP agent or in a custom data (data that could be in the trap). It is also possible to order Pandora to copy the information in a special text module in the agent. If the agent is defined, this operation is called SNMP Traps transfer.

Pandora FMS is able to work along with any device that supports SNMP. It currently works with SNMP versions 1, 2, 2c and 3.

Pandora FMS works with SNMP using individual OIDs, where each OID is a network module for it. If we want to monitor a 24-port 'Cisco Catalyst' switch and to learn the operating system and the entry and exit port, we're required to define a total of 72 modules (24 x 3).

To work with SNMP devices, you're required to know the following:

  • What the SNMP Protocol is and how it works. The published RFC3411 from the IETF describes it in detail here: https://www.ietf.org/rfc/rfc3411.txt
  • The IP and the SNMP community of the remote device.
  • To activate the device's SNMP management so we're able to perform SNMP queries from the network server.
  • The specific OID of the remote device which we want to check.
  • How to manage the data that's going to get returned by the device. The SNMP devices usually return data in different formats.

This network server should be the one assigned for the agent if we're going to define the network modules. You also need to keep in mind that, if we want other network servers to do queries (in case the assigned server fails), they're going to perform the queries with other IP addresses.

Pandora FMS could manage almost all of them, except the 'timetick' that gets managed as a numeric format without converting it to date / hour. Pandora FMS manages counters of the 'data' kind as 'remote_snmp_inc'. They are of special importance, as they are counters which can't be considered numeric data. The majority of the SNMP statistical data are of the 'counter' kind and it's necessary to configure them as 'remote_snmp_inc' if you want to monitor them properly.

1.6.2 Monitoring by Network Modules with SNMP

To monitor any element through SNMP, we should at least know its IP and its SNMP community. It would also be quite important to know the OID which we want to monitor, although we could obtain it by means of an SNMP Walk as long as we know where each OID comes from. To monitor an element through SNMP, you first have to create an agent for it. If you already have one, simply add a new network module and follow the previous instructions.

Once the module has been created, you should select an SNMP data type in the configuration module form just like the ones shown on the image:

Cap5 snmp 1.png

Any of the three SNMP data types are valid. Simply select the one which coincides with the type of data that you want to monitor.

Once you have selected an SNMP data type, the form is going to expand, showing additional fields for SNMP like the following:

Cap5 snmp 2.png

Next, you're required to define the fields:

SNMP community

The SNMP community is necessary to monitor the element. It acts as a password.

SNMP version

The SNMP protocol version of the device. It could be 1, 2, 2c or 3.

SNMP OID

The OID identifier to monitor. They can consist of numeric values. The alphanumeric values are internally transformed into numeric values by the system (which are the ones used to do the petition) by means of a dictionary called MIB.

An alphanumeric OID can be similar to this one:

  iso.org.dod.internet.private.transition.products.chassis.card.slotCps.cpsSlotSummary.cpsModuleTable.cpsModuleEntry.cpsModuleModel.3562.3

The numeric equivalent would be something like this:

  1.3.6.1.4.868.2.4.1.2.1.1.1.3.3562.3

Without the MIB, the alphanumeric format is invalid. Installing an MIB on the system is not a trivial thing, so it's recommended to work with numeric identifiers directly, although it's a little more cryptic. The above shown is much more portable and it also doesn't create any problems for you, because it doesn't require MIBs.

Pandora FMS includes some OIDs in its database which could be used directly. If you are going to create the module, select the 'Cisco MIBs' component to show a list of the available MIBs for Cisco devices:

Cap5 snmp 4.png

Once you have selected the proper component, you're able to pick the available MIB for it:

Cap5 snmp 5.png

By doing this, the fields will be filled out by the necessary information.

There are more MIBs included in Pandora FMS. With Enterprise Version, there are several included MIB packages for different devices. Once you have introduced the data, please click on the Create button.

To see the data of the module which has been just created, just click on the upper flap named View and take a look at the bottom of the page, where the data is going to be shown once it starts to receive any.

Cap5 snmp 6.png

To see the text string kind data of the modules from the system description example, please go to the upper right flap named Data.

Cap5 snmp 7.png

1.6.3 SNMP Monitoring from Agents

Windows software agents have a utility for obtaining SNMP information. In Unix/Linux snmpget agents is usually available, so it can be called from the module_exec line.

We have added the utility 'snmpget.exe' to the Windows agent by default (which is part of the 'net-snmp' project and comes with a BSD license). We've also added the basic 'MIBs' and a wrapper / script to wrap the call into the 'snmpget.exe' utility.

Using this call, we're able to monitor SNMP from an agent, obtaining information from any remote system to which the agent has access to, so we're able to work as a 'satellite agent' or 'proxy agent' (just as the manual says).

Under Windows, the syntax for the execution is:

module_exec getsnmp.bat <comunidad_SNMP> <ip de destino> <OID>

Some examples of SNMP modules executed by Windows agents are:

module_begin
module_name SNMP_if3_in
module_type generic_data_inc
module_exec getsnmp.bat public 192.168.55.1 .1.3.6.1.2.1.2.2.1.10.3
module_end
module_begin
module_name SNMP_if3_desc
module_type generic_data_string
module_exec getsnmp.bat public 192.168.55.1 IF-MIB::ifDescr.3
module_end
module_begin
module_name SNMP_Sysup
module_type generic_data
module_exec getsnmp.bat public 192.168.55.1 DISMAN-EVENT-MIB::sysUpTimeInstance
module_end

The same examples, executed under UNIX agents:

module_begin
module_name SNMP_if3_in
module_type generic_data_inc
module_exec snmpget -v 1 -c public 192.168.55.1 .1.3.6.1.2.1.2.2.1.10.3
module_end
module_begin
module_name SNMP_Sysup
module_type generic_data
module_exec snmpget -v 1 -c public 192.168.55.1 DISMAN-EVENT-MIB::sysUpTimeInstance
module_end

It's important to remember that only the 'basic' OIDs are translatable for their numerical equivalent. It's advisable to always use numerical OIDs, because we don't know if the tool would otherwise be able to translate it or not. In any case, the MIBs can always be obtained in the '/util/mibs' directory under Windows or in '/usr/share/snmp/mibs' under Linux.

1.6.4 Pandora FMS SNMP MIB Browser

We can access the SNMP explorer through the Monitoring > SNMP > SNMP Browser menu.

The first thing you have to understand is that Pandora FMS makes a complete path of the device tree, so if it is big (like a switch) this operation can take several minutes. We can also choose to explore only one sub-system, which will save us a lot of time.

For example, to get the CISCO information only, you could explore your cisco sub-mib enterprise starting with:

 .1.3.6.1.4.1.9

The browser is used to navigate, which means clicking on each tree and sub tree to arrive at the last piece of information on the branch, which is a sole OID with a single value. Click the 'eye' icon to get the value of the OID. The system will try to locate the description and human-readable OID translation if the MIB for that branch is available. If you don't have an MIB available, the only thing you're able to see is the numerical OID information, value and data type.The descriptive information is stored in MIB files. If you want to know more on this topic, please follow this link [1]. If you don't have an MIB for the device you intend to browse, you probably have to 'dig search' in the values - which is pretty complex and takes a lot of time.

The Pandora FMS SNMP MIB Browser allows you to search for a text string or numerical value in the OID's values and also the translated OID's (if available). It could be very helpful to be able to search for known values to identify the matching OID value. If there are several matches, you're able to browse in them. Matches are displayed in yellow.


Snmp browser module creator.png


From the SNMP browser, you can create a network component for later reuse.

Snmp browser from module creation.jpg

From the SNMP module editor, when we create or edit a network module, we can launch the SNMP browser by clicking on the "SNMP Browser"button, which will open it in a floating window. Once we have chosen the OID we are looking for, by clicking on the icon of the hand with the finger pointing downwards, we will choose that OID and we will pass it to the corresponding field of the module definition, automatically, for its use with Pandora FMS.

1.6.4.1 MIB Management

Through Pandora FMS we can upload and manage the MIBS to be able to add new mibs or delete the ones that do not interest us. These Mibs will be used only by Pandora, which will also use the operating system (in /usr/share/snmp/mibs). Pandora FMS will use the path {PANDORA_CONSOLE}/attachment/mibs to store the mibs.

New snmp browser mibmanager.png

It is important to note that Pandora's mibs manager only manages the "polling" mibs that have nothing to do with SNMP traps mibs. For this functionality there is another manager, exclusive to the Enteprise version of Pandora FMS.

1.6.5 Pandora FMS SNMP Wizard

In the agent management view, there is a set of tools specifically created to remotely create modules: The Agent Wizard.

Agent wizard.png

1.6.5.1 SNMP Wizard


Agent wizard snmp wizard.png


You're required to set up the IP target, the community and other desired parameters (SNMP v3 is supported) to make an SNMP-Walk to the host.


Snmp wizard form.png


Once the data is correctly retrieved, a form for module creation is going to appear:



Snmp wizard module creator.png



It's possible to create modules from the following kinds of SNMP data by the SNMP Wizard:

  • Devices
  • Processes
  • Free Space on Harddrives
  • Temperature Sensors
  • Other SNMP Data

You may select the kind of module and put the desired elements from the left combo to the right one. When you've completed this process, please click on the 'Create modules' button.

This wizard is going to create two kinds of modules:

  • SNMP Modules for the data with a static OID (sensors, memory data, CPU data, etc.).
  • Plugin Modules for the data with dynamic OID or calculated data (processes, disk space, used memory in percentage, etc).


Template warning.png

For plugin modules we will use the remote SNMP plugin. So if the plugin is not installed in the system, these features will remain disabled. The plugin must be named "snmp_remote. pl". The location where it is hosted will not matter.

 


1.6.5.2 SNMP Interface Wizard

Agent wizard snmp interfaces wizard.png

In the Agent Wizard, there is an SNMP wizard specifically created for browsing interfaces.

This Wizard browses the SNMP branch IF-MIB::interfaces, offering the possibility of creating multiple modules of various interfaces with multiple selections.


Like the SNMP Wizard (after selecting the IP target, community, etc.), the system conducts an SNMP query on the host and fills out the module creation form.


Select one or more interfaces from the left combo. After that, the common elements available to them (e.g. description, speed, inbound / outbound traffic, etc.) are going to appear on the right. You're able to select one or more elements of this combo and click on 'Create modules' to create these modules for each selected interface in the combo on the left.

Agent wizard snmp interfaces creation.png

1.7 Common Advanced Features of Network Modules

The following screen shows the advanced features for the network module configuration:


Cap5 snmp 8.png


Description

Module description. There is already a default description which we could change.

Custom ID

Custom identifier which is necessary if you wish the server to send multicast messages with information about agents. You can also use this field to integrate Pandora FMS data into an external information system like a CMDB.

Interval

The module's execution interval. As shown in the example, it could be different from the agent's interval.

The values shown depend on those configured in the section "Settings > Visual Styles" in the "Interval Values" section.

An administrator user will be given the possibility to define a custom interval at the time of creating or editing a module, standard users will only be able to define previously configured intervals, displaying the default ones when not being defined in "Visual Styles".

Post Process

The module's post processing. It's useful to multiply or divide the returned value, e.g. when we obtain bytes and we want to show the value in Megabytes.

Min. Value

The module's minimum value. Any value lower than the one defined here will be considered 'invalid' and ruled out.

Max. Value

The module's maximum value. Any value higher than the one defined here will be considered 'invalid' and ruled out.

Export Target

It's useful to export the values returned by the module to an Export Server. It's available in the Pandora FMS Enterprise Version only, and could come in pretty handy if we have configured an export server in advance of this. Check the section on the export server for more details.

CRON

If Cron from is set, the module will be run once when the current date and time match the date and time configured in Cron from, ignoring the module's own interval. For example, the following configuration would cause the module to be run every Monday at 6:30:

Cron from ex1.png

If both Cron from and Cron to are set, the module will be run once when the current date and time fall between the date and time configured in Cron from and the date and time configured in Cron to, ignoring the module's own interval. For example, the following configuration would cause the module to be run everyday between 6 and 7:

Cron from ex2.png

For local modules, the corresponding module_crontab line is added to the agent's configuration file. See Programmed Monitoring for more information.

Timeout

Time in seconds the agent is going to wait for the execution of the module.

Category

This categorization has no effect on the normal user interface, it is intended to be used in conjunction with the meta console.

1.8 Windows Remote Monitoring with WMI

WMI is a micro system for remote information of computers running Windows OS, it is available from Windows XP version to the most current versions. WMI allows you to get all kinds of information from OS, applications and even hardware. WMI queries can be made locally (in fact, Pandora's agent does it internally, calling the API of the operating system and asking the WMI subsystem) or remotely. In some systems, remote access to WMI is not enabled and must be enabled in order to be consulted from the outside.

Pandora FMS allows remote monitoring of Windows equipment through WMI queries. To do this it will be necessary to enable the component wmiserver in the configuration file of Pandora FMS server.

# wmiserver : '1' or '0'. Set to '1' to activate the WMI server in this setup.
# DISABLED BY DEFAULT
  wmiserver 1

Queries are made in WQL, a kind of Microsoft-specific SQL language for internal queries to the operating system, and any query that appears in the WMI system database can be made.

To start monitoring by WMI, first you must create the corresponding agent, and once ready click on the top flap of the modules (Modules). In it, select to create a new WMI module and press the Create button.:



Feo.jpg


Some fields are WMI specific and require a short explanation:

Namespace

Space for WMI names. This field is different from 'empty string' by default and depends on the information source of the application we intend to monitor.

Username

Name of the Administrator or any other user which possesses the privileges to remotely execute WMI queries.

Password

Password for the Administrator or any given user.

WMI Query

WMI query. It's very similar to a sentence in SQL, e.g.:

SELECT LoadPercentage from Win32_Processor WHERE DeviceID = "CPU0"
SELECT SerialNumber FROM Win32_OperatingSystem
SELECT AvailableBytes from Win32_PerfRawData_PerfOS_Memory
SELECT DiskWriteBytesPersec from Win32_PerfRawData_PerfDisk_PhysicalDisk WHERE name = "_Total"

Key String

Optional field to compare the returned query with a string. In case it exists, the module is going to return either '1' or '0' instead of the string itself.

Field Number

The number of the returned field, starting from 0 (the WMI queries are able to return more than one field). Most of the time, the value is 0 or 1.

Please fill out the required fields as shown below:

Campos.jpg

If you do not know the exact parameters, you're also able to select one of the preinstalled ones included in the Pandora FMS Database. Please select the WMI module component for it:

Galleta.jpg

After you've done that, please select a WMI check from one of the available ones:

Galletita.jpg

The required information is filled in automatically, except for the user and it's password. Please remember that only users with administration permissions and their passwords are valid here. The module is also unable to return any value:



Otro.jpg


The Pandora FMS Enterprise version owns more than 400 WMI Remote Monitoring Modules for Windows. They're available for the following devices and components:

  • Active Directory
  • BIOS
  • System Information
  • Windows Information
  • Printers
  • MSTDC
  • IIS
  • LDAP
  • Microsoft Exchange

1.8.1 WMI Wizard

Under the Agent Wizard feature shown on the picture below, there is a WMI wizard which is intended to browse in and to create modules with WMI queries on a specified agent:



Agent wizard wmi wizard.png



You will need to specify the Administrator (or a user with WMI query permissions) user and password on the target server to make the first WMI queries. This information will be used to create modules.

Wmi wizard module creator.png

It's possible to create modules from various kinds of WMI data by the WMI Wizard:

  • Services: Creates boolean monitors in 'normal' status if the service it's running and on 'critical' when it's stopped.
  • Processes: The processes monitor is only going to receive any data if the process is active, otherwise it's going to take the 'unknown' status.
  • Free space on disk The available space on the harddrive.
  • WMI components: You're able to choose from the WMI components registered on the system (it's under 'Administration' -> 'Manage modules' -> 'Network components').

1.9 Monitoring with Plug Ins (Server Plugin)

This type of monitoring consists in the execution of plugins remotely from Pandora FMS server against other systems. Installations come with several server plugins by default ready to use, and the user can always add as many as needed.

A remote plugin is a script or executable that supports parameters and returns a value. Through a plugin you can implement any type of operation yourself, and through a few input parameters, customize, as you want that application you have developed to behave. This would allow you, for example, to pass the target IP of the test as a parameter. The result could be a number, a boolean value (0 error, > 0 OK), or a text string. The only limitation of remote plugins is that they can only return a single value.

To register a plugin in Pandora FMS, we will go to the administration section of the console, and in it, click on Manage servers; then click Manage plugins:



Verdecito1.jpg





Verdecito2.jpg


From this screen you can see that you already have a few plugins registered. You can also register your plugin manually here. To explain how it works, let's go to see a plugin already registered, click on the one called "UDP Plugin" that allows to make a test of UDP connectivity against a remote machine.

Plugin create 1.jpg


Plugin Type

There are two types of plugins: standard (standard) and Nagios plugins. Standard plug-ins are scripts that execute actions and support parameters. Nagios add-ons are, as its name indicates, Nagios add-ons that can be used in Pandora FMS. The difference is mainly that nagios plugins return an error level to indicate if the test was successful or not and an additional descriptive string. This description is not a numerical value that can be used as a module value, so in this case we will use it to update the module description.

In this case (for the example plugin, UDP port check), we will select Standard as it is not a Nagios plugin.

Max. Timeout

The expiration time of the plugin. If you don't receive a response within the specified time, it's recommended to select the module as 'unknown', because then its value is not going to get updated. It's a very important factor when implementing monitoring with plug ins. If the plug in execution time is longer than the specified value, we would never obtain data with it. This value is recommended to always be higher than the time it (usually) takes to return a value of the script or executable which is used as a plug in. If there is no preconfigured value, it's recommended to use the same value which can be found under plugin_timeout in the configuration.

Info.png

In the execution of a plugin there are three timeouts: server, plugin and module. Please note that the server prevails over the others, and secondly, the plugin. That is, if you have a server with a 10-second timeout and a plugin with a 20-second timeout and a module that uses that plugin with a 30-second timeout, the maximum time to wait for the execution of that module will be 10 seconds.

 


For our example, we're going to take the value of '15'.

Description

Description of the add-on. Write a brief description, such as: Check a remote UDP port (by using NMAP). Use IP address and Port options. The description is not trivial, as it will be shown in the user interface of the plugin. Make sure it explains what the plugin is for.

Plugin create 2.jpg

Plug-in Command

Path to the plugin executable. By default, if the installation has been standard, they will be in the directory /usr/share/pandora_server/util/plugin/. Although it could be any route in the system. In this case, type /usr/share/pandora_server/util/plugin/udp_nmap_plugin. sh in the field. If you use your own plugin, make sure that you know the path where you left the plugin and that you have run permissions (chmod 755).

Plug-in parameters

A string with the plugin parameters, which will go after the command and a blank space. This field accepts macros such as _field1_ _field2_... _fieldN_. This is where the most complex part of a plugin's operation is, don't panic, we will see it with an example.

Parameter Macros

Unlimited macros can be added for use in the plugin parameters field. These macros will appear as text fields in the module configuration so that the user abstracts the complexity of using a plugin module. It is about the user using a plugin as if it were a "library" module in which he fills in fields, without having to know how it works underneath. Macros definition allows the user to fill in the script call parameters without knowing how it works, neither the script nor the way to call it.

Each macro has 3 fields:

  • Description: A short string describing the macro. It's the label next to the field.
  • Default value: The default value assigned to the field.
  • Help: A text with an explanation of the macro, to show some examples of use or better explain what that field is for.

An example of a macro configuration:




Macro configuration.png



An example of this macro in the module editor:



Macro editor2.jpg



Internal Macros

Like the alerts, it's possible to use internal macros in the plug in configuration, too.

The supported macros are:

  • _agent_: Complete agent's name which fired the alert.
  • _agentdescription_: Description of the agent to which the module belongs.
  • _agentstatus_: Current status of the agent to which the module belongs.
  • _address_: Address of the agent to which the module belongs.
  • _module_: The module's name.
  • _modulegroup_: The module's group name.
  • _moduledescription_: A description of the module.
  • _modulestatus_: The status of the module.
  • _moduletags_: The module's associated tags.
  • _id_agent_: The ID of the agent. It's quite useful to generate a direct URL to redirect to a Pandora FMS console webpage.
  • _id_module_: The module's ID.
  • _policy_: The name of the policy the module belongs to (if that applies).
  • _interval_: The execution interval of the module.
  • _target_ip_: The target IP address of the module.
  • _target_port_: The target port number of the module.
  • _plugin_parameters_: The plug-in parameters of the module.
  • _email_tag_: The emails associated to module tags.


1.9.1 A remote plugin from the inside

The UP plugin code is extremely simple and helps us to explain how the whole process works:

#!/bin/bash
# This is called like -p xxx -t xxxx
HOST=$4
PORT=$2
nmap -T5 -p $PORT -sU $HOST | grep open | wc -l

This Linux plugin takes two parameters, the UDP port to test and the destination address, with the -p and -sU parameters respectively. When registering the plugin we have defined two macros, one for the port and another for the IP so that when the user is going to create a plugin module only see that, nothing else.

Once the plugin has been registered, in order to use it in an agent, you must create a plugin server module, click on the top tab of the modules ("Modules"). In it, select create a new network module and click the Create button:


Trescientos1.jpg

In the following form, fill in the empty fields, select the module type Generic module to adquire numeric data, specify the IP address against which to perform the analysis, and also the port on which to do it:



Example1 edition module.png


Once you have finished, press the Create button.

The following screen will show the modules for the agent, the "UDP Port check" module that we have just created:



Udp port check demo.jpg



1.9.2 Example #1 : Plugin Module for MySQL

This is another more complex example on how to implement a plugin. It's another plugin that comes by default with Pandora FMS. In this case, it's the MySQL check plugin.

First, create a plugin module ('Administration' -> 'Manage Servers' -> 'Manage plug ins') for MySQL by using the following data:

  • Name: MySQL
  • Plugin type: Standard
  • Max. timeout: 10 seconds
  • Description: MySQL check plugin
  • Plugin command: /usr/share/pandora_server/util/plugin/mysql_plugin.sh
  • Plugin parameters: -s _field1_ -u _field2_ -p _field3_ -q _field4_
  • Macro _field1_:
    • Description: IP Address
    • Default value: X.X.X.X
  • Macro _field1_:
    • Description: User
    • Default value: User
  • Macro _field1_:
    • Description: Password
    • Default value: Password
  • Macro _field1_:
    • Description: Check
    • Default value: Connections
    • Help: Possible values: Connections/Com_select/Com_update/Innodb_rows_read

When it's ready, the plugin is going to look like this:

Plugin mysql1.png
Plugin mysql2.png
Plugin mysql3.png
Plugin mysql4.png

This plug in provides four checks:

  • -q Connections: Connections
  • -q Com_select: Number of select queries from start
  • -q Com_update: Number of update queries from start
  • -q Innodb_rows_read: Innodb file readings

Create a module in the agent of the computer where Pandora FMS is installed and assign it; its name will be Mysql Connections, using as plugin "MySQL", as IP localhost, as pandora user, as password the password of Pandora's database, and as check the word Connections.

After it's creation, the module has to look like this:



Plugin mysql module.png
Mysql module2.png


Once created, it will appear in the list of modules, as a plugin type module (in this case, pending initialization)



Fosforo3.jpg


1.9.3 Example 2 SMTP Server Remote Plugin Module

This plugin sends an email using a remote server, you can specify server IP, port, user and password and authentication scheme, as well as destination email and destination email. Returns 1 if it works and 0 if it fails, that is, it should be used using generic_proc type.

This is a screenshot of the module definition using this plug in:



Pandora plugin SMTP5.png
Smtp module2.png


1.9.4 Example 3 - DNS Server Remote Plug In

This plug in checks the IP address of a specified domain (eg artica.es). This is a fixed IP, using an external DNS as reference. You're able to validate whether the domain is returning the correct IP address to avoid unnecessary balancing, DNS attacks, etc. in this way. It returns the value of '1' if it works properly and '0' if not. The plugin is required to be of the 'generic_proc' type.

This is a screen shot of the module definition using this plug in:



Pandora plugin DNS5.png
Dns module2.png


1.10 Remote network test execution (Exec Server)

This feature allows some actions to be run on Pandora remote servers from the Pandora Console. Thus, allowing the use of the Wizards SNMP agent, and MIBs browser and the 'event responses' from a remote server, as well as accessing it from the server where the console is.

Internally, it works through SSH remote command execution from the Pandora console to the enabled servers, which we will call “Exec Server”. These servers can be Pandora or Satellite Servers, but always in Linux.

1.10.1 Configuration

For this feature we need to configure the system by following a series of steps:

1. In the server list in PandoraFMS, we must access the server edition we want to use as proxy:



Exec-server-1.jpg

2. We edit the IP of the server where we will launch the desired commands and activate the verification of “Exec Server”. This option can be configured on the Network Server and / or Satellite Server.

3. We do not perform the test configuration because we have not finished configuring the system and it would give us an error message.



Exec-server-2.1.png

4. We enable the server where the Pandora console runs so that the “apache” or equivalent user has a shell execution. We modify the file /etc/passwd and modify the line so that the user has a valid shell, for example:

apache:x:48:48:Apache:/var/www:/bin/bash

5. We create the “.ssh” directory in the route “/var/www/” and give permission for the “apache” user:

mkdir /var/www/.ssh
chown apache /var/www/.ssh

6. We will execute as root:

su apache

7. We will generate the SSH key for the connection to the remote machine. We execute the command:

ssh-keygen 

And we accept any questions that it might ask us by clicking “enter”:



Exec-server-3.jpg

8. Before accessing to "Exec server” by SSH (which will be a Pandora server or a Linux server satellite), we must create on that machine, a specific user, called “pandora_exec_proxy” and also create the folder “/home/pandora_exec_proxy/.ssh/”:

sudo useradd pandora_exec_proxy -m
mkdir /home/pandora_exec_proxy/.ssh/

NOTE: The user does not have a password, so that it cannot be used to remotely connect.

9. We will copy the contents of the public key ", generated in the previous step, from the Pandora console to the server “exec server”. In order to do this, we will copy the contents of the file /var/www/.ssh/id_rsa.pub and we move it (by copying and pasting that content) to the file: /home/pandora_exec_proxy/.ssh/authorized_keys'' and we change the permission of that file:

chown -R pandora_exec_proxy /home/pandora_exec/.ssh/

10. Once the user is created, from the machine, which is running the console, and the “apache” user, we will manually execute the following command to verify that you can enter without introducing a password (substituting the IP for the hostname/IP from Exec server which we have configured in previous steps)

 ssh pandora_exec_proxy@ip_address

11. When all these steps are correct, we will edit (in the console), the file /etc/pass in order to leave the apache user as it was originally (without local shell):

apache:x:48:48:Apache:/var/www:/sbin/nologin

12. Finally, we just need to test the configuration in the editing section of our proxy server, within the Pandora console, and if the test indicator turns green, it will be fully operational and functional.



Exec-server-4.png

1.10.2 Using the exec servers feature

From now on, in the MIB browser, in the SNMP wizard of agent and the event responses we can choose from where we will launch the petition, whether from the local console or from the configured Exec server:



Exec-server-5.png

And the same goes for the WMI Wizard, the SNMP interfaces and wizard of SNMP agent (not available for satellite servers)



Exec-server-6.png

Depending on the selected server when launching the Wizard, modules adapted for satellite server or server will be created

For the executions of “event response” first we must configure a new event response, that uses our new exec server:



Exec-server-7.png

And then from an event, we launch it:



Exec-server-8.png

1.11 Path monitoring

Pandora FMS offers by default the monitoring of complete routes between two points of the network, visually indicating the path that is being followed at all times to communicate between these two points.


To use this system we need:

  • A software agent at the point of origin of the route we want to analyze
  • To be able to reach the destination point via ICMP from the point of origin.


The Pandora FMS path analyzer uses an agent plugin to map the route. This agent plugin uses several methods to collect information, reporting structured information to Pandora's server.

Note: Optionally, if you want to scan routes over the Internet, we recommend that you deploy the mtr application on your route source computer. More information at:

https://en.wikipedia.org/wiki/MTR_%28software%29

http://www.bitwizard.nl/mtr/


1.11.1 Configuration

A partir de la versión 7.0 OUM715, el plugin viene incluído dentro del agente. Para configurarlo deberá activar la ejecución del plugin desde la consola de Pandora FMS, una vez habilitada la configuración remota del agente.


Access the plugin configuration tab in your agent and add the following line (if the agent version is earlier than 7.0 715, or if you have not deployed the plugin in the utility folder, you must specify the full path to the plugin to run it)

route_parser -t target_address

Where target address can be a v4 IP address or an FQDN domain name.



Route conf2.png



1.11.2 Visualization

Once the system is configured and reporting, a new tab will appear in the agent view with the path communications have followed to reach the target:

Sample route view to a machine on a network other than the source network (LAN connections)


Route view1.png




Sample route to 8.8.8.8.8 example view (Google's DNS) (WAN connections)


Route view2.png




Go back to Pandora FMS documentation index