HID Template Changes: - Rename "Ribbon Remaining" to "Ribbon Level" (matches displayprinter.asp filter) - Add preprocessing to convert raw print count to percentage (500-print YMCKO) - Update triggers to use percentage thresholds (15% warning, 5% critical) - Change key from hid.ribbon.remaining to hid.ribbon.level README - Template Guidelines for ShopDB Integration: - Supply items MUST include "Level" in name to appear in displayprinter.asp - Values MUST be percentages (0-100) for progress bar display - UUIDs MUST be valid UUIDv4 (32 hex chars, no dashes) - Triggers MUST be nested inside items, not at template level - Include preprocessing examples for converting raw counts to percentages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65 lines
2.2 KiB
Markdown
65 lines
2.2 KiB
Markdown
# SNMP Scanner / Zabbix Templates
|
|
|
|
This repository contains SNMP-based Zabbix templates and related tooling for monitoring network devices.
|
|
|
|
## Zabbix Template Requirements for ShopDB Integration
|
|
|
|
Templates created here are used with the ShopDB `displayprinter.asp` page, which pulls supply data from Zabbix via API. To ensure compatibility:
|
|
|
|
### Supply Level Items
|
|
|
|
For supply items to appear in displayprinter.asp, they **must**:
|
|
|
|
1. **Include "Level" in the item name** - The page filters for items containing "Level"
|
|
- Good: `Ribbon Level`, `Toner Level Black`, `Ink Level Cyan`
|
|
- Bad: `Ribbon Remaining`, `Toner Count`, `Ink Status`
|
|
|
|
2. **Return a percentage value (0-100)** - The page displays items as progress bars
|
|
- If the SNMP OID returns a raw count, add preprocessing to convert to percentage
|
|
- Example: For a 500-print ribbon, use JavaScript preprocessing:
|
|
```javascript
|
|
var remaining = parseInt(value, 10);
|
|
var percent = (remaining / 500) * 100;
|
|
return Math.min(100, Math.max(0, percent.toFixed(1)));
|
|
```
|
|
|
|
3. **Use appropriate units** - Set `units: '%'` for percentage values
|
|
|
|
### Example Item Structure
|
|
|
|
```yaml
|
|
- uuid: <valid-uuidv4>
|
|
name: Ribbon Level # Must contain "Level"
|
|
type: SNMP_AGENT
|
|
snmp_oid: 'get[1.3.6.1.4.1.xxx]'
|
|
key: device.ribbon.level
|
|
value_type: FLOAT
|
|
units: '%' # Percentage
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
// Convert raw count to percentage
|
|
var remaining = parseInt(value, 10);
|
|
var capacity = 500; // Adjust per consumable
|
|
return Math.min(100, Math.max(0, (remaining / capacity) * 100));
|
|
```
|
|
|
|
### Zabbix Import Requirements
|
|
|
|
- **UUIDs must be valid UUIDv4** - 32 hex characters without dashes
|
|
- **Triggers must be nested inside items** - Not at the template level
|
|
- Generate UUIDs with: `python3 -c "import uuid; print(uuid.uuid4().hex)"`
|
|
|
|
## Templates
|
|
|
|
| Template | Device | Notes |
|
|
|----------|--------|-------|
|
|
| `zabbix_template_hid_dtc4500e.yaml` | HID Fargo DTC4500e Card Printer | YMCKO 500-print ribbon |
|
|
|
|
## Related
|
|
|
|
- **ShopDB**: `/home/camp/projects/windows/shopdb/`
|
|
- **Zabbix API integration**: `shopdb/includes/zabbix_all_supplies.asp`
|
|
- **Display page**: `shopdb/displayprinter.asp`
|