Add ICMP monitoring support to Phoenix agent channel

- Add monitoring_enabled and check_interval_seconds fields to Device and SnmpDevice protobuf messages
- Add MonitoringCheck protobuf message for ping results
- Update AgentChannel to handle monitoring_check events from agents
- Configure monitoring settings in job payloads sent to agents
This commit is contained in:
Graham McIntire 2026-01-19 13:46:20 -06:00
parent ceded37d9c
commit f497de4474
No known key found for this signature in database
2 changed files with 35 additions and 0 deletions

View file

@ -26,6 +26,8 @@ defmodule Towerops.Agent.Device do
field :poll_interval_seconds, 5, type: :uint32, json_name: "pollIntervalSeconds"
field :sensors, 6, repeated: true, type: Towerops.Agent.Sensor
field :interfaces, 7, repeated: true, type: Towerops.Agent.Interface
field :monitoring_enabled, 8, type: :bool, json_name: "monitoringEnabled"
field :check_interval_seconds, 9, type: :uint32, json_name: "checkIntervalSeconds"
end
defmodule Towerops.Agent.SnmpConfig do
@ -119,6 +121,11 @@ defmodule Towerops.Agent.Metric do
type: Towerops.Agent.NeighborDiscovery,
json_name: "neighborDiscovery",
oneof: 0
field :monitoring_check, 4,
type: Towerops.Agent.MonitoringCheck,
json_name: "monitoringCheck",
oneof: 0
end
defmodule Towerops.Agent.SensorReading do
@ -174,6 +181,20 @@ defmodule Towerops.Agent.NeighborDiscovery do
field :timestamp, 11, type: :int64
end
defmodule Towerops.Agent.MonitoringCheck do
@moduledoc false
use Protobuf,
full_name: "towerops.agent.MonitoringCheck",
protoc_gen_elixir_version: "0.16.0",
syntax: :proto3
field :device_id, 1, type: :string, json_name: "deviceId"
field :status, 2, type: :string
field :response_time_ms, 3, type: :double, json_name: "responseTimeMs"
field :timestamp, 4, type: :int64
end
defmodule Towerops.Agent.HeartbeatMetadata do
@moduledoc false
@ -262,6 +283,8 @@ defmodule Towerops.Agent.SnmpDevice do
field :community, 2, type: :string
field :version, 3, type: :string
field :port, 4, type: :uint32
field :monitoring_enabled, 5, type: :bool, json_name: "monitoringEnabled"
field :check_interval_seconds, 6, type: :uint32, json_name: "checkIntervalSeconds"
end
defmodule Towerops.Agent.SnmpQuery do

View file

@ -17,6 +17,8 @@ message Device {
uint32 poll_interval_seconds = 5;
repeated Sensor sensors = 6;
repeated Interface interfaces = 7;
bool monitoring_enabled = 8;
uint32 check_interval_seconds = 9;
}
message SnmpConfig {
@ -51,6 +53,7 @@ message Metric {
SensorReading sensor_reading = 1;
InterfaceStat interface_stat = 2;
NeighborDiscovery neighbor_discovery = 3;
MonitoringCheck monitoring_check = 4;
}
}
@ -86,6 +89,13 @@ message NeighborDiscovery {
int64 timestamp = 11; // Unix timestamp in seconds
}
message MonitoringCheck {
string device_id = 1;
string status = 2; // "success" or "failure"
double response_time_ms = 3; // Optional - only present on success
int64 timestamp = 4; // Unix timestamp in seconds
}
// Heartbeat metadata
message HeartbeatMetadata {
string version = 1;
@ -126,6 +136,8 @@ message SnmpDevice {
string community = 2;
string version = 3; // "1", "2c", or "3"
uint32 port = 4;
bool monitoring_enabled = 5;
uint32 check_interval_seconds = 6;
}
message SnmpQuery {