Google Cloud Platform Compute Engine

This document describes the Google discovery functionality of PandoraFMS.

Introduction

The purpose of this plugin is to monitor instances and areas of Google Cloud, using key metrics related to the CPU, networks, IOPS and disks that are essential to control and monitor these machines and to guarantee optimal performance, solve problems, plan scaling. , comply with SLAs and improve security.

The plugin connects to the Google API and monitors zones and instances using the aforementioned metrics, generating an agent for each zone and instance via XML that is sent to the Pandora server.

Compatibility matrix

Systems where it has been tested Rocky linux, Fedora 34
Systems where it works Any linux system

Prerrequisites

image.png

Parameters and configuration

Parameters

--conf Path to configuration file

 

Configuration file (--conf)

agents_group_name = < Name of the target group for the created agents >
threads = < Number of execution threads, each zone/instance will be equally distributed in the number of threads >
interval = < Interval in seconds for agents and for metric analysis >
transfer_mode = < Transfer mode, tentacle or local >
tentacle_ip = < IP of the target machine for the created agents >
tentacle_port = <tentacle port, default: 41121>
tentacle_opts = < Tentacle client additional options >
data_dir = < (Only activated if the transfer_mode is local) Destination path for the XML of each agent, by default "/var/spool/pandora/data_in/" >

advance_monitoring = < Activate with 1 to enable generalized monitoring (these modules will only be created in the agents of the instances that are running) >
cpu_summary = < Enable with 1 to enable CPU monitoring >
iops_summary = < Enable with 1 to enable IOPS monitoring >
disk_summary = < Enable with 1 to enable disk monitoring >
network_summary = < Enable with 1 to enable network monitoring >

stats_agent = < Activate with 1 to enable a global agent that will monitor based on the task created and the parameters used >
stats_agent_name = < Name for the agent that is activated with the "stats_agent" parameter. If you do not use and "stats_agent" is enabled, the agent will be called "Google Cloud Platform" by default >

gcp_zones = < List with the zones to monitor (when a zone is marked for monitoring, it automatically monitors all the instances found within that zone) >
gcp_instances = = < List with the instances to monitor >

creds_b64 = < Base64 credentials in the JSON file to authenticate >

Example

agents_group_name  = google
threads            = 5
interval           = 300
transfer_mode      = tentacle
tentacle_ip        = 172.42.42.101
tentacle_port      = 41121
data_dir           = /var/spool/pandora/data_in/

general_monitoring = 1
cpu_summary        = 1
iops_summary       = 1
disk_summary       = 1
network_summary    = 1

stats_agent        = 1
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ugin execution format is as follows:

./pandora_gcp_ce --conf < path to configuration file >

 For example:

./pandora_gcp_ce --conf /usr/share/pandora_server/util/plugin/gcp.conf

The execution will return an output in JSON format with information about the execution, and will generate an XML file for each monitored agent that will be sent to the Pandora FMS server by the transfer method indicated in the configuration.

For example:

{"summary": {"Total agents": 35, "Zones agents": 5, "Instances agents": 29}}

 

Discovery

This plugin can be integrated with Pandora FMS Discovery.

To do this, you must load the ".disco" package that you can download from the Pandora FMS library:

https://pandorafms.com/library/

image-1687944693011.png

Once loaded, Google Cloud Platform Compute Engine environments can be monitored by creating Discovery tasks from the Management > Discovery > Cloud section.

image-1687944745498.png

For each task, the following minimum data will be requested:

image-1687440491348.png

If the credentials provided are correct and the Pandora FMS server is able to connect to the Google Cloud API, you will be able to see a tree with the Google Cloud Platform Compute Engine zones and instances, which can be marked for monitoring.

If a zone is selected, in addition to the zone itself, all the instances it contains will be monitored (both at the time of configuring the task and later if new instances are included).

If specific instances are selected, they will be monitored regardless of whether their zones have not been selected.

image-1687180264851.png

Finally, you can adjust the monitoring you want to obtain for each agent:

image-1686144866168.png

Tasks that are successfully completed will have an execution summary with the following information:

image-1686144889338.png

The tasks that are not completed successfully will have an execution summary recording the errors produced.

Agents and modules generated by the plugin

Running the plugin will create the following agents and modules:

<Name used with the parameter "stats_agent_name" or failing that "Google Cloud Platform" >

modules

GCP CE Instances count Number of total instances monitored by the plugin
<Zone name>


modules

summary.google.compute engine.CPUUtilization  Average CPU percentage used for instances in this zone
summary.google.compute engine.DiskReadBytes  Summary of the number of bytes read from disk for each instance in this zone
summary.google.compute engine.DiskReadOps  Summary of the number of read operations performed on the disk of each instance in this zone
summary.google.compute engine.diskWriteBytes  Summary of the number of bytes written to disk for each instance in this zone
summary.google.compute engine.DiskWriteOps  Summary of the number of write operations performed on the disk for each instance in this zone
summary.google.compute engine.instances  Number of instances monitored in this zone
summary.google.compute engine.NetworkPacketsIn  Summary of the number of incoming network packets for each instance in this zone
summary.google.compute engine.NetworkPacketsOut  Summary of the number of outgoing network packets for each instance in this zone


<Instance name>

modules

State  State of the machine, in string format
Instance State (bool) State of the machine, 1 if it is running, 0 otherwise
CPUUtilization  Percentage of CPU utilization used
DiskReadBytes Number of bytes read from disk
DiskReadOps  The number of read operations performed on the disk
DiskWriteBytes  Number of bytes written to disk
DiskWriteOps  Number of write operations performed on the disk
NetworkPacketsIn  The number of incoming network packets
NetworkPacketsOut  The number of outgoing network packets