Static Sensors, Counters, and Status Monitoring
Observium provides powerful static monitoring capabilities that allow you to monitor custom SNMP OIDs that aren't automatically discovered. This is particularly useful for vendor-specific MIBs, custom applications, or devices with non-standard implementations.
Overview
Static monitoring supports three entity types:
- Static Sensors - Monitor numeric values (temperature, voltage, etc.)
- Static Counters - Monitor incrementing values (packet counts, byte counts, etc.)
- Static Status - Monitor state values with custom translations (power states, operational status, etc.)
Static Sensors
Static sensors allow you to monitor any SNMP OID that returns a numeric value.
Configuration
Add sensor configurations to your config.php
:
PHP |
---|
| $config['sensors']['static'][] = [
'device_id' => '123', // Target device ID
'class' => 'temperature', // Sensor class (temperature, voltage, current, etc.)
'oid' => '1.3.6.1.4.1.12345.1.2.3.0', // SNMP OID to poll
'descr' => 'External Temperature Sensor', // Human description
'multiplier' => 0.1, // Scale factor (value * multiplier)
'limit' => 80, // Optional: high limit (alert)
'limit_low' => -20, // Optional: low limit (alert)
'limit_warn' => 70, // Optional: high warning limit
'limit_low_warn' => 0 // Optional: low warning limit
];
|
Sensor Classes
Common sensor classes include:
temperature
- Temperature sensors (°C)
voltage
- Voltage sensors (V)
current
- Current sensors (A)
power
- Power sensors (W)
humidity
- Humidity sensors (%)
fanspeed
- Fan speed (RPM)
load
- Generic load/usage (%)
pressure
- Pressure sensors
signal
- Signal strength (dBm)
Example: Multiple Sensors
PHP |
---|
| // UPS temperature sensors
$config['sensors']['static'][] = [
'device_id' => '456',
'class' => 'temperature',
'oid' => '1.3.6.1.4.1.5491.2.7.1.2.1.1.1.8.0',
'descr' => 'UPS Internal Temperature',
'multiplier' => 1,
'limit' => 60,
'limit_warn' => 50
];
// Custom voltage monitoring
$config['sensors']['static'][] = [
'device_id' => '456',
'class' => 'voltage',
'oid' => '1.3.6.1.4.1.5491.2.7.1.2.1.1.1.3.0',
'descr' => 'Battery Voltage',
'multiplier' => 0.1,
'limit' => 14.4,
'limit_low' => 10.8
];
|
Static Counters
Static counters monitor incrementing values and automatically calculate rates.
Configuration
PHP |
---|
| $config['counters']['static'][] = [
'device_id' => '789', // Target device ID
'class' => 'counter', // Counter class
'oid' => '1.3.6.1.4.1.12345.1.5.2.0', // SNMP OID to poll
'descr' => 'Custom Packet Counter', // Human description
'multiplier' => 1, // Scale factor
'counter_unit' => 'pps', // Optional: unit for rates
'limit' => 1000000, // Optional: rate limit
'limit_warn' => 800000 // Optional: rate warning
];
|
Counter Classes
counter
- Generic counter
traffic
- Network traffic counters
packets
- Packet counters
errors
- Error counters
storage
- Storage counters
Example: Application Counters
PHP |
---|
| // Database query counter
$config['counters']['static'][] = [
'device_id' => '101',
'class' => 'counter',
'oid' => '1.3.6.1.4.1.99999.1.1.1.0',
'descr' => 'Database Queries',
'multiplier' => 1,
'counter_unit' => 'qps'
];
// Custom error counter
$config['counters']['static'][] = [
'device_id' => '101',
'class' => 'errors',
'oid' => '1.3.6.1.4.1.99999.1.2.1.0',
'descr' => 'Application Errors',
'multiplier' => 1
];
|
Static Status
Static status monitoring allows you to monitor state values with custom name and event translations. This is perfect for vendor-specific status OIDs that aren't covered by standard MIBs.
Configuration Options
Static status supports three configuration approaches:
1. Existing MIB Status Types
Use existing Observium MIB status definitions:
PHP |
---|
| $config['status']['static'][] = [
'device_id' => '123',
'oid' => '1.3.6.1.4.1.9.9.500.1.2.1.1.3.1001',
'type' => 'cisco-stackwise-member-state', // Use existing MIB status type
'descr' => 'Switch 1 Role'
];
|
2. Shared Custom State Types
Define reusable state types for multiple devices:
PHP |
---|
| // Define shared state type
$config['status']['static_states']['custom-power-state'] = [
0 => ['name' => 'off', 'event' => 'alert'],
1 => ['name' => 'on', 'event' => 'ok'],
2 => ['name' => 'standby', 'event' => 'warning'],
3 => ['name' => 'fault', 'event' => 'alert']
];
// Use shared state type on multiple devices
$config['status']['static'][] = [
'device_id' => '456',
'oid' => '1.3.6.1.4.1.12345.1.2.3.0',
'type' => 'custom-power-state',
'descr' => 'External PSU 1'
];
$config['status']['static'][] = [
'device_id' => '456',
'oid' => '1.3.6.1.4.1.12345.1.2.4.0',
'type' => 'custom-power-state',
'descr' => 'External PSU 2'
];
|
3. Inline States (Perfect for One-off Devices)
Define states directly in the configuration entry:
PHP |
---|
| $config['status']['static'][] = [
'device_id' => '789',
'oid' => '1.3.6.1.4.1.99999.5.1.2.0',
'type' => 'schneider-door-sensor',
'descr' => 'Cabinet Door Sensor',
'entPhysicalClass' => 'chassis',
'states' => [
0 => ['name' => 'closed', 'event' => 'ok'],
1 => ['name' => 'open', 'event' => 'warning'],
2 => ['name' => 'forced', 'event' => 'alert'],
3 => ['name' => 'fault', 'event' => 'alert']
]
];
|
State Event Types
Each state value maps to an event type:
ok
- Normal operation (green)
warning
- Warning condition (yellow)
alert
- Critical condition (red)
ignore
- Ignore this state for alerting
Use Case: Schneider Electric Devices
Schneider devices often have vendor-specific MIBs that change between models. Static status is perfect for these:
PHP |
---|
| // Schneider UPS status
$config['status']['static'][] = [
'device_id' => '500',
'oid' => '1.3.6.1.4.1.705.1.5.11.0',
'type' => 'schneider-ups-status',
'descr' => 'UPS System Status',
'states' => [
1 => ['name' => 'unknown', 'event' => 'warning'],
2 => ['name' => 'onLine', 'event' => 'ok'],
3 => ['name' => 'onBattery', 'event' => 'warning'],
4 => ['name' => 'onBoost', 'event' => 'warning'],
5 => ['name' => 'sleeping', 'event' => 'ok'],
6 => ['name' => 'onBypass', 'event' => 'warning'],
7 => ['name' => 'rebooting', 'event' => 'warning'],
8 => ['name' => 'standBy', 'event' => 'ok'],
9 => ['name' => 'onBuck', 'event' => 'warning']
]
];
// Schneider environmental sensor
$config['status']['static'][] = [
'device_id' => '500',
'oid' => '1.3.6.1.4.1.705.1.8.1.0',
'type' => 'schneider-env-status',
'descr' => 'Environmental Alarm',
'states' => [
1 => ['name' => 'normal', 'event' => 'ok'],
2 => ['name' => 'warning', 'event' => 'warning'],
3 => ['name' => 'critical', 'event' => 'alert'],
4 => ['name' => 'notPresent', 'event' => 'ignore']
]
];
|
Discovery and Polling
All static entities are:
- Discovered during the sensors discovery module
- Polled every polling cycle along with other sensors/counters/status
- Graphed automatically with appropriate RRD storage
- Alerted based on limits and events
Manual Discovery
To force discovery of new static configurations:
Bash |
---|
| sudo -u observium php discovery.php -h [device_id] -m sensors
|
Manual Polling
To test polling:
Bash |
---|
| sudo -u observium php poller.php -h [device_id] -m status
sudo -u observium php poller.php -h [device_id] -m sensors
|
Finding Device IDs
To find device IDs for configuration, they can be extracted from any device page URL:
Text Only |
---|
| http://observium.domain.com/device/<device_id>/
|
Testing OIDs
Before adding static configurations, test OIDs manually:
Bash |
---|
| # Test SNMP polling
snmpget -v2c -c [community] [hostname] [oid]
# Example
snmpget -v2c -c public device.example.com 1.3.6.1.4.1.12345.1.2.3.0
|
Advanced Options
Physical Entity Association
Associate sensors with physical entities:
PHP |
---|
| $config['sensors']['static'][] = [
'device_id' => '123',
'class' => 'temperature',
'oid' => '1.3.6.1.4.1.12345.1.2.3.5',
'descr' => 'Slot 1 Temperature',
'multiplier' => 1,
'entPhysicalClass' => 'module', // Physical class
'entPhysicalIndex' => '5' // Physical index
];
|
Measured Entity Association
Link status to specific entities for advanced alerting:
PHP |
---|
| $config['status']['static'][] = [
'device_id' => '456',
'oid' => '1.3.6.1.4.1.12345.1.3.2.1',
'type' => 'port-link-state',
'descr' => 'Port Link Status',
'measured_class' => 'port', // Entity class
'measured_entity' => '12345' // Entity ID
];
|
Troubleshooting
Common Issues
- "Skipped by unknown state value" - The polled value doesn't match any defined states
- No data in graphs - Check OID accessibility and SNMP credentials
- Status not updating - Verify state definitions match actual OID values
Debug Discovery
Bash |
---|
| sudo -u observium php discovery.php -h [device_id] -m sensors -d
|
Debug Polling
Bash |
---|
| sudo -u observium php poller.php -h [device_id] -m status -d
|
Best Practices
- Use descriptive names - Make status descriptions clear and specific
- Group related states - Use shared state types for similar devices
- Test OIDs first - Verify SNMP accessibility before adding configs
- Document custom states - Comment complex state mappings
- Use appropriate limits - Set meaningful thresholds for alerting
- Regular validation - Periodically verify custom monitoring is working
Examples by Vendor
APC UPS
PHP |
---|
| $config['sensors']['static'][] = [
'device_id' => '100',
'class' => 'load',
'oid' => '1.3.6.1.4.1.318.1.1.1.4.2.3.0',
'descr' => 'UPS Load Percentage',
'multiplier' => 1
];
|
Eaton UPS
PHP |
---|
| $config['status']['static'][] = [
'device_id' => '200',
'oid' => '1.3.6.1.4.1.534.1.1.2.0',
'type' => 'eaton-ups-status',
'descr' => 'UPS Status',
'states' => [
1 => ['name' => 'other', 'event' => 'warning'],
2 => ['name' => 'none', 'event' => 'ok'],
3 => ['name' => 'normal', 'event' => 'ok'],
4 => ['name' => 'bypass', 'event' => 'warning'],
5 => ['name' => 'battery', 'event' => 'warning'],
6 => ['name' => 'booster', 'event' => 'warning'],
7 => ['name' => 'reducer', 'event' => 'warning']
]
];
|
Custom Application
PHP |
---|
| $config['counters']['static'][] = [
'device_id' => '300',
'class' => 'counter',
'oid' => '1.3.6.1.4.1.99999.1.1.1.0',
'descr' => 'Application Requests',
'multiplier' => 1,
'counter_unit' => 'req/s'
];
|
This static monitoring system provides the flexibility needed to monitor any SNMP-accessible metric, making it perfect for custom applications, vendor-specific devices, and filling gaps in automatic discovery.