diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..662853c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,91 @@ +# SNMP Scanner - Claude Code Instructions + +## Project Overview + +Repository for SNMP-based Zabbix templates and network device monitoring tools. Templates created here integrate with the ShopDB application for displaying supply levels. + +## Repository Location + +- **Local**: `/home/camp/projects/python/snmp-scanner/` +- **Gitea**: `http://localhost:3000/cproudlock/snmp-scanner` + +## Key Files + +| File | Purpose | +|------|---------| +| `zabbix_template_*.yaml` | Zabbix monitoring templates | +| `README.md` | Template guidelines for ShopDB integration | + +## Zabbix Template Requirements + +### For displayprinter.asp Compatibility + +Supply level items MUST follow these rules to appear in ShopDB: + +1. **Item name must contain "Level"** + ```yaml + name: Ribbon Level # Good - will appear + name: Ribbon Remaining # Bad - filtered out + ``` + +2. **Value must be percentage (0-100)** + - Add preprocessing if SNMP returns raw counts + - Use JavaScript to convert: `(remaining / capacity) * 100` + +3. **Use `units: '%'`** for percentage values + +### Zabbix YAML Structure + +```yaml +# UUIDs: 32 hex chars, no dashes +uuid: 97f742974686406aa8be1394d18dcb5f + +# Triggers go INSIDE items, not at template level +items: +- uuid: abc123... + name: Some Item + triggers: # Nested under the item + - uuid: def456... + expression: '...' +``` + +### Generating Valid UUIDs + +```bash +python3 -c "import uuid; print(uuid.uuid4().hex)" +``` + +## Related Projects + +- **ShopDB**: `/home/camp/projects/windows/shopdb/` + - `includes/zabbix_all_supplies.asp` - Zabbix API integration + - `displayprinter.asp` - Displays supply levels from Zabbix + +## Common Tasks + +### Creating a New Template + +1. Get SNMP walk data from the device +2. Identify relevant OIDs for monitoring +3. Create YAML template following structure in existing templates +4. Ensure supply items have "Level" in name and return percentages +5. Generate valid UUIDv4 for all uuid fields +6. Place triggers inside their related items + +### Testing Template Import + +1. Import into Zabbix via Configuration > Templates > Import +2. Common errors: + - "unexpected tag triggers" = triggers at wrong level (move inside items) + - "invalid parameter uuid" = UUID not valid UUIDv4 format + +## Device-Specific Notes + +### HID Fargo DTC4500e Card Printer + +- **MIB**: HID Enterprise MIB (1.3.6.1.4.1.28959) +- **Ribbon**: YMCKO 500-print capacity +- **OID for ribbon**: 1.3.6.1.4.1.28959.3.255.1.16.0 (returns raw count) +- **Status flags OID**: 1.3.6.1.4.1.28959.3.255.1.10.0 + - Format: `DH:0 IH:0 LM:0 FL:1 MG:0 SM:0 SC:0 PE:0` + - DH=Door/Hopper, IH=Input Hopper, FL=Film loaded, etc.