From 389e6202619c516cda10c609df97cb47d3633f41 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Wed, 17 Dec 2025 13:52:21 -0500 Subject: [PATCH] Initial commit: SNMP scanner and Zabbix template generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tools for printer discovery and monitoring: - snmp_scanner.py: SNMP-based printer discovery - generate_printer_templates.py: Generate Zabbix templates - analyze_supplies.py: Analyze printer supply levels - extract_summary.py: Extract printer data summaries Includes Zabbix templates for: - HP Color/Mono printers - HP DesignJet T1700 - Xerox Color/Mono/Enterprise printers ๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .gitignore | 42 + HP_DesignJet_T1700_README.md | 210 ++ NAMING_FIX_SUMMARY.md | 51 + README.md | 237 ++ WJ_printers.xlsx | Bin 0 -> 13626 bytes analyze_all_printers.py | 183 ++ analyze_supplies.py | 169 ++ check_unknown_printers.py | 62 + compare_xerox.sh | 36 + extract_summary.py | 2647 ++++++++++++++++++++ extract_summary_FIXED.py | 2338 +++++++++++++++++ generate_printer_templates.py | 792 ++++++ generate_zabbix_config.py | 683 +++++ printer_template_mapping.py | 147 ++ regenerate_designjet_template.py | 282 +++ snmp_scanner.py | 243 ++ zabbix_printer_template.json | 1425 +++++++++++ zabbix_printer_template.yaml | 920 +++++++ zabbix_template_hp_color.json | 718 ++++++ zabbix_template_hp_color.yaml | 453 ++++ zabbix_template_hp_designjet_t1700.yaml | 407 +++ zabbix_template_hp_designjet_t1700_v2.yaml | 378 +++ zabbix_template_hp_mono.json | 364 +++ zabbix_template_hp_mono.yaml | 229 ++ zabbix_template_xerox_color.json | 1451 +++++++++++ zabbix_template_xerox_color.yaml | 924 +++++++ zabbix_template_xerox_enterprise.json | 1414 +++++++++++ zabbix_template_xerox_enterprise.yaml | 893 +++++++ zabbix_template_xerox_mono.json | 484 ++++ zabbix_template_xerox_mono.yaml | 307 +++ 30 files changed, 18489 insertions(+) create mode 100644 .gitignore create mode 100644 HP_DesignJet_T1700_README.md create mode 100644 NAMING_FIX_SUMMARY.md create mode 100644 README.md create mode 100644 WJ_printers.xlsx create mode 100644 analyze_all_printers.py create mode 100644 analyze_supplies.py create mode 100644 check_unknown_printers.py create mode 100644 compare_xerox.sh create mode 100644 extract_summary.py create mode 100644 extract_summary_FIXED.py create mode 100644 generate_printer_templates.py create mode 100644 generate_zabbix_config.py create mode 100644 printer_template_mapping.py create mode 100644 regenerate_designjet_template.py create mode 100644 snmp_scanner.py create mode 100644 zabbix_printer_template.json create mode 100644 zabbix_printer_template.yaml create mode 100644 zabbix_template_hp_color.json create mode 100644 zabbix_template_hp_color.yaml create mode 100644 zabbix_template_hp_designjet_t1700.yaml create mode 100644 zabbix_template_hp_designjet_t1700_v2.yaml create mode 100644 zabbix_template_hp_mono.json create mode 100644 zabbix_template_hp_mono.yaml create mode 100644 zabbix_template_xerox_color.json create mode 100644 zabbix_template_xerox_color.yaml create mode 100644 zabbix_template_xerox_enterprise.json create mode 100644 zabbix_template_xerox_enterprise.yaml create mode 100644 zabbix_template_xerox_mono.json create mode 100644 zabbix_template_xerox_mono.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bf207be --- /dev/null +++ b/.gitignore @@ -0,0 +1,42 @@ +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# Virtual environments +venv/ +ENV/ +env/ + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log + +# Local config +config.local.py diff --git a/HP_DesignJet_T1700_README.md b/HP_DesignJet_T1700_README.md new file mode 100644 index 0000000..49da5c6 --- /dev/null +++ b/HP_DesignJet_T1700_README.md @@ -0,0 +1,210 @@ +# HP DesignJet T1700dr PostScript - Zabbix Monitoring Setup + +## Printer Information +- **Model**: HP DesignJet T1700dr PostScript (44" wide format) +- **IP Address**: 10.80.92.24 +- **Hostname**: NPIDDF2D7 +- **Serial Number**: CN91P7H00J +- **Firmware**: JGRw_04_19_18.1 +- **Location**: Blisk Inspection + +## Ink Cartridge System + +This printer uses the **HP 730 series ink cartridges** (6 colors): + +| Color | Part Number | Max Capacity | SNMP Index | +|-------|-------------|--------------|------------| +| Matte Black | P2V72A | 3000 | 1 | +| Cyan | P2V73A | 3000 | 2 | +| Magenta | P2V71A | 3000 | 3 | +| Yellow | P2V70A | 3000 | 4 | +| Photo Black | P2V69A | 3000 | 5 | +| Gray | P2V68A | 3000 | 6 | + +## Zabbix Template + +### Template File +- **Location**: `/home/camp/snmp-scanner/zabbix_template_hp_designjet_t1700_v2.yaml` (CORRECTED VERSION) +- **Old Location**: `/home/camp/snmp-scanner/zabbix_template_hp_designjet_t1700.yaml` (Uses wrong OIDs - do not use) +- **Template Name**: HP DesignJet T1700 +- **Template Group**: Printers + +### Key SNMP OIDs + +#### Printer Information +- **Model**: 1.3.6.1.2.1.25.3.2.1.3.1 +- **Hostname**: 1.3.6.1.2.1.1.5.0 +- **Serial Number**: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0 (HP-specific) +- **Location**: 1.3.6.1.2.1.1.6.0 +- **Firmware**: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.6.0 + +#### Ink Levels (Per Color) + +**IMPORTANT**: HP DesignJet uses proprietary HP OIDs for ink levels, NOT standard Printer MIB OIDs. + +- **Part Number**: 1.3.6.1.2.1.43.11.1.1.6.1.{index} (Standard - works) +- **Max Capacity**: 1.3.6.1.2.1.43.11.1.1.8.1.{index} (Standard - works) +- **Current Level**: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.{index}.1.0 (HP proprietary - direct percentage) + +### Monitored Items + +For each ink cartridge: +1. **Part Number** (Text) - Identifies the specific HP 730 cartridge from standard OID +2. **Ink Level Percentage** (Direct from HP OID) - Current ink level as percentage (0-100) + +### Triggers + +**Warning Level (20%)**: +- Trigger when ink level drops below 20% +- Priority: WARNING +- Shows current level and replacement part number + +**Critical Level (10%)**: +- Trigger when ink level drops below 10% +- Priority: HIGH +- Shows current level and replacement part number + +## Import Instructions + +### 1. Import Template to Zabbix + +```bash +# From Zabbix web interface: +# 1. Navigate to: Configuration โ†’ Templates +# 2. Click "Import" button +# 3. Upload: /home/camp/snmp-scanner/zabbix_template_hp_designjet_t1700_v2.yaml +# 4. Click "Import" + +# NOTE: Use v2 template - it has the correct HP proprietary OIDs for ink levels +``` + +### 2. Configure SNMP on Host + +```bash +# In Zabbix: +# 1. Go to: Configuration โ†’ Hosts +# 2. Find or create host for: 10.80.92.24 +# 3. Set hostname to: NPIDDF2D7 (or descriptive name) +# 4. Add to host group: Printers +``` + +### 3. Link Template to Host + +```bash +# In host configuration: +# 1. Go to "Templates" tab +# 2. Click "Select" next to "Link new templates" +# 3. Search for: HP DesignJet T1700 +# 4. Click "Add" +# 5. Click "Update" +``` + +### 4. Configure SNMP Interface + +```bash +# In host configuration: +# 1. Go to "Interfaces" tab +# 2. Add SNMP interface: +# - IP: 10.80.92.24 +# - Port: 161 +# - SNMP version: SNMPv2 +# - SNMP community: public (or your community string) +# 3. Click "Update" +``` + +## Verification + +### Test SNMP Connectivity + +```bash +# From Zabbix server/proxy, test SNMP: +snmpget -v2c -c public 10.80.92.24 1.3.6.1.2.1.1.5.0 +# Should return: NPIDDF2D7 + +snmpget -v2c -c public 10.80.92.24 1.3.6.1.2.1.25.3.2.1.3.1 +# Should return: HP DesignJet T1700dr PostScript (44" sized) +``` + +### Check Data Collection + +```bash +# In Zabbix: +# 1. Go to: Monitoring โ†’ Latest data +# 2. Filter by host: NPIDDF2D7 +# 3. Verify items are collecting data: +# - Printer Model +# - All 6 ink levels (Matte Black, Cyan, Magenta, Yellow, Photo Black, Gray) +# - Serial Number +# - Firmware Version +``` + +## Maintenance Notes + +### Ink Replacement Procedure + +1. **Order Supplies**: HP 730 series cartridges + - Can purchase 130ml or 300ml sizes + - All colors use same cartridge design + +2. **Check Current Levels**: + - Monitor Zabbix dashboard + - Check printer web interface: http://10.80.92.24 + +3. **Replace Cartridge**: + - Power on printer + - Open ink cartridge access door + - Remove empty cartridge + - Install new cartridge + - Close access door + +4. **Verify in Zabbix**: + - Levels should update within 1 hour + - Alert should clear automatically + +### Compatible Models + +This template can also be used for: +- HP DesignJet T1600 (same ink system) +- HP DesignJet T2600 (same ink system) +- Other HP DesignJet models using HP 730 inks + +## Troubleshooting + +### No Data Collected + +1. Check SNMP connectivity: + ```bash + snmpwalk -v2c -c public 10.80.92.24 1.3.6.1.2.1.1 + ``` + +2. Verify community string is correct +3. Check firewall allows UDP 161 +4. Ensure printer SNMP is enabled + +### Incorrect Ink Levels + +1. Verify you're using the HP proprietary OID (not standard Printer MIB): + ```bash + # HP DesignJet proprietary OID (correct for T1700): + snmpwalk -v2c -c WestJeff2025 10.80.92.24 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4 + + # Standard Printer MIB (will NOT work on DesignJet): + snmpwalk -v2c -c WestJeff2025 10.80.92.24 1.3.6.1.2.1.43.11.1.1.9.1 + ``` + +2. Ensure you're using template v2 (not v1) which has correct OIDs +3. Check if printer firmware needs update + +### Alerts Not Triggering + +1. Check trigger expressions in template +2. Verify item data is being collected +3. Check trigger dependencies +4. Review Zabbix logs for errors + +## Additional Resources + +- **HP Support**: [HP DesignJet T1700 Support](https://support.hp.com/us-en/product/hp-designjet-t1700-printer-series/7528524) +- **Ink Specifications**: [HP 730 Cartridge Info](https://www.hp.com/us-en/shop/cat/designjet-730-ink-cartridges) +- **SNMP MIB**: Printer-MIB (RFC 3805) +- **HP Enterprise MIB**: HP-LASERJET-COMMON-MIB diff --git a/NAMING_FIX_SUMMARY.md b/NAMING_FIX_SUMMARY.md new file mode 100644 index 0000000..a05efa5 --- /dev/null +++ b/NAMING_FIX_SUMMARY.md @@ -0,0 +1,51 @@ +# Zabbix Template Naming Convention Fixes + +## Problem +Inconsistent naming between Level items and Part Number items made ASP matching logic complex and error-prone. + +## Solution +Standardize all templates so Part Number item name = Level item name with " Level" replaced by " Part Number" + +## Changes Made + +### HP Templates (โœ… FIXED) +- **HP Mono**: "Black Toner Level" โ†’ "Black Toner Part Number" โœ“ +- **HP Color**: All colors fixed to match (Black/Cyan/Magenta/Yellow Toner) + +### Xerox Templates (โš ๏ธ NEEDS FIX) + +**Xerox VersaLink Color** - Need to remove extra "Cartridge": +- Change: "Black Toner **Cartridge** Part Number" โ†’ "Black Toner Part Number" +- Change: "Black Drum **Cartridge** Part Number" โ†’ "Black Drum Part Number" +- (Same for all colors) + +**Xerox VersaLink Mono** - Need to remove extra "Cartridge": +- Change: "Toner **Cartridge** Part Number" โ†’ "Toner Part Number" +- Change: "Drum **Cartridge** Part Number" โ†’ "Drum Part Number" + +**Xerox Enterprise** - Already correct โœ“ + +### HP DesignJet (โš ๏ธ NEEDS FIX IF USED) +- These are ink cartridges, not toner +- Level items use "Ink", Part Numbers use "Cartridge" +- Should change to "Ink" for consistency +- However, these may not be actively used in your environment + +## Simplified ASP Matching Logic + +After fixes, the ASP code becomes: +```vbscript +' Simple direct match - no fuzzy logic needed +lookupName = Replace(itemName, " Level", "") +partKeyName = lookupName & " Part Number" +If partNumbers.Exists(partKeyName) Then + partNumber = partNumbers(partKeyName) +End If +``` + +## Next Steps +1. Fix Xerox templates in generate_printer_templates.py +2. Regenerate templates +3. Re-import to Zabbix +4. Simplify ASP matching code +5. Clear cache and test diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f8f111 --- /dev/null +++ b/README.md @@ -0,0 +1,237 @@ +# Zabbix Printer Monitoring Templates + +## Overview + +This project provides comprehensive Zabbix 7.4 templates for monitoring HP and Xerox network printers via SNMP v2. Five specialized templates have been created to handle the different OID index mappings used by various printer models. + +## Template Files + +All templates are available in both YAML and JSON formats: + +1. **HP LaserJet - Monochrome** (`zabbix_template_hp_mono.*`) + - 10 monitoring items + - Covers: HP LaserJet Pro 4xxx, M4xx, M6xx (B&W models) + - Monitors: Black toner, Maintenance kit + +2. **HP LaserJet - Color** (`zabbix_template_hp_color.*`) + - 20 monitoring items + - Covers: HP Color LaserJet Pro, M4xx, M2xx (Color models) + - Monitors: Black/Cyan/Magenta/Yellow toners + +3. **Xerox VersaLink - Color** (`zabbix_template_xerox_color.*`) + - 41 monitoring items + - Covers: Xerox VersaLink C7xxx, C4xxx (Color MFPs) + - Monitors: 4 toners, 4 drums, waste, transfer components, fuser + +4. **Xerox VersaLink - Monochrome** (`zabbix_template_xerox_mono.*`) + - 14 monitoring items + - Covers: Xerox VersaLink B7xxx, B4xxx (B&W MFPs) + - Monitors: Toner, drum, transfer roller, fuser + +5. **Xerox Enterprise - Color** (`zabbix_template_xerox_enterprise.*`) + - 28 monitoring items + - Covers: Xerox EC8036, AltaLink C8xxx (Enterprise Color MFPs) + - Monitors: 4 toners, 4 drums, fuser, waste, 2 transfer components (percentage-based) + +## Network Coverage + +Total printers: 27 + +- HP Monochrome: 13 printers +- HP Color: 3 printers +- Xerox VersaLink Color: 4 printers +- Xerox VersaLink Mono: 3 printers +- Xerox Enterprise: 4 printers + +Full IP-to-template mapping available in `printer_template_mapping.py` output. + +## Import Instructions + +### Method 1: Zabbix Web UI + +1. Login to Zabbix web interface +2. Navigate to: **Configuration โ†’ Templates โ†’ Import** +3. Select the appropriate YAML or JSON file for each printer type +4. Click **Import** +5. Repeat for each template file + +### Method 2: Zabbix API + +Use the Zabbix API to import templates programmatically. See Zabbix documentation for details. + +## Configuring Printers + +For each printer host in Zabbix: + +1. **Link Template**: Assign the appropriate template based on model (see IP mapping below) +2. **Configure SNMP Interface**: + - IP Address: Printer IP + - Port: 161 + - SNMP version: SNMPv2 + - SNMP community: `WestJeff2025` + +## Template to IP Mapping + +### HP LaserJet - Monochrome (zabbix_template_hp_mono) +``` +10.80.92.23, 10.80.92.24, 10.80.92.26, 10.80.92.28, 10.80.92.46, 10.80.92.53, +10.80.92.54, 10.80.92.55, 10.80.92.56, 10.80.92.57, 10.80.92.61, 10.80.92.65, 10.80.92.71 +``` + +### HP LaserJet - Color (zabbix_template_hp_color) +``` +10.80.92.51, 10.80.92.52, 10.80.92.67 +``` + +### Xerox VersaLink - Color (zabbix_template_xerox_color) +``` +10.80.92.20, 10.80.92.25, 10.80.92.69, 10.80.92.70 +``` + +### Xerox VersaLink - Monochrome (zabbix_template_xerox_mono) +``` +10.80.92.251, 10.80.92.45, 10.80.92.48 +``` + +### Xerox Enterprise - Color (zabbix_template_xerox_enterprise) +``` +10.80.92.252, 10.80.92.253, 10.80.92.49, 10.80.92.62 +``` + +## Technical Details + +### SNMP OIDs Used + +**Standard Printer MIB (RFC 3805):** +- Model: `1.3.6.1.2.1.25.3.2.1.3.1` +- Supply Description: `1.3.6.1.2.1.43.11.1.1.6.1.X` +- Supply Max Capacity: `1.3.6.1.2.1.43.11.1.1.8.1.X` +- Supply Current Level: `1.3.6.1.2.1.43.11.1.1.9.1.X` + +**HP Vendor-specific MIB:** +- Maintenance Kit: `1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.1.X` + +### Alert Thresholds + +- **Warning**: 20% remaining +- **High**: 10% remaining + +### Features + +- JavaScript preprocessing for hex-encoded SNMP strings +- Calculated items for percentage calculations +- Trigger expressions with part number validation +- Support for both capacity-based and percentage-based supply levels +- Supply compatibility notes in trigger messages for ordering alternatives + +## Scripts + +### analyze_all_printers.py +Analyzes all printer CSV files to identify OID patterns and categorize printer models. + +### generate_printer_templates.py +Generates all Zabbix templates in YAML and JSON formats. Run this script to regenerate templates if modifications are needed. + +### printer_template_mapping.py +Maps each printer IP to its correct template based on model detection. Provides detailed output for manual configuration. + +### check_unknown_printers.py +Utility script to analyze printers that don't match existing template patterns. + +## Maintenance + +To update templates: + +1. Modify template configurations in `generate_printer_templates.py` +2. Run: `python3 generate_printer_templates.py` +3. Re-import updated templates to Zabbix + +## Troubleshooting + +### No data from printer + +1. Verify SNMP is enabled on printer +2. Check SNMP community string matches `WestJeff2025` +3. Verify network connectivity and firewall rules (UDP 161) +4. Test with snmpwalk: `snmpwalk -v2c -c WestJeff2025 1.3.6.1.2.1.43` + +### Wrong supply levels + +1. Verify correct template is assigned for printer model +2. Check OID indices match your printer model +3. Export SNMP data: `python3 snmp_export.py ` +4. Analyze with: `python3 analyze_all_printers.py` + +### Missing supplies + +Some printer models may have additional supplies not covered by templates. Add custom items based on SNMP export analysis. + +## Supply Compatibility Reference + +When Zabbix triggers alert for low supplies, the trigger message includes a note to check compatibility alternatives. The following consolidations have been verified: + +### HP LaserJet Toner Compatibility + +**CF258A/CF258X (58A/58X)** - HP LaserJet Pro M404n/M406 +- Both standard (CF258A) and high-yield (CF258X) versions are compatible +- Models share identical toner and fuser components + +**CF500A/CF501A/CF502A/CF503A (202A Series)** - HP Color LaserJet M254dw +- Black: CF500A (202A Black) - NOT W2020A (414A) +- Cyan: CF501A (202A Cyan) - NOT W2021A +- Yellow: CF502A (202A Yellow) - NOT W2022A +- Magenta: CF503A (202A Magenta) - NOT W2023A + +**CE390A/CE390X (90A/90X)** - HP LaserJet M4555/M602/M603 +- Standard and high-yield versions compatible across all three models +- High consolidation value for fleet management + +**Q5942A/Q5942X (42A/42X)** - HP LaserJet 4250/4350 +- Both capacities work across model range +- Legacy models still in service + +**CE255X (55X)** - HP LaserJet P3015/P3010 +- Single part number for both models + +### Xerox Toner Compatibility + +**106R03536-39 Series** - Xerox VersaLink C405/C400 +- Black: 106R03536 (10.5K pages) +- Cyan: 106R03537 (10.5K pages) +- Magenta: 106R03538 (10.5K pages) +- Yellow: 106R03539 (10.5K pages) + +**106R03580-82 Series** - Xerox VersaLink B405/B400 +- Standard: 106R03580 (5.9K pages) +- High-yield: 106R03582 (13.9K pages) +- Extra high-yield: 106R03581 (24.6K pages) + +For complete compatibility details and part-specific notes, refer to the `SUPPLY_COMPATIBILITY` dictionary in `generate_printer_templates.py`. + +## Files Structure + +``` +/home/camp/snmp-scanner/ +โ”œโ”€โ”€ README.md # This file +โ”œโ”€โ”€ generate_printer_templates.py # Template generator +โ”œโ”€โ”€ printer_template_mapping.py # IP to template mapper +โ”œโ”€โ”€ analyze_all_printers.py # OID pattern analyzer +โ”œโ”€โ”€ check_unknown_printers.py # Unknown printer analyzer +โ”œโ”€โ”€ zabbix_template_hp_mono.yaml # HP mono template (YAML) +โ”œโ”€โ”€ zabbix_template_hp_mono.json # HP mono template (JSON) +โ”œโ”€โ”€ zabbix_template_hp_color.yaml # HP color template (YAML) +โ”œโ”€โ”€ zabbix_template_hp_color.json # HP color template (JSON) +โ”œโ”€โ”€ zabbix_template_xerox_color.yaml # Xerox VersaLink color (YAML) +โ”œโ”€โ”€ zabbix_template_xerox_color.json # Xerox VersaLink color (JSON) +โ”œโ”€โ”€ zabbix_template_xerox_mono.yaml # Xerox VersaLink mono (YAML) +โ”œโ”€โ”€ zabbix_template_xerox_mono.json # Xerox VersaLink mono (JSON) +โ”œโ”€โ”€ zabbix_template_xerox_enterprise.yaml # Xerox Enterprise (YAML) +โ””โ”€โ”€ zabbix_template_xerox_enterprise.json # Xerox Enterprise (JSON) + +/home/camp/output/ +โ””โ”€โ”€ printer-*.csv # SNMP exports from printers +``` + +## Support + +For issues or questions, review the SNMP exports in `/home/camp/output/` and analyze with the provided Python scripts. diff --git a/WJ_printers.xlsx b/WJ_printers.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..adc76ff94b0de530ea7567c01e9848259dc9c065 GIT binary patch literal 13626 zcmeHu1y>!}()PjKo#1eAhaf?My9Fn>yZgaif(LhZ*Wm6h2_D>n26sMY=H7Q^a_9R6 z_x4(+`}FEv&+6V?PgU)zY6WQsNK61U02TlMkODm7hDbqR0DvD90Du921=kd|wQ(}G zanerw*;eFP^+>1-ysQqPg7cxCgWK4Jos?y$R2nuXjQ9_&RQs_ArMKZAc za0=1M2M$CcgNsg030`1bC79#=QJ?Kd4}jCl1P8 z>~$Y`{HJ4Nl(Xf(+MPIPj}qfxJMLj0xW`r&gaM`A7$1GV!Sm*gVC{hB zIbn(U>E0eh?FbfHUjk;UeN7Dt(<%Xgq*mH@#*rSs^6v$RTcD?lXD$I&%c_ZEIa>BK zV8QXY5Ql3_cu?K9s~CCeUBjVQ6Ec`$wH)7i(>X#iZb7}fe@(BN1LHtLtEF<;cYN+x~x4{V(R{Umm?YPF5O%1vU88|Alm{ooAVrY{rU7bYIr! z35+G>NslunCcowBMoiEtr;!MhUgetUo^oYUo9C8?>fwT(C<^DFZZg}d+9Un+BTp@EX3tID7wu1T2puL@xhr+g%$6r)-t^D9CoWfSfL-P-G%T<2Ghd=*Pv|T-BTc zitcLfk%Q2Y2QotlBC3y1S^KA!(~62>z@Su!jNQ8Zph8H@Sl|7`iSE10RaH?zdAjX*AZ@3Os=*LmIk)AmcMzp zausXaJTBB{@0n+qKG*PZO+Z2=iEpD~Yw3)ZhifTj^Ezgkuj2rFN$Jxm4<)HJXOU84 ztBQr;}k^7=CC!>g zB>$6r%kJjS%nNZOz!KvO9gSL!xr?aio0*I=EbH#t?Oamy#Ley_RsXo!GU^0b>yNPR zCc^4vwrE23h|s!>8iGnXmq^w-*dkM@64`4iR$n8{WbF~Pg!>FTS>eBz12!|i%J8FP zw|v9gxDy_QYOW$ZLUL({^v!~K!R^+Ir1CphFAm1?clD%^2Q00`@rM$VV{Ez7ED-Fj zb5RUpUWS$6pJ>3H29&q)CEmaXPc!A|$9&69K#jW*WOtn$pP7_PDlg>JJg_ioxR=6L zDfu{WF*96l6qgvw?+4VKb$yeo3*;;7wz#X@IoMs)nNSm=JBYh%NDqh+ce4{ojEp&l z)bDG^&jrTGxzh=Tw0`kcafG<8-^{kN7JE5P$(~ZrW(vg;Qw-ehXeFzi0euj^f4`yq zt}`H$wlpXZfMcw=B1;PA-{fjLCyA`NL3Jq!k5v!%!8XM@%V!LLin&qTO-IA-#xKv5 zjXb{%R|?+1?^wR#vblgVV~ZMb z*5m(KN43?TZePMRy9K6Dx)zTCH;9i;*SsxzH7jSAIC%P67OK3m@r~I0Y8m^S;_^yu zOljG5XpVIq!tiliZ5eZ$AqD z09URo>}Kg2f{%w;9r`4P%my0)#&?wM<_|t7kaCP4MXVltx{%1?tVribrI8A(q>Z`< z5A56`B5)##%EIoiB@>!}q9NJ{V9y&3bjmKY7U;TRSnRvPFoF=J8f@NJ2jEF=atEjF zHu7{IusdF;)zUuhz}S+m5qvKcxt_`?k=J!#E#=M-PKI|G>#h>d>E|Lc)a0#u;lG|oD57A?*7U(G)G|U za83A6JoV#`Pr7*JXUnT=!w0~Ez4G)A@Ag-={@c@my#}SPZt%Z*D_4}2?qf!6M|cil zc1?4^LR)lVB0Ew!M1dWyr&*>XW%IsVdqdlzt^Q4#3Boqm{d9cL<>oE&CIrS+H(hZ! zIwT0g>XZk{cKl)-0@mQTg2-PS3IqM<$6?tq0&=P&Ml*lh5Pc>l*X}Jf5HBRJkWA#V zc_x_MVuIP3)xvR#a70$)`)K{P?|q=sQH6hfQxi!ljmgeSv+(jYbe6w6@$>~AoFp%j zJ79W$j+E}UTl5wbwWOpQhc~i1`E9t66tv003}bNBqmQJDM3AJ2^7_eqi~{ z#;1Q?j!I*Gb%}IWgfXYwivlF@8U@3JtF5JjmV?Q9P=*#fAu3;8PwgaJ3M3ZIfO-)d zFVA=;$$aTX#{^$Egx+$)w*$D_^h;64ImF-ll&@lP56l#1H(0nuWi|_AR}M*_QIh34rXDaH(!yJK+v1Q|H z`;h`@pd6$72$M?iN$i~S_q{ojSwZ+SSV0vIBCOlh?KM)*L>xUIIAF7B+5wyPZbU)f zA*t;ByRU;$@uv_-qlC~w6r@~8YYIJ02MMU+z~FjYbwRS%q13R3OcHhMWS^HMDf7@b z`$s;Jrvne(j0_hCx-mw(ah6^@h&{smrdYpgSA6QU%`z9Ns1NWA#!BWxZAK5Af@EbU z`4IHJlIsVU)#J6Q`~`IPQ~8GExjjyO?Xg72@6N3%K~Zbp|MqNDf5ucH^NbfRp@ADjb=URWP{jc=EAnU=S< zs*<+0mJ`e}V7aHcKkSH{ij0MQ#&DMN3~=uQj%>v|YWbDsgOfkD;dxJBndO7a9sTwz z0GA_pJ@QIIrNi2%NUHj&EBc{%e@A@32M>t_Mp6ncpbYI>j7%_1s}K`3T&j?ytRLt| z2pOw~5NcKcA<{PkL1w|tovV^Zy0?%Y9`wSK5sI)AT>C=DJPbs9sr1Tm`FBupymm&YYeTxV)fkp+{NPOD zNTV2^*%K?DyVO~Rs2T0g4KTU;*LTal$%5fBLHE^gfDJ4etuoFyZK6{#iN)$8o>W;_ zVwmDvewL@yM!~nl&?}eyrcExxO<|pelQ)C`&1n$X0LMH7PS_udy&r~#mFfG6@p&n< zXTmUjM?KzitxZ+bg!M~+rN|Ql3u{vpu4FBY2^Bamm|?>?O$ap^pKy9iF<+H>EDn+l zz?Bt*Ami{Z(}t&oj*WuNXEtM1rAysKv&Ke3{~c+HqfP`_68;MQ$z?u#gj8!QYe|>u zH;XJo;XQYj}4m}h>7JpLd`*#xd+?t#e+3e4qd6c;2I z^<3Sa5Z2fgjcNpkDVc}w3-#nNFiJTIL-WcAoo@Q#(Nv`p>y=^VA`Y~=b~ zBPbngKl=?h^o**2ga;T&*`W2e!eFvNyzY)WVRqhp&2vnNd2a&QBmrOgyJfvZ&mYY0 z^U~fZD0k@`PKU6TQy4cTKS*UfzNdOo?bSX~w?v z56cns4|5QerYQ3!NOiF^Xrg>td9UY?LcwVg;Ni$#^Td>&ua>x-^nV@%~^ zFR|jtR0z*;j+925GTSxF6%J^4(2dqINtE~n3qAdh4k6;TgmyLcen8DjZ|X3! z-%}96&4`-^UJfIX-hr>7wp^sCIsfqeR%LV12`QTd!BC*sV|&o64Pzb=WJaMA2CYQE`9v)`w9P za`tt>_n%?IwO+m8msh)wM)q6Y^Y^g9$;{Z=nCbWZ?-9e%$MNVlO<0{ULoWhj+TX_Z zJ@mP!ia4)NKpP3#+Y*xT!8#Lm0*bA4m|*aGbJBj`=F`%C-$B&j&}P2S&D+r|dgQV% zp}Y=asT<+p?au;n2ChtObEkaIyX}L6oY9UqpUaYS5XdNYB@d}X)n#g8mM^mLa}aEl6ZIAblDJ2Y zyi>5vi4c@iP$t?ayD1l=aLtND2I{o8Ifr+hO5Y2MWsB%-Ek?k`1M^k7jaOXW=b4I`TUk zd%5@7AM{seYz0!D?@!pGc=Ggnd)_Dn+a9fZcrTpJ(YJva-|ixJ@c(G&i4Ee+4xQfi z#96g!SRN;652EMdaq8h2FI>alJp+fDu8w5n>-VR!&@J!3#ltZKn342`Q%Y1Q)poIk zZt9eN5fP?U3Z5sDvhM*RKIo$g?0|_Gzw_mJ8AbPbI5Nrj zvCQZB`D@eKQ#?rBB8W!k`L0Y&*XQb-$>;W&SodB14P<8G1_nMxnA{K$G-l`~U10gk}WCgewKIQ{xCJ{wM@ycGsNR*bP$*F%{p_I#a0Ii~a2BXc;zI?G=9 zWY8=Cg#6}GcJO&fG6rA-TiR%4dQnoiwD0rx@TWndD{ zo_EzW{-XD;Jmk?6b%V> zDSFpVel%V`NVP&`$k1nFAVEi){Fip3c`Ls#y3tD!E93dh?1}yTszg;YVziz!U?zrt zrsog6sl5{83;)Xi*xC_Nd#G;^R)eJ-@}YsOlJjp{Y0g8X=!_>01a1)Za8_M69xqdUd>d(_Jxng>?2ORq`0wp9l0baHAK zRx@U;I%)eOHrF6hTyr*#L$X==lj%_==aQ?nK%tF31%-ZBi(D9?X{yGt-hif#CgeJ^|A(HN|w#DHSWa&aa)Xdsr1!F2qK&j@y##lU#CuIlOCUgFZ zO+)_4rHsPPZBxp4b*wFK2z>cPuKH5tV4KEs!EsyR)oSfj)x%)l#CEu_86%Fc)Bq7n zwp)Dk7RPIEbteM)rH@YoDm;Y%3(cx74^IE4tIGLe(}-+xn78*@4>XQf1FcKkr(b6u zB8ErM02Te(@~-Uj?a@V9j0g>!XZ4~zTtEc6w7{PUG-pPTw!Q97i4Q05vFtdnoQv#A zMCH>A>hR(5E3QM%8sy049U!DfQv8AY=-=F6KTQa;rMt94T}E!O%8|O|d*Ad}!G$of z0c){dI7)z6ibypPte?`#Ki^RmhQs!mtz2DR*!KDXDZ`Am-&H&Llxz#NuX~$scO5n+ z4I2oWlpfv8gf=?4AkgqjV^8Qt-Yy3;Q0V%#PUhYLQ)?64B1rr2D+D}T<$wglkSS$* zm=nE?DdnM^mOM(CPZh$IWWgDck73N52qc!({QJqL=X)u(O8 z9o|*n66vl7MuT|EqRo~O0~*6Mz1!e1ruS+Kk+WoS!SAgHqmlC_)`)zr3@n{%$PG5Ll(nz@v(Z%FfH zse!D17%F&%n`dm?foVI1Et<}ef)WH52!i<*>eIHq?-8{yuV=p}h#HKno*@8Kp4{Lk z=yY-vvoGg)b0Lde<)Ey4J~aC`;bu5GYIYTDIG>9D9$oxeEpeQI>ehNq{RSZb07!p0 zdPgUBD`Ussk^*h2nzqXvnBK(IF9K)U)4({BH*w+bqI|)%SxE4v)IR1C7%2-(tXedCkuV9w{4dSOT=w7PEQHw?U7I}bLA;vUv$V`3SlWxATE3- z)XtA@pSQMvRz6dz6xj@}rTZ4CY`@7V>3N3gYarwhlQ2BS`_Rnv_IW0ea4%Wn6lY?_ zS~1Dl9I4}iVS9LyW2|z1$t#US7kFOYO4`~Jrb`K~h`&PEdFu4u)R`VPp%-*=WWIXFy{EXO$1bQ%D(k9u;Mw+cZ@B%G z2MQ=9@h%{FrRB8zySW2w-u5|C#%6gVy$h$@OCDDb1rqkj)UqSSb42aed*J1SdMljG z>`d(Q$P)X{^0%g#Cr)KfNN|t1*Bm_|Ib>V)EU3z<$3#c-#n{hHBe)U{qN;4QN^y2? z$_EJzA@t}*?lNT0iPNYSyaKj$;(OZ491$mjkS+`{Z1k;=-Gm1>C#Rv0@Q%Q#UtHDa zIH?{TTZPv-CyLawl(@ z8$a6nxzvIyTQ0@$ao!XS6UZO0nU7zCV{%pA2k_BukvQ-+tSuL#D5W8p+kSUF!|la6 zemnYet?6(rF>RUk9J?E|(Lc}rGjSNS1^hVU@S(<&)b2*c2gxO|5d(;5vN z21+Y(KYN)-;RH>O7d{gOudzz~86{o?l(WdhJY`64_eQgX5 zeLx9uU73r$rPJw^Sv{88Anq}Upt3>AwD z#4{`G?tu8-G4kjZk({7$rlS_`DExuLgR-S$GeAbgW_(;A)EAp;O7~blA&y5}+7Dn1N%j-~w8mClmGz1fZZ^hiLXSJn| z)hjWCPOe(FSX&g1)lQ34FE2k^51CsdFpD+B#7%tblfseLwVD;tylrk3vpl-KzU?7O zoVW}s1oK%Z*~w?+F3sMX)mZHh%a}R2AfVV}+0;!82c&9oZ_Oiq8ie^mnjy^uM|M6;ib%FM2ho9zmU&5{zh1-!)#+Z z^ED`j%K5S1WrUqX4m8U4!k;@YlB$63^d}M}vA3Cja=+s-8DgjEDI@n_(1+DM3=tH)nb*CLIoaU}nlnd8yCe|qV31Ihu7)yiCxeVo1aDU{!JGYl zx*)rbY!g$ez%B_0>w_B85bZr2q-m@ynmK;WT{wM|8i@B(y`A0V>FGQ?uW2lfw`dOU zwC;2f;}f-C8xC#k>L+%%FMQ%_kaeJV2}v32q#ngl3tr!m7LgJ=4s}xk1Rz+t$Hhqe z;u*2Y=oac44!=Kn@C0&)Tf_&UqQzlCKU1pbXlA)!y&=b5V*vSzRy?*ACo>O?3DxsX# z%A~RinO4QzttZ&0=78n#VZ#s^1XULALl39wyWh=H#2QA5iITuCkL@(xWOf;ERE3Rh zKTwKPOL4z=vPiYIyQ=?oHS46uAk|L#2t<2KG#VarB#;K4!?_ga?hLIb+9cWFiYOhX z*IPRNoh`^o@%y0{kjq`S1b9Y^JGAN~?%;5;njNBS(YA(qtva7H2ujuta9*@_Zzn+x z8Z1jbf%)L?)un^3DH^}xyWs|7}KAaryVFU)g_gbbnVP4V?OI23Q&@?|iT zVd9_&8RGFyk>!NQ5KnI*%@&`{_m&)l5#ry#vtQO1eAoJaWa`kE$;H7REsGM~vn>Z5 zSb<$9#nQ=Gfu4rVEPk}OduYyIYAbsR$&d2DlCPht_7~k}CKp=L14@OmZMjc~y*#Eo za7QUc;{xC$4JHIYkF0nJVpHq%qH(J+CU~eqL0p*{?Ln&{C97$@d3@TuW7fE`+JlYQ zd5iUxwQR()IM)Oqgw$l`CZ5zjvDwv>Zwn`~dv%K0qL79jocZ`FxOg+KaKeD&eGXKOjIz@T z_`LX*Cq4=KJB*;W?icu2F&r%p8wKO?oG^H6rYR%%59KF9&OBn@`HfqZsC^6kE7{T_ zS2vU<@s~nKthY!Wci;b`Z{)FNmF|AMBJ^6#B>%%V{#Nh&R|)Hn0_dNGtl!I@fzjRJ zJGCg=mj6K=0}-(pP^ zTuBW7?xJLvJM-|}r#DmOr54ubx-j)jat){S+g@q`@Awooo{yruhJVq-_ zhEdEd@woSeLYj$$P{uceBABOdOy#EgPY)Y;5Z9J;|RI=qQz zQH%|jT8rK{!Ylvy2%l=G7;0GPe84DVUBsL~6));fWSUzrjY_BQ07$ABVXzr|^n22~ zZy%?E?!HdRd>kRGOPe{a|Fmp^&_PHvXZe{hP(|fVr73LVJY?JYoXcAEidDn4AB?JI zJ>F7J^AzZZD& zgopSZxx@w~g9$XWZ&2Ll@F5)BKe7SgL5la7U)KvADh{sUCyM|u%6C(>)2E1on{sFy zfY1o59+pU5kuS0=WNO!a*p)`PJAvBd&SW^tg>W<7;eslmle7~V2q9RU(;;Ol%)(s> zy4Rh3x8#SCMXeJL7F%)7)D6IGUkwe{Z+HnnQ=OOcT^YDj}hB$#$EHrX_Fr zqB`dQIrSZfLbP7+6vu$^TxpRCN}>Vd)YIldrRdLD5=5?qeOVVuR70fN50@N0+S#)@Hu3(NGp_b7AZ zMX67EwKlQ~!d^3v?YR6s7njRd=O!P#sqZ39*??=$4bQK+oByohEafXJ47@7x#vk45 zf3dXAj!w4L|I_7vYcc>(A20oBnHe+aCg>R^uYDlyF%&Bf(OnjAKi)52+X>_HODe9x zu)5Te!fvP90bTx7vk{T z-pzK@+LwwlDvVb)X=)TA5*WOZ*Y`B*yqy{sat)LO@yXAuS-nW6TotScsD}YK<0GoU zKclnN7ThKOv{&^e3Ve4e{RF9hYE!ZLC}Ca%1IBRg?;Seb{PTMCU5fCYCmkjQ*P`#0 zbFqAHe(q65_`9yHicS@pGBl`2BtNtX8akFFN)w`NgK z0fVW32mB=z|Hsh$SJ1!5#D78p0LnA~z<)%@zl#4oV)?8172RLN{}sRdD*bmi@mJ{% f#=l4#{-4uOkcN6y;@=7eNC4AU9<;OkcJ}`Oo@uQ_ literal 0 HcmV?d00001 diff --git a/analyze_all_printers.py b/analyze_all_printers.py new file mode 100644 index 0000000..9195670 --- /dev/null +++ b/analyze_all_printers.py @@ -0,0 +1,183 @@ +#!/usr/bin/env python3 +""" +Comprehensive printer analysis to create separate templates +""" + +import csv +import os +from collections import defaultdict + +# Base OIDs +SUPPLY_DESC_OID = "1.3.6.1.2.1.43.11.1.1.6.1" +SUPPLY_MAX_OID = "1.3.6.1.2.1.43.11.1.1.8.1" +SUPPLY_LEVEL_OID = "1.3.6.1.2.1.43.11.1.1.9.1" +MODEL_OID = "1.3.6.1.2.1.25.3.2.1.3.1" + +def parse_csv(filepath): + """Parse printer SNMP CSV file""" + data = {} + try: + with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: + for line in f: + parts = line.strip().split(',', 2) + if len(parts) >= 2: + oid = parts[0] + value = parts[1].strip('"') + data[oid] = value + except Exception as e: + print(f"Error reading {filepath}: {e}") + return data + +def analyze_printer(filepath): + """Analyze a single printer's supply configuration""" + data = parse_csv(filepath) + printer_name = os.path.basename(filepath).replace('.csv', '') + + # Get model + model = data.get(MODEL_OID, "Unknown") + + # Get all supply descriptions + supplies = {} + for i in range(1, 25): + desc_oid = f"{SUPPLY_DESC_OID}.{i}" + level_oid = f"{SUPPLY_LEVEL_OID}.{i}" + max_oid = f"{SUPPLY_MAX_OID}.{i}" + + if desc_oid in data: + desc = data[desc_oid] + level = data.get(level_oid, "N/A") + max_cap = data.get(max_oid, "N/A") + supplies[i] = { + 'description': desc, + 'level': level, + 'max': max_cap + } + + return { + 'name': printer_name, + 'model': model, + 'supplies': supplies + } + +def main(): + output_dir = '/home/camp/output' + + # Categorize printers + hp_modern = [] # HP LaserJet Pro, newer models + hp_legacy = [] # HP LaserJet 600 series, older models + xerox_color = [] # Xerox VersaLink Color + xerox_mono = [] # Xerox VersaLink B&W + + print("=" * 100) + print("COMPREHENSIVE PRINTER ANALYSIS FOR TEMPLATE CREATION") + print("=" * 100) + + # Analyze all printers + for filename in sorted(os.listdir(output_dir)): + if not filename.endswith('.csv'): + continue + + filepath = os.path.join(output_dir, filename) + result = analyze_printer(filepath) + model = result['model'] + + # Categorize + if 'HP LaserJet Pro' in model or 'HP LaserJet 4' in model: + hp_modern.append(result) + elif 'HP LaserJet' in model or 'hp' in model.lower(): + hp_legacy.append(result) + elif 'Xerox VersaLink C' in model: + xerox_color.append(result) + elif 'Xerox VersaLink B' in model: + xerox_mono.append(result) + + # Print summaries + print(f"\nFound {len(hp_modern)} HP Modern printers") + print(f"Found {len(hp_legacy)} HP Legacy printers") + print(f"Found {len(xerox_color)} Xerox Color printers") + print(f"Found {len(xerox_mono)} Xerox Mono printers") + + # Analyze each category + categories = [ + ("HP MODERN (LaserJet Pro 4xxx)", hp_modern), + ("HP LEGACY (LaserJet 600)", hp_legacy), + ("XEROX COLOR (VersaLink C)", xerox_color), + ("XEROX MONO (VersaLink B)", xerox_mono) + ] + + for cat_name, printers in categories: + if not printers: + continue + + print("\n" + "=" * 100) + print(f"{cat_name} - {len(printers)} printers") + print("=" * 100) + + # Show all printers in this category + for printer in printers: + print(f"\n{printer['name']}") + print(f"Model: {printer['model']}") + if printer['supplies']: + print(f"{'Index':<7} {'Description':<65} {'Level':<12} {'Max'}") + print("-" * 100) + for idx, supply in sorted(printer['supplies'].items()): + desc = supply['description'][:63] + print(f"{idx:<7} {desc:<65} {supply['level']:<12} {supply['max']}") + else: + print("No supplies found") + + # Generate OID mappings for each category + print("\n" + "=" * 100) + print("RECOMMENDED OID MAPPINGS FOR TEMPLATES") + print("=" * 100) + + for cat_name, printers in categories: + if not printers: + continue + + print(f"\n{cat_name}:") + print("-" * 100) + + # Collect all indices and their descriptions + index_map = defaultdict(set) + for printer in printers: + for idx, supply in printer['supplies'].items(): + # Normalize description + desc = supply['description'].lower() + if 'black' in desc and 'toner' in desc: + index_map[idx].add('Black Toner') + elif 'cyan' in desc and 'toner' in desc: + index_map[idx].add('Cyan Toner') + elif 'magenta' in desc and 'toner' in desc: + index_map[idx].add('Magenta Toner') + elif 'yellow' in desc and 'toner' in desc: + index_map[idx].add('Yellow Toner') + elif 'black' in desc and 'drum' in desc: + index_map[idx].add('Black Drum') + elif 'cyan' in desc and 'drum' in desc: + index_map[idx].add('Cyan Drum') + elif 'magenta' in desc and 'drum' in desc: + index_map[idx].add('Magenta Drum') + elif 'yellow' in desc and 'drum' in desc: + index_map[idx].add('Yellow Drum') + elif 'waste' in desc: + index_map[idx].add('Waste Container') + elif 'fuser' in desc: + index_map[idx].add('Fuser') + elif 'transfer belt' in desc: + index_map[idx].add('Transfer Belt') + elif 'transfer roll' in desc: + index_map[idx].add('Transfer Roller') + elif 'maintenance' in desc: + index_map[idx].add('Maintenance Kit') + + # Print consistent mappings + for idx in sorted(index_map.keys()): + components = index_map[idx] + if len(components) == 1: + print(f" Index {idx}: {list(components)[0]} โœ“") + else: + print(f" Index {idx}: VARIES - {', '.join(components)}") + +if __name__ == "__main__": + main() diff --git a/analyze_supplies.py b/analyze_supplies.py new file mode 100644 index 0000000..65346c3 --- /dev/null +++ b/analyze_supplies.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +""" +Analyze SNMP supply data across multiple printers +to validate OID index mappings +""" + +import csv +import os +from collections import defaultdict + +# Base OIDs we care about +SUPPLY_DESC_OID = "1.3.6.1.2.1.43.11.1.1.6.1" # prtMarkerSuppliesDescription +SUPPLY_MAX_OID = "1.3.6.1.2.1.43.11.1.1.8.1" # prtMarkerSuppliesMaxCapacity +SUPPLY_LEVEL_OID = "1.3.6.1.2.1.43.11.1.1.9.1" # prtMarkerSuppliesLevel +MODEL_OID = "1.3.6.1.2.1.25.3.2.1.3.1" # hrDeviceDescr + +def parse_csv(filepath): + """Parse printer SNMP CSV file""" + data = {} + try: + with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: + for line in f: + parts = line.strip().split(',', 2) + if len(parts) >= 2: + oid = parts[0] + value = parts[1].strip('"') + data[oid] = value + except Exception as e: + print(f"Error reading {filepath}: {e}") + return data + +def analyze_printer(filepath): + """Analyze a single printer's supply configuration""" + data = parse_csv(filepath) + printer_name = os.path.basename(filepath).replace('.csv', '') + + # Get model + model = data.get(MODEL_OID, "Unknown") + + # Get all supply descriptions + supplies = {} + for i in range(1, 20): # Check indices 1-20 + desc_oid = f"{SUPPLY_DESC_OID}.{i}" + level_oid = f"{SUPPLY_LEVEL_OID}.{i}" + max_oid = f"{SUPPLY_MAX_OID}.{i}" + + if desc_oid in data: + desc = data[desc_oid] + level = data.get(level_oid, "N/A") + max_cap = data.get(max_oid, "N/A") + supplies[i] = { + 'description': desc, + 'level': level, + 'max': max_cap + } + + return { + 'name': printer_name, + 'model': model, + 'supplies': supplies + } + +def main(): + output_dir = '/home/camp/output' + + # Group printers by manufacturer + hp_printers = [] + xerox_printers = [] + + print("=" * 80) + print("SNMP SUPPLY INDEX VALIDATION") + print("=" * 80) + print() + + # Analyze all printers + for filename in sorted(os.listdir(output_dir)): + if not filename.endswith('.csv'): + continue + + filepath = os.path.join(output_dir, filename) + result = analyze_printer(filepath) + + if 'HP' in result['model'] or 'hp' in result['model']: + hp_printers.append(result) + elif 'Xerox' in result['model']: + xerox_printers.append(result) + + # Analyze HP printers + print("\n" + "=" * 80) + print("HP PRINTERS - Supply Index Mapping") + print("=" * 80) + + # Get common indices across HP printers + hp_indices = defaultdict(list) + for printer in hp_printers[:3]: # Sample first 3 + print(f"\n{printer['name']}") + print(f"Model: {printer['model']}") + print(f"{'Index':<7} {'Description':<50} {'Level':<10} {'Max'}") + print("-" * 80) + for idx, supply in sorted(printer['supplies'].items()): + desc_short = supply['description'][:48] + print(f"{idx:<7} {desc_short:<50} {supply['level']:<10} {supply['max']}") + hp_indices[idx].append(desc_short) + + # Analyze Xerox printers + print("\n" + "=" * 80) + print("XEROX PRINTERS - Supply Index Mapping") + print("=" * 80) + + xerox_indices = defaultdict(list) + for printer in xerox_printers[:3]: # Sample first 3 + print(f"\n{printer['name']}") + print(f"Model: {printer['model']}") + print(f"{'Index':<7} {'Description':<50} {'Level':<10} {'Max'}") + print("-" * 80) + for idx, supply in sorted(printer['supplies'].items()): + desc_short = supply['description'][:48] + print(f"{idx:<7} {desc_short:<50} {supply['level']:<10} {supply['max']}") + xerox_indices[idx].append(desc_short) + + # Summary + print("\n" + "=" * 80) + print("SUMMARY - Index Mapping Patterns") + print("=" * 80) + + print("\nHP Printers:") + print("-" * 80) + common_hp = {} + for idx, descs in sorted(hp_indices.items()): + # Find common pattern + desc_types = set([d.split(',')[0].split(' ')[0] for d in descs]) + if len(desc_types) == 1: + common_hp[idx] = list(desc_types)[0] + print(f"Index {idx}: {list(desc_types)[0]} (consistent across {len(descs)} printers)") + + print("\nXerox Printers:") + print("-" * 80) + common_xerox = {} + for idx, descs in sorted(xerox_indices.items()): + # Find common pattern + desc_types = set([d.split(',')[0].split('(')[0].strip() for d in descs]) + if len(desc_types) == 1: + common_xerox[idx] = list(desc_types)[0] + print(f"Index {idx}: {list(desc_types)[0]} (consistent across {len(descs)} printers)") + + # Validation against current template + print("\n" + "=" * 80) + print("VALIDATION - Current Template vs Actual Data") + print("=" * 80) + + print("\nCurrent Template Assumptions:") + print(" 1-4: Toner (Black, Cyan, Magenta, Yellow)") + print(" 5-8: Drums (R1, R2, R3, R4) - XEROX SPECIFIC") + print(" 9: Waste Toner Container") + print(" 10: Transfer Belt Cleaner") + print(" 11: Second Bias Transfer Roll") + + print("\nโœ“ = Correct, โœ— = Incorrect, ? = Varies by model") + + # Check toner + print("\nToner Indices (1-4):") + for idx in range(1, 5): + hp_match = common_hp.get(idx, '').lower() + xerox_match = common_xerox.get(idx, '').lower() + status = "โœ“" if 'toner' in hp_match and 'toner' in xerox_match else "?" + print(f" Index {idx}: {status} HP='{common_hp.get(idx, 'N/A')}' Xerox='{common_xerox.get(idx, 'N/A')}'") + +if __name__ == "__main__": + main() diff --git a/check_unknown_printers.py b/check_unknown_printers.py new file mode 100644 index 0000000..55a4c23 --- /dev/null +++ b/check_unknown_printers.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +"""Check the unknown Xerox printers""" + +import os + +SUPPLY_DESC_OID = "1.3.6.1.2.1.43.11.1.1.6.1" +SUPPLY_MAX_OID = "1.3.6.1.2.1.43.11.1.1.8.1" +SUPPLY_LEVEL_OID = "1.3.6.1.2.1.43.11.1.1.9.1" +MODEL_OID = "1.3.6.1.2.1.25.3.2.1.3.1" + +def parse_csv(filepath): + """Parse printer SNMP CSV file""" + data = {} + try: + with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: + for line in f: + parts = line.strip().split(',', 2) + if len(parts) >= 2: + oid = parts[0] + value = parts[1].strip('"') + data[oid] = value + except Exception as e: + print(f"Error: {e}") + return data + +output_dir = '/home/camp/output' + +# Check the unknown printers +for filename in ['printer-10-80-92-252.printer.geaerospace.net.csv', + 'printer-10-80-92-253.printer.geaerospace.net.csv', + 'printer-10-80-92-49.printer.geaerospace.net.csv', + 'printer-10-80-92-62.printer.geaerospace.net.csv']: + + filepath = os.path.join(output_dir, filename) + if not os.path.exists(filepath): + print(f"File not found: {filename}") + continue + + data = parse_csv(filepath) + model = data.get(MODEL_OID, "Unknown") + + print("=" * 100) + print(f"File: {filename}") + print(f"Model: {model}") + print("=" * 100) + + # Get all supply descriptions + print(f"{'Index':<7} {'Description':<65} {'Level':<12} {'Max'}") + print("-" * 100) + + for i in range(1, 25): + desc_oid = f"{SUPPLY_DESC_OID}.{i}" + level_oid = f"{SUPPLY_LEVEL_OID}.{i}" + max_oid = f"{SUPPLY_MAX_OID}.{i}" + + if desc_oid in data: + desc = data[desc_oid][:63] + level = data.get(level_oid, "N/A") + max_cap = data.get(max_oid, "N/A") + print(f"{i:<7} {desc:<65} {level:<12} {max_cap}") + + print() diff --git a/compare_xerox.sh b/compare_xerox.sh new file mode 100644 index 0000000..a7a9ce0 --- /dev/null +++ b/compare_xerox.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +echo "=== XEROX SUPPLY COMPARISON ===" +echo + +for printer in /home/camp/output/printer-10-80-92-{20,25,49}.printer.geaerospace.net.csv; do + name=$(basename "$printer" .csv) + model=$(grep -a "^1.3.6.1.2.1.25.3.2.1.3.1," "$printer" | head -1 | cut -d',' -f2 | tr -d '"') + + echo "=====================" + echo "$name" + echo "Model: $model" + echo "=====================" + + echo "Index | Description | Level | Max | Notes" + echo "------|----------------------|-------|--------|------" + + for i in 1 2 3 4 5 6 7 8 9 10 11 12; do + desc=$(grep -a "^1.3.6.1.2.1.43.11.1.1.6.1.$i," "$printer" | head -1 | cut -d',' -f2 | tr -d '"' | cut -c1-20) + level=$(grep -a "^1.3.6.1.2.1.43.11.1.1.9.1.$i," "$printer" | head -1 | cut -d',' -f2) + max=$(grep -a "^1.3.6.1.2.1.43.11.1.1.8.1.$i," "$printer" | head -1 | cut -d',' -f2) + + if [ -n "$desc" ]; then + printf "%-6s| %-20s | %-5s | %-6s |" "$i" "$desc" "$level" "$max" + + # Calculate percentage if possible + if [ -n "$level" ] && [ -n "$max" ] && [ "$max" != "-2" ] && [ "$max" != "-3" ] && [ "$max" -gt 0 ] 2>/dev/null; then + pct=$((level * 100 / max)) + echo " ${pct}%" + else + echo " N/A" + fi + fi + done + echo +done diff --git a/extract_summary.py b/extract_summary.py new file mode 100644 index 0000000..097bf76 --- /dev/null +++ b/extract_summary.py @@ -0,0 +1,2647 @@ +#!/usr/bin/env python3 +""" +Extract key printer information from SNMP scan CSVs +Converts all toner levels to percentages (0-100%) +""" + +import csv +import os +import sys +import re +from pathlib import Path +from datetime import datetime + + +def clean_value(value): + """Clean up encoding issues in SNMP values""" + if not value: + return value + + # Remove common encoding prefixes + if value.startswith('รฝรจ'): + value = value[2:] + + # Remove null characters and other control chars + value = ''.join(char for char in value if ord(char) >= 32 or char in '\n\r\t') + + return value.strip() + + +def extract_toner_info(csv_file): + """ + Extract comprehensive toner and supply information from CSV + Maps supply indices to their levels and capacities + """ + supplies = {} + toner_levels_raw = {} # Raw values from 43.11.1.1.9 + toner_max_capacity = {} # Max capacity from 43.11.1.1.8 + supply_current = {} # Current from 43.10.2.1.9 + supply_max = {} # Max from 43.10.2.1.4 + hp_designjet_levels = {} # HP DesignJet ink levels from proprietary OID + + with open(csv_file, 'r', encoding='utf-8') as f: + reader = csv.DictReader(f) + + for row in reader: + oid = row['OID'] + value = clean_value(row['Value']) + + # Extract supply descriptions (43.11.1.1.6) + if '1.3.6.1.2.1.43.11.1.1.6' in oid: + index = oid.split('.')[-1] + if index not in supplies: + supplies[index] = {} + supplies[index]['description'] = value + + # Extract toner max capacity (43.11.1.1.8.1.X) + elif '1.3.6.1.2.1.43.11.1.1.8.1' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + toner_max_capacity[index] = int(value) + except: + pass + + # Extract supply max capacity (43.10.2.1.4) + elif '1.3.6.1.2.1.43.10.2.1.4' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + supply_max[index] = int(value) + except: + pass + + # Extract supply current level (43.10.2.1.9) + elif '1.3.6.1.2.1.43.10.2.1.9' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + supply_current[index] = int(value) + except: + pass + + # Direct toner level readings (43.11.1.1.9.1.X) + elif '1.3.6.1.2.1.43.11.1.1.9.1' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + toner_levels_raw[index] = int(value) + except: + pass + + # HP DesignJet ink levels (1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.X.1.0) + elif '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.' in oid: + parts = oid.split('.') + # OID format: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.{cartridge_index}.1.0 + # Example: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.1.1.0 (Matte Black) + if len(parts) >= 18: + index = parts[17] # Cartridge index (1-6) + try: + hp_designjet_levels[index] = int(value) + except: + pass + + return supplies, toner_levels_raw, toner_max_capacity, supply_current, supply_max, hp_designjet_levels + + +def map_hp730_color(part_number): + """ + Map HP 730 part numbers to actual ink colors + Returns color name or None if not recognized + """ + part_number = part_number.upper().strip() + + # HP 730 130ml and 300ml cartridges + hp730_map = { + # 130ml cartridges + 'P2V62A': 'Cyan', + 'P2V63A': 'Magenta', + 'P2V64A': 'Yellow', + 'P2V65A': 'Matte Black', + 'P2V66A': 'Photo Black', + 'P2V67A': 'Gray', + # 300ml cartridges (verified from actual T1700dr installation) + 'P2V68A': 'Cyan', + 'P2V69A': 'Magenta', + 'P2V70A': 'Yellow', + 'P2V71A': 'Matte Black', + 'P2V72A': 'Gray', + 'P2V73A': 'Photo Black', + } + + # Extract part number from description like "HP 730 ( P2V72A )" + for pn, color in hp730_map.items(): + if pn in part_number: + return color + + return None + + +def calculate_toner_percentage(toner_idx, toner_value, toner_max_capacity, supply_current, supply_max, printer_model=''): + """ + Calculate toner percentage from various sources + Returns: (percentage, display_string) + """ + # Negative values mean not installed + if toner_value < 0: + return (None, "Not installed") + + # If value is 0-100, it's already a percentage + if 0 <= toner_value <= 100: + return (toner_value, f"{toner_value}%") + + # First try: Use toner max capacity (43.11.1.1.8.1.X) if available + # This is the correct OID for HP printers that report absolute page counts + if toner_idx in toner_max_capacity: + max_val = toner_max_capacity[toner_idx] + if max_val > 0: + percentage = int((toner_value / max_val) * 100) + return (percentage, f"{percentage}% ({toner_value:,}/{max_val:,})") + + # Fallback: Use known static max capacities for specific printer models + # This handles cases where the max OID isn't scanned + model_lower = printer_model.lower() + known_max = None + if 'laserjet 4250' in model_lower: + known_max = 20000 # HP LaserJet 4250 (Q5942X cartridge) + elif 'laserjet 4200' in model_lower: + known_max = 12000 # HP LaserJet 4200 (Q1338A cartridge) + elif 'laserjet 4300' in model_lower: + known_max = 18000 # HP LaserJet 4300 (Q1339A cartridge) + elif 'laserjet 4350' in model_lower: + known_max = 20000 # HP LaserJet 4350 (Q5942X cartridge) + + if known_max and toner_value > 100: # Only use if value is absolute pages + percentage = int((toner_value / known_max) * 100) + return (percentage, f"{percentage}% ({toner_value:,}/{known_max:,})") + + # Try to find matching supply data to calculate percentage + # Often toner index '1' = supply '1', '2' = supply '2', etc. + if toner_idx in supply_max and toner_idx in supply_current: + max_val = supply_max[toner_idx] + current_val = supply_current[toner_idx] + if max_val > 0: + percentage = int((current_val / max_val) * 100) + return (percentage, f"{percentage}% ({current_val:,}/{max_val:,})") + + # Alternative: Try supply index '1' for the first toner + if '1' in supply_max and '1' in supply_current: + max_val = supply_max['1'] + current_val = supply_current['1'] + if max_val > 0 and toner_value > 100: + # Estimate percentage based on pages + percentage = int((toner_value / max_val) * 100) + if percentage > 100: + # Raw value is absolute pages, not related to this max + # Just show the raw percentage estimate + # Assume typical cartridge is ~3000-20000 pages + if toner_value < 100: + return (toner_value, f"{toner_value}%") + elif toner_value < 500: + return (10, f"~10% ({toner_value:,} pages remaining)") + elif toner_value < 2000: + return (25, f"~25% ({toner_value:,} pages remaining)") + elif toner_value < 5000: + return (50, f"~50% ({toner_value:,} pages remaining)") + elif toner_value < 10000: + return (75, f"~75% ({toner_value:,} pages remaining)") + else: + return (90, f"~90% ({toner_value:,} pages remaining)") + return (percentage, f"{percentage}%") + + # If we can't calculate, estimate based on page count ranges + if toner_value > 100: + if toner_value < 500: + return (10, f"~10% ({toner_value:,} pages remaining)") + elif toner_value < 2000: + return (25, f"~25% ({toner_value:,} pages remaining)") + elif toner_value < 5000: + return (50, f"~50% ({toner_value:,} pages remaining)") + elif toner_value < 10000: + return (75, f"~75% ({toner_value:,} pages remaining)") + else: + return (90, f"~90% ({toner_value:,} pages remaining)") + + return (None, f"{toner_value}") + + +def get_fqdn_from_ip(ip_address): + """Generate FQDN from IP address""" + # Convert IP like 10.80.92.56 to Printer-10-80-92-56.printer.geaerospace.net + ip_with_dashes = ip_address.replace('.', '-') + return f"Printer-{ip_with_dashes}.printer.geaerospace.net" + + +def normalize_model_name(model_name): + """Normalize model name by removing firmware/system version info""" + # Remove common firmware/version patterns + # Examples: + # "Xerox VersaLink C7125 Color MFP; System 69.21.21, Controller..." -> "Xerox VersaLink C7125" + # "HP LaserJet Pro M404n" stays the same + + # Split on semicolon (common separator for firmware info) + model_clean = model_name.split(';')[0].strip() + + # Remove common version patterns in parentheses + import re + model_clean = re.sub(r'\s*\([^)]*\)', '', model_clean) + + # Remove trailing descriptors that are too specific + # Keep: "Color MFP", "PostScript", etc. + # But remove system versions, dates, etc. + + return model_clean.strip() + + +def normalize_supply_description(description): + """Normalize supply description by removing serial numbers and other unique identifiers""" + import re + + # Remove serial numbers (e.g., ";SN804A5C260...", ";SNunknown") + # Match ;SN followed by anything (letters, numbers, "unknown", etc.) + desc_clean = re.sub(r';SN\w+.*$', '', description) + + # Remove trailing dots/ellipsis + desc_clean = desc_clean.rstrip('.') + + # Clean up extra whitespace + desc_clean = ' '.join(desc_clean.split()) + + return desc_clean.strip() + + +def fix_unknown_part_numbers(description, model): + """ + Replace 'PN unknown' with known part numbers based on printer model + """ + # Normalize model name for matching + normalized_model = normalize_model_name(model) + + # Check if this model has known part number mappings + if normalized_model not in XEROX_PART_NUMBER_MAP: + return description + + # Extract the supply type from description (e.g., "Fuser, PN unknown" -> "Fuser") + supply_type = description.split(',')[0].strip() + + # Check if we have a mapping for this supply type + part_map = XEROX_PART_NUMBER_MAP[normalized_model] + if supply_type in part_map: + # Replace "PN unknown" with the actual part number + known_pn = part_map[supply_type] + return description.replace('PN unknown', f'PN {known_pn}') + + return description + + +# Known part numbers for Xerox models that report generic descriptions +XEROX_PART_NUMBER_MAP = { + 'Xerox VersaLink C7125 Color MFP': { + 'Black Toner Cartridge': '006R01820', + 'Cyan Toner Cartridge': '006R01821', + 'Magenta Toner Cartridge': '006R01822', + 'Yellow Toner Cartridge': '006R01823', + }, + 'Xerox VersaLink C405': { + 'Black Toner Cartridge': '106R03536', + 'Cyan Toner Cartridge': '106R03538', + 'Magenta Toner Cartridge': '106R03539', + 'Yellow Toner Cartridge': '106R03537', + }, + 'Xerox VersaLink B7125 MFP': { + 'Toner Cartridge': '006R01817', + }, + 'Xerox VersaLink B405': { + 'Toner Cartridge': '106R03580', # Standard capacity (5.9K pages) + }, + 'Xerox VersaLink B400': { + 'Toner Cartridge': '106R03580', # Standard capacity (5.9K pages) + }, + 'Xerox EC8036 Color': { + 'Fuser': '008R13063', # 110V + 'Second Bias Transfer Roll': '008R13064', + }, + 'Xerox AltaLink C8135': { + 'Fuser': '008R13102', # 110V + 'Second Bias Transfer Roll': '008R08103', + }, +} + +# Printer supply compatibility groups based on research +COMPATIBILITY_GROUPS = [ + { + 'priority': 'High', + 'name': 'HP LaserJet Pro M404n + M406 Consolidation', + 'models': ['HP LaserJet Pro M404n', 'HP LaserJet Pro M406'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CF258A (58A Standard)', 'CF258X (58X High Yield)']}, + {'type': 'Fuser', 'parts': ['RM2-6461 / RM2-6342']}, + ], + 'benefit': 'Both models share identical toner and fuser - consolidate to single SKUs' + }, + { + 'priority': 'High', + 'name': 'HP DesignJet Plotter Ink Sharing', + 'models': ['HP DesignJet T1700dr', 'HP DesignJet T1600', 'HP DesignJet T2600'], + 'shared_supplies': [ + {'type': 'Ink Cartridges', 'parts': [ + 'HP 730 series (P2V62A-P2V72A)', + 'All colors: Matte Black, Photo Black, Cyan, Magenta, Yellow, Gray' + ]}, + ], + 'benefit': 'T1700dr shares all HP 730 inks with T1600/T2600 series' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 90A/X Family', + 'models': ['HP LaserJet M4555', 'HP LaserJet M602', 'HP LaserJet M603'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CE390A (90A Standard)', 'CE390X (90X High Yield)']}, + ], + 'benefit': 'All use CE390A/X toner cartridges' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 42A/X Family', + 'models': ['HP LaserJet 4250', 'HP LaserJet 4350'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['Q5942A (42A Standard)', 'Q5942X (42X High Yield)']}, + ], + 'benefit': 'Compatible toner across 4250/4350 models' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 55X Family', + 'models': ['HP LaserJet P3015', 'HP LaserJet P3010'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CE255X (55X High Yield)']}, + ], + 'benefit': 'Share CE255X high-yield toner cartridges' + }, + { + 'priority': 'Medium', + 'name': 'Xerox VersaLink C405/C400 Series', + 'models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + '106R03536 (Black)', + '106R03538 (Cyan)', + '106R03539 (Magenta)', + '106R03537 (Yellow)' + ]}, + ], + 'benefit': 'C405 and C400 share identical 106R035xx toner series' + }, + { + 'priority': 'Medium', + 'name': 'Xerox VersaLink B405/B400 Series', + 'models': ['Xerox VersaLink B405', 'Xerox VersaLink B400'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + '106R03580 (Standard Yield)', + '106R03581 (High Yield)', + '106R03582 (Extra High Yield)' + ]}, + ], + 'benefit': 'B405 and B400 share 106R035xx toner family' + }, + { + 'priority': 'Critical', + 'name': 'HP LaserJet Pro M254dw Toner Correction', + 'models': ['HP LaserJet Pro M254dw'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + 'CF500A (202A Black)', + 'CF501A (202A Cyan)', + 'CF502A (202A Magenta)', + 'CF503A (202A Yellow)' + ]}, + ], + 'benefit': 'IMPORTANT: Uses CF500A (202A) series, NOT W2020A (414A). Verify existing stock!' + }, +] + + +def replace_generic_xerox_pn(description, model_name): + """Replace generic Xerox part numbers with known specific ones based on model""" + # Check if we have a mapping for this model + if model_name not in XEROX_PART_NUMBER_MAP: + return description + + # Find which cartridge type this is + for cartridge_type, part_number in XEROX_PART_NUMBER_MAP[model_name].items(): + if cartridge_type in description: + # Handle "PN Genuine Xerox(R) Toner" replacement + if 'PN Genuine Xerox(R) Toner' in description: + return description.replace('PN Genuine Xerox(R) Toner', f'PN {part_number}') + # Handle missing part number (just "Toner Cartridge" with serial) + elif ';SN' in description and 'PN' not in description: + # Insert part number before serial number + return description.replace(';SN', f', PN {part_number};SN') + # Handle simple "Toner Cartridge" without serial + elif description == cartridge_type: + return f'{cartridge_type}, PN {part_number}' + + return description + + +def filter_generic_supplies(supplies_list): + """Remove generic Xerox entries when specific part numbers exist""" + # Convert to list if it's a set + supplies = list(supplies_list) + + # Group by color/type (Black, Cyan, Magenta, Yellow) + # If we have both a specific PN and "Genuine Xerox(R) Toner" for the same color, remove the generic one + filtered = [] + + for supply in supplies: + # Skip generic Xerox entries if we have a real part number for this color + if 'PN Genuine Xerox(R) Toner' in supply: + # Extract the color (Black, Cyan, Magenta, Yellow) + color = None + for c in ['Black', 'Cyan', 'Magenta', 'Yellow']: + if c in supply: + color = c + break + + # Check if we have a real part number for this color + if color: + has_real_pn = any( + color in s and 'PN Genuine Xerox(R) Toner' not in s and 'PN 006R' in s + for s in supplies + ) + if has_real_pn: + continue # Skip this generic entry + + filtered.append(supply) + + return filtered + + +def extract_key_data(csv_file): + """Extract all key printer information from CSV""" + data = { + 'model': 'Unknown', + 'hostname': 'Unknown', + 'serial': 'Unknown', + 'supplies': {}, + 'toner_levels': {}, + 'toner_percentages': {}, + 'maintenance_kit': {}, + 'network': {}, + 'is_color': False + } + + if not os.path.exists(csv_file): + return data + + with open(csv_file, 'r', encoding='utf-8') as f: + reader = csv.DictReader(f) + + for row in reader: + oid = row['OID'] + value = clean_value(row['Value']) + + # System Description + if oid == '1.3.6.1.2.1.1.1.0': + data['model'] = value + + # Device Model (more specific) + elif oid == '1.3.6.1.2.1.25.3.2.1.3.1': + if data['model'] == 'Unknown' or 'ETHERNET' in data['model']: + data['model'] = value + + # Hostname + elif oid == '1.3.6.1.2.1.1.5.0': + data['hostname'] = value + + # Serial Number (standard OID) + elif '1.3.6.1.2.1.43.5.1.1.17' in oid: + data['serial'] = value + + # Serial Number (HP-specific OID for DesignJet and other HP printers) + elif '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0' in oid: + # Only use if we don't already have a serial from standard OID + if data['serial'] == 'Unknown': + data['serial'] = value + + # Maintenance Kit Info (HP) - exact OID match only to avoid false matches + elif oid == '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0': + # Model/Serial + if value and value not in ['0', '', 'N/A']: + data['maintenance_kit']['model'] = clean_value(value) + elif oid == '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0': + # Printer Model + if value and value not in ['0', '', 'N/A']: + data['maintenance_kit']['printer_model'] = clean_value(value) + elif oid == '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0': + # Maintenance kit remaining pages + if value and value not in ['0', '', 'N/A', '-1', '-2', '-3']: + try: + data['maintenance_kit']['remaining'] = int(value) + except: + pass + elif oid == '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.1.0': + # Part Number + if value and value not in ['0', '', 'N/A']: + data['maintenance_kit']['part_number'] = clean_value(value) + + # Standard Printer MIB - Maintenance Kit (Index 2) + # Only for HP printers - Xerox uses index 2 for toner cartridges + elif oid == '1.3.6.1.2.1.43.11.1.1.6.1.2': + # Part Number (Standard MIB) + if value and value not in ['0', '', 'N/A']: + # Check if this looks like a maintenance kit (not toner) + value_lower = value.lower() + is_maintenance = 'maintenance kit' in value_lower or 'maintenance-kit' in value_lower + # Store the standard MIB part description to verify this is actually a maintenance kit + if is_maintenance: + data['maintenance_kit']['standard_part_desc'] = value + # Only set part_number if we don't already have one from HP proprietary MIB + if 'part_number' not in data['maintenance_kit']: + data['maintenance_kit']['part_number'] = clean_value(value) + elif oid == '1.3.6.1.2.1.43.11.1.1.9.1.2': + # Current level (Standard MIB) + # Only collect if we already identified this as a maintenance kit (not toner) + if value and value not in ['0', '', 'N/A', '-1', '-2', '-3']: + # Only store if we have a maintenance kit part_number already set from this index + # This prevents storing toner levels as maintenance kit levels + try: + # Store temporarily, will validate later + data['maintenance_kit']['standard_current_temp'] = int(value) + except: + pass + elif oid == '1.3.6.1.2.1.43.11.1.1.8.1.2': + # Max capacity (Standard MIB) + if value and value not in ['0', '', 'N/A', '-1', '-2', '-3']: + try: + # Store temporarily, will validate later + data['maintenance_kit']['standard_max_temp'] = int(value) + except: + pass + + # Network location + elif oid == '1.3.6.1.2.1.1.6.0': + data['network']['location'] = value + + # Extract toner information + supplies, toner_levels_raw, toner_max_capacity, supply_current, supply_max, hp_designjet_levels = extract_toner_info(csv_file) + data['supplies'] = supplies + + # Detect large format printers (DesignJet, Plotter series) early to determine which OIDs to use + model_lower = data['model'].lower() if data['model'] else '' + data['is_large_format'] = any(keyword in model_lower for keyword in ['designjet', 'plotter', 't1700', 't1600', 't2600']) + + # Fix Xerox VersaLink color mapping issue + # Some Xerox VersaLink printers report cyan/yellow descriptions AND levels swapped at indices 2 and 4 + # Affects: C7125, C405, C400, and potentially other VersaLink color models + versalink_swap_needed = False + if 'versalink' in model_lower and ('c7125' in model_lower or 'c405' in model_lower or 'c400' in model_lower): + if '2' in supplies and '4' in supplies: + desc2 = supplies['2'].get('description', '').lower() + desc4 = supplies['4'].get('description', '').lower() + # If index 2 says "yellow" and index 4 says "cyan", they need to be swapped + if 'yellow' in desc2 and 'cyan' in desc4: + versalink_swap_needed = True + supplies['2'], supplies['4'] = supplies['4'], supplies['2'] + + # Finalize Standard MIB maintenance kit data + # Only promote temp values if we verified index 2 is actually a maintenance kit + if 'standard_part_desc' in data['maintenance_kit']: + # We found "Maintenance Kit" at index 2, so the temp values are valid + if 'standard_current_temp' in data['maintenance_kit']: + data['maintenance_kit']['standard_current'] = data['maintenance_kit'].pop('standard_current_temp') + if 'standard_max_temp' in data['maintenance_kit']: + data['maintenance_kit']['standard_max'] = data['maintenance_kit'].pop('standard_max_temp') + # Clean up the verification field + data['maintenance_kit'].pop('standard_part_desc', None) + else: + # Index 2 is not a maintenance kit (probably toner) - discard temp values + data['maintenance_kit'].pop('standard_current_temp', None) + data['maintenance_kit'].pop('standard_max_temp', None) + + # If HP DesignJet with proprietary ink level OIDs, use those instead of standard OIDs + if hp_designjet_levels and data['is_large_format']: + # HP DesignJet provides direct percentages via proprietary OID + for idx, percentage in hp_designjet_levels.items(): + data['toner_levels'][idx] = f"{percentage}%" + data['toner_percentages'][idx] = percentage + else: + # Standard printer: Calculate percentages from standard OIDs + for idx, raw_value in toner_levels_raw.items(): + percentage, display = calculate_toner_percentage(idx, raw_value, toner_max_capacity, supply_current, supply_max, data['model']) + data['toner_levels'][idx] = display + data['toner_percentages'][idx] = percentage + + # Fix Xerox VersaLink toner level data swap (must happen AFTER percentage calculation) + # These printers report cyan/yellow LEVELS at swapped indices (not just descriptions) + if versalink_swap_needed: + # Swap the calculated toner levels and percentages + if '2' in data['toner_levels'] and '4' in data['toner_levels']: + data['toner_levels']['2'], data['toner_levels']['4'] = data['toner_levels']['4'], data['toner_levels']['2'] + if '2' in data['toner_percentages'] and '4' in data['toner_percentages']: + data['toner_percentages']['2'], data['toner_percentages']['4'] = data['toner_percentages']['4'], data['toner_percentages']['2'] + + # Determine if printer is color (check for cyan/magenta/yellow indices) + # Indices: 1=Black/Matte Black, 2=Cyan, 3=Magenta, 4=Yellow, 5=Photo Black, 6=Gray + # Check both standard and HP DesignJet OIDs + all_indices = set(toner_levels_raw.keys()) | set(hp_designjet_levels.keys()) + data['is_color'] = any(idx in all_indices for idx in ['2', '3', '4', '5', '6']) + + return data + + +def print_printer_summary(printer_ip, csv_file): + """Print formatted summary for a single printer""" + data = extract_key_data(csv_file) + + print(f"\n{'='*70}") + print(f"Printer: {printer_ip}") + print(f"{'='*70}") + print(f"Model: {data['model']}") + print(f"Hostname: {data['hostname']}") + print(f"Serial: {data['serial']}") + print(f"Type: {'Color' if data['is_color'] else 'Monochrome'}") + + # Toner levels + if data['toner_levels']: + # Use different label for DesignJet (ink) vs standard printers (toner) + supply_type = "Ink Levels" if data.get('is_large_format', False) else "Toner Levels" + print(f"\n {supply_type}:") + + # For HP DesignJets with HP 730 cartridges, map by part number instead of index + # Build index-to-color mapping dynamically + idx_to_color = {} + + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data['toner_levels'].keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + + # If we couldn't map by part number, fall back to generic index mapping + if not idx_to_color: + idx_to_color = { + '1': 'Cartridge 1', + '2': 'Cartridge 2', + '3': 'Cartridge 3', + '4': 'Cartridge 4', + '5': 'Cartridge 5', + '6': 'Cartridge 6' + } + else: + # Standard 4-color printers + idx_to_color = { + '1': 'Black', + '2': 'Cyan', + '3': 'Magenta', + '4': 'Yellow' + } + + # Define display order for colors + color_order = ['Matte Black', 'Photo Black', 'Cyan', 'Magenta', 'Yellow', 'Gray', 'Black'] + + # Sort indices by color order + sorted_indices = sorted( + [idx for idx in data['toner_levels'].keys() if idx in idx_to_color], + key=lambda x: color_order.index(idx_to_color[x]) if idx_to_color[x] in color_order else 999 + ) + + for idx in sorted_indices: + color = idx_to_color.get(idx, f'Index {idx}') + + # Check if this index actually contains toner/cartridge, not maintenance kit + if idx in data['supplies']: + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's clearly not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + + display = data['toner_levels'][idx] + print(f" {color}: {display}") + + # Show cartridge info if available + if idx in data['supplies']: + desc = data['supplies'][idx].get('description', '') + if desc: + if len(desc) > 60: + desc = desc[:60] + "..." + print(f" Cartridge: {desc}") + + # Other supplies (drums, fuser, waste) + if data['supplies']: + other_supplies = [] + for idx, supply in data['supplies'].items(): + # Skip main toners (1-4) or all 6 colors for DesignJet (1-6) + if data.get('is_large_format', False): + if idx in ['1', '2', '3', '4', '5', '6']: + continue + else: + if idx in ['1', '2', '3', '4']: + continue + + desc = supply.get('description', '') + if desc: + # Check if it's a maintenance-related item + keywords = ['fuser', 'drum', 'waste', 'transfer', 'belt', 'roller', 'kit'] + if any(keyword in desc.lower() for keyword in keywords): + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + other_supplies.append((idx, desc)) + + if other_supplies: + print(f"\n Other Supplies (Fuser, Drums, etc.):") + for idx, desc in sorted(other_supplies, key=lambda x: x[1]): + if len(desc) > 70: + desc = desc[:70] + "..." + print(f" {desc}") + + # Maintenance kit (HP specific) + if data['maintenance_kit']: + print(f"\n Maintenance Kit:") + for key, value in data['maintenance_kit'].items(): + if value and value not in ['N/A', '0', '']: + label = key.replace('_', ' ').title() + print(f" {label}: {value}") + + # Network info + if data['network'] and data['network'].get('location'): + print(f"\n Network:") + print(f" Location: {data['network']['location']}") + + +def print_models_with_supplies(models_data): + """Print a breakdown of printer models with their replacement hardware""" + print(f"\n{'='*70}") + print("PRINTER MODELS AND REPLACEMENT HARDWARE") + print(f"{'='*70}\n") + + # Dictionary to track which models use which supplies + supply_to_models = {} + + for model_name in sorted(models_data.keys()): + supplies = models_data[model_name] + print(f"\nModel: {model_name}") + print("-" * 70) + + # Categorize supplies + toner_cartridges = [] + drums = [] + fusers = [] + waste_toners = [] + transfer_items = [] + maintenance_kits = [] + other_items = [] + + # Filter out generic Xerox entries when we have specific PNs + filtered_supplies = filter_generic_supplies(set(supplies)) + + for supply_desc in sorted(filtered_supplies): + supply_lower = supply_desc.lower() + + # Track which models use this supply + if supply_desc not in supply_to_models: + supply_to_models[supply_desc] = [] + if model_name not in supply_to_models[supply_desc]: + supply_to_models[supply_desc].append(model_name) + + if 'toner' in supply_lower and 'waste' not in supply_lower: + toner_cartridges.append(supply_desc) + elif 'drum' in supply_lower: + drums.append(supply_desc) + elif 'fuser' in supply_lower: + fusers.append(supply_desc) + elif 'waste' in supply_lower: + waste_toners.append(supply_desc) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + transfer_items.append(supply_desc) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + maintenance_kits.append(supply_desc) + else: + other_items.append(supply_desc) + + # Print categorized items + if toner_cartridges: + print(" Toner Cartridges:") + for item in sorted(toner_cartridges): + print(f" - {item}") + + if drums: + print(" Drums:") + for item in sorted(drums): + print(f" - {item}") + + if fusers: + print(" Fusers:") + for item in sorted(fusers): + print(f" - {item}") + + if waste_toners: + print(" Waste Toner:") + for item in sorted(waste_toners): + print(f" - {item}") + + if transfer_items: + print(" Transfer/Belt:") + for item in sorted(transfer_items): + print(f" - {item}") + + if maintenance_kits: + print(" Maintenance Kits:") + for item in sorted(maintenance_kits): + print(f" - {item}") + + if other_items: + print(" Other:") + for item in sorted(other_items): + print(f" - {item}") + + # Print consolidated summary + print(f"\n{'='*70}") + print("CONSOLIDATED SUPPLY SUMMARY") + print(f"{'='*70}\n") + print("Supplies grouped by part (showing which models use each):\n") + + # Categorize all supplies globally + categories = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + for supply_desc, model_list in supply_to_models.items(): + supply_lower = supply_desc.lower() + + if 'toner' in supply_lower and 'waste' not in supply_lower: + categories['Toner Cartridges'].append((supply_desc, model_list)) + elif 'drum' in supply_lower: + categories['Drums'].append((supply_desc, model_list)) + elif 'fuser' in supply_lower: + categories['Fusers'].append((supply_desc, model_list)) + elif 'waste' in supply_lower: + categories['Waste Toner'].append((supply_desc, model_list)) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categories['Transfer/Belt'].append((supply_desc, model_list)) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categories['Maintenance Kits'].append((supply_desc, model_list)) + else: + categories['Other'].append((supply_desc, model_list)) + + # Print each category + for category_name, items in categories.items(): + if items: + print(f"{category_name}:") + for supply_desc, model_list in sorted(items): + # Show models using this supply + if len(model_list) > 1: + model_str = f" (used by {len(model_list)} models)" + else: + model_str = f" (used by {model_list[0]})" + print(f" - {supply_desc}{model_str}") + print() + + print(f"{'='*70}\n") + + +def generate_html_report(models_data, all_printers_data): + """Generate a professional HTML report""" + + # Track supplies that need replacement (below 10% or not installed) + low_supplies = [] + + for printer_ip, data in all_printers_data.items(): + # Generate FQDN for this printer + fqdn = get_fqdn_from_ip(printer_ip) + + # Check toner levels - map by part number for DesignJets, use index for standard printers + idx_to_color = {} + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data.get('toner_levels', {}).keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + # Fallback if mapping failed + if not idx_to_color: + idx_to_color = {'1': 'Cartridge 1', '2': 'Cartridge 2', '3': 'Cartridge 3', '4': 'Cartridge 4', '5': 'Cartridge 5', '6': 'Cartridge 6'} + else: + idx_to_color = {'1': 'Black', '2': 'Cyan', '3': 'Magenta', '4': 'Yellow'} + + for idx, color_name in idx_to_color.items(): + # Check if this toner exists in the data + if idx in data.get('toner_levels', {}): + display = data['toner_levels'][idx] + percentage = data.get('toner_percentages', {}).get(idx) + + # Get the cartridge description + cartridge_desc = "Unknown Cartridge" + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + # Normalize the cartridge description to remove serial numbers + cartridge_desc = normalize_supply_description(desc) + + # Add to low supplies if percentage <= 10% or not installed + if percentage is not None and percentage <= 10: + low_supplies.append({ + 'printer_ip': printer_ip, + 'fqdn': fqdn, + 'hostname': data.get('hostname', 'Unknown'), + 'model': data.get('normalized_model', data.get('model', 'Unknown')), + 'color': color_name, + 'percentage': percentage, + 'cartridge': cartridge_desc, + 'status': 'LOW' + }) + elif 'Not installed' in display or 'not installed' in display.lower(): + low_supplies.append({ + 'printer_ip': printer_ip, + 'fqdn': fqdn, + 'hostname': data.get('hostname', 'Unknown'), + 'model': data.get('normalized_model', data.get('model', 'Unknown')), + 'color': color_name, + 'percentage': 0, + 'cartridge': cartridge_desc, + 'status': 'MISSING' + }) + + # Build supply to models mapping + supply_to_models = {} + for model_name, supplies in models_data.items(): + for supply_desc in set(supplies): + if supply_desc not in supply_to_models: + supply_to_models[supply_desc] = [] + if model_name not in supply_to_models[supply_desc]: + supply_to_models[supply_desc].append(model_name) + + # Categorize supplies for consolidated summary + categories = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + for supply_desc, model_list in supply_to_models.items(): + supply_lower = supply_desc.lower() + if 'toner' in supply_lower and 'waste' not in supply_lower: + categories['Toner Cartridges'].append((supply_desc, model_list)) + elif 'drum' in supply_lower: + categories['Drums'].append((supply_desc, model_list)) + elif 'fuser' in supply_lower: + categories['Fusers'].append((supply_desc, model_list)) + elif 'waste' in supply_lower: + categories['Waste Toner'].append((supply_desc, model_list)) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categories['Transfer/Belt'].append((supply_desc, model_list)) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categories['Maintenance Kits'].append((supply_desc, model_list)) + else: + categories['Other'].append((supply_desc, model_list)) + + # Read favicon and convert to base64 + import base64 + try: + with open('output/favicon.ico', 'rb') as f: + favicon_base64 = base64.b64encode(f.read()).decode('utf-8') + favicon_data_uri = f"data:image/x-icon;base64,{favicon_base64}" + except: + favicon_data_uri = "" + + # Embedded SVG logos + logo_svg = ''' + + + + + + +''' + + dark_logo_svg = ''' + + + + + + +''' + + html = f""" + + + + + Printer Inventory Report - West Jefferson Facility + + + + + +
+
+
+
+ +
+
+

Printer Inventory Report

+
West Jefferson Facility
+
+
+
Generated on
{datetime.now().strftime('%B %d, %Y at %I:%M %p')}
+ +
+
+
+ + + + +
+ +
""" + + if low_supplies: + html += f""" +
+

+ + + + + + Supplies Requiring Immediate Replacement ({len(low_supplies)} items) +

+
+""" + for item in sorted(low_supplies, key=lambda x: (0 if x['status'] == 'MISSING' else 1, x['percentage'])): + if item['status'] == 'MISSING': + status_text = f"{item['color']} Toner: NOT INSTALLED" + alert_label = "MISSING CARTRIDGE - INSTALL NOW" + else: + status_text = f"{item['color']} Toner: {item['percentage']}% remaining" + alert_label = "CRITICAL - ORDER NOW" + + html += f""" +
+ {item['fqdn']} +
+
{status_text}
+
Part: {item['cartridge'][:80]}
+
{alert_label}
+
+
+""" + html += """ +
+
+""" + else: + html += """ +
+

+ + + + + Supply Status +

+
All printer supplies are above 10% - No immediate replacements needed
+
+""" + + html += """ +
+ + +
+
+

Individual Printer Status

+
+ +
+ + +
+
+
+""" + + # Add each printer + for printer_ip, data in sorted(all_printers_data.items()): + printer_type = 'Color' if data.get('is_color') else 'Monochrome' + badge_class = 'badge-color' if data.get('is_color') else 'badge-mono' + fqdn = get_fqdn_from_ip(printer_ip) + + html += f""" +
+

{fqdn}

+
+ IP Address: + {printer_ip} +
+
+ Model: + {data.get('normalized_model', data.get('model', 'Unknown'))} + {printer_type} +
+
+ Serial: + {data.get('serial', 'Unknown')} +
+""" + + # Add toner levels + if data.get('toner_levels'): + # Use "Ink Levels" for large format printers + supply_label = "Ink Levels" if data.get('is_large_format', False) else "Toner Levels" + html += f""" +
+

{supply_label}

+""" + # Map by part number for DesignJets, use index for standard printers + idx_to_color = {} + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data.get('toner_levels', {}).keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + # Fallback if mapping failed + if not idx_to_color: + idx_to_color = {'1': 'Cartridge 1', '2': 'Cartridge 2', '3': 'Cartridge 3', '4': 'Cartridge 4', '5': 'Cartridge 5', '6': 'Cartridge 6'} + else: + idx_to_color = {'1': 'Black', '2': 'Cyan', '3': 'Magenta', '4': 'Yellow'} + + # Define display order for colors + color_order = ['Matte Black', 'Photo Black', 'Cyan', 'Magenta', 'Yellow', 'Gray', 'Black'] + + # Sort indices by color order + sorted_indices = sorted( + [idx for idx in data['toner_levels'].keys() if idx in idx_to_color], + key=lambda x: color_order.index(idx_to_color[x]) if idx_to_color[x] in color_order else 999 + ) + + for idx in sorted_indices: + color = idx_to_color.get(idx, f'Index {idx}') + if idx in data['toner_levels']: + # Check if this index actually contains toner/cartridge, not maintenance kit + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's clearly not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + + display = data['toner_levels'][idx] + percentage = data.get('toner_percentages', {}).get(idx) + + # Determine progress bar class + if percentage is not None: + if percentage < 20: + progress_class = 'progress-low' + elif percentage < 50: + progress_class = 'progress-medium' + else: + progress_class = 'progress-high' + width = max(percentage, 5) # Minimum width for visibility + else: + progress_class = '' + width = 0 + + html += f""" +
+
{color}
+
+""" + + if percentage is not None: + html += f""" +
+
+ {percentage}% +
+
+""" + else: + html += f""" + {display} +""" + + html += """ +
+""" + + # Add cartridge info + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + if desc: + # Replace generic Xerox PNs with known specific ones (before normalizing) + model_name = data.get('normalized_model', data.get('model', '')) + enriched_desc = replace_generic_xerox_pn(desc, model_name) + # Normalize supply description + normalized_desc = normalize_supply_description(enriched_desc) + html += f""" +
Part: {normalized_desc[:80]}
+""" + + html += """ +
+""" + + html += """ +
+""" + + # Add other supplies + if data.get('supplies'): + other_supplies = [] + # Exclude main ink/toner cartridges (1-6 for DesignJets, 1-4 for standard printers) + excluded_indices = ['1', '2', '3', '4', '5', '6'] if data.get('is_large_format', False) else ['1', '2', '3', '4'] + for idx, supply in data['supplies'].items(): + if idx not in excluded_indices: + desc = supply.get('description', '') + if desc: + keywords = ['fuser', 'drum', 'waste', 'transfer', 'belt', 'roller', 'kit'] + if any(keyword in desc.lower() for keyword in keywords): + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + # Normalize supply description to remove serial numbers + normalized_desc = normalize_supply_description(desc) + other_supplies.append(normalized_desc) + + if other_supplies: + html += """ +
+

Other Supplies

+
+""" + for supply in sorted(set(other_supplies)): + html += f""" +
{supply[:90]}
+""" + html += """ +
+
+""" + + # Add maintenance kit info if available + if data.get('maintenance_kit'): + maint = data['maintenance_kit'] + if maint: # Only display if there's actually data + html += """ +
+

Maintenance Kit

+""" + + # Standard MIB percentage (for HP 4250, 4350 and similar older models) + percentage = None + current = None + maximum = None + if 'standard_current' in maint and 'standard_max' in maint: + try: + current = maint['standard_current'] + maximum = maint['standard_max'] + if maximum > 0: + percentage = int((current / maximum) * 100) + except: + pass + + if percentage is not None: + # Use progress bar for Standard MIB maintenance kit + if percentage < 20: + progress_class = 'progress-low' + elif percentage < 50: + progress_class = 'progress-medium' + else: + progress_class = 'progress-high' + width = max(percentage, 5) # Minimum width for visibility + + html += f""" +
+
Level
+
+
+
+ {percentage}% +
+
+
+""" + if 'part_number' in maint: + html += f""" +
Cartridge: {maint['part_number']}
+""" + html += """ +
+""" + else: + # Fallback to old format for other maintenance kit info + html += """ +
+""" + if 'part_number' in maint: + html += f""" +
Part Number: {maint['part_number']}
+""" + if 'printer_model' in maint: + html += f""" +
Printer Model: {maint['printer_model']}
+""" + + # HP proprietary MIB remaining pages (for newer HP models like M404, M607) + if 'remaining' in maint: + # Format remaining pages + remaining = maint['remaining'] + if isinstance(remaining, int): + html += f""" +
Remaining: {remaining:,} pages
+""" + else: + html += f""" +
Remaining: {remaining}
+""" + html += """ +
+""" + html += """ +
+""" + + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Replacement Parts by Printer Model

+""" + + # Add each model + for model_name in sorted(models_data.keys()): + supplies = models_data[model_name] + + # Categorize supplies + categorized = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + # Filter out generic Xerox entries when we have specific PNs + filtered_supplies = filter_generic_supplies(set(supplies)) + + for supply_desc in sorted(filtered_supplies): + supply_lower = supply_desc.lower() + if 'toner' in supply_lower and 'waste' not in supply_lower: + categorized['Toner Cartridges'].append(supply_desc) + elif 'drum' in supply_lower: + categorized['Drums'].append(supply_desc) + elif 'fuser' in supply_lower: + categorized['Fusers'].append(supply_desc) + elif 'waste' in supply_lower: + categorized['Waste Toner'].append(supply_desc) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categorized['Transfer/Belt'].append(supply_desc) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categorized['Maintenance Kits'].append(supply_desc) + else: + categorized['Other'].append(supply_desc) + + html += f""" +
+

{model_name}

+""" + + for category, items in categorized.items(): + if items: + html += f""" +
+

{category}

+
    +""" + for item in sorted(items): + html += f""" +
  • {item}
  • +""" + html += """ +
+
+""" + + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Supply Inventory - Consolidated View

+
+""" + + for category_name, items in categories.items(): + if items: + html += f""" +
+

{category_name}

+""" + for supply_desc, model_list in sorted(items): + model_count = len(model_list) + if model_count > 1: + count_text = f"{model_count} models" + else: + count_text = model_list[0][:40] + + html += f""" +
+
{supply_desc}
+
{count_text}
+
+""" + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Supply Compatibility & Consolidation Opportunities

+

+ Based on manufacturer specifications and cross-reference research, these printer models share compatible supplies. + Consolidating inventory around these groups can reduce SKU count and simplify purchasing. +

+""" + + # Check which models from compatibility groups are actually in our inventory + inventory_models = set(models_data.keys()) + + # Group compatibility items by priority + priority_order = ['Critical', 'High', 'Medium'] + for priority in priority_order: + groups_in_priority = [g for g in COMPATIBILITY_GROUPS if g['priority'] == priority] + + for group in groups_in_priority: + # Check which models from this group are in our inventory + models_in_inventory = [m for m in group['models'] if m in inventory_models] + + priority_class = group['priority'].lower() + html += f""" +
+
+

{group['name']}

+ {group['priority']} Value +
+ +
+ Compatible Models: +
    +""" + for model in group['models']: + in_inventory = ' โœ“ In Inventory' if model in inventory_models else '' + html += f""" +
  • {model}{in_inventory}
  • +""" + html += """ +
+
+ +
+ Shared Supplies: +""" + for supply in group['shared_supplies']: + html += f""" +
+
{supply['type']}
+
    +""" + for part in supply['parts']: + html += f""" +
  • {part}
  • +""" + html += """ +
+
+""" + html += f""" +
+ +
+ Consolidation Benefit: + {group['benefit']} +
+""" + + # Show which printers in our inventory match this group + if models_in_inventory: + html += f""" +
+ Printers in Your Inventory ({len(models_in_inventory)} model{'s' if len(models_in_inventory) > 1 else ''}): +
    +""" + for model in models_in_inventory: + # Count how many printers of this model we have + printer_count = sum(1 for p_data in all_printers_data.values() + if p_data.get('normalized_model') == model) + html += f""" +
  • {model} ({printer_count} printer{'s' if printer_count > 1 else ''})
  • +""" + html += """ +
+
+""" + html += """ +
+""" + + html += """ +
+
+
+ + + + + +""" + + return html + + +def main(): + """Main function to extract summaries from all printer CSVs""" + output_dir = "output" + + if not os.path.exists(output_dir): + print(f"Error: Output directory '{output_dir}' not found") + print("Please run snmp_scanner.py first") + sys.exit(1) + + csv_files = list(Path(output_dir).glob("printer-*.csv")) + + if not csv_files: + print(f"No CSV files found in {output_dir}/") + sys.exit(1) + + print(f"Found {len(csv_files)} printer scan files") + print("\n" + "="*70) + print("PRINTER SNMP DATA SUMMARY") + print("="*70) + + # Dictionary to collect models and their supplies + models_data = {} + all_printers_data = {} + + for csv_file in sorted(csv_files): + # Extract IP from filename + filename = csv_file.stem + ip_match = re.search(r'printer-(\d+)-(\d+)-(\d+)-(\d+)', filename) + if ip_match: + printer_ip = '.'.join(ip_match.groups()) + print_printer_summary(printer_ip, csv_file) + + # Extract data for model summary + data = extract_key_data(csv_file) + model = data['model'] + normalized_model = normalize_model_name(model) + + # Store printer data with both original and normalized model + data['normalized_model'] = normalized_model + all_printers_data[printer_ip] = data + + if normalized_model not in models_data: + models_data[normalized_model] = [] + + # Add all supplies for this model + for idx, supply in data['supplies'].items(): + desc = supply.get('description', '') + if desc: + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + # Replace generic Xerox PNs with known specific ones (before normalizing) + enriched_desc = replace_generic_xerox_pn(desc, normalized_model) + # Normalize supply description to remove serial numbers + normalized_desc = normalize_supply_description(enriched_desc) + models_data[normalized_model].append(normalized_desc) + + # Add maintenance kit info if available + if data['maintenance_kit']: + if 'model' in data['maintenance_kit']: + models_data[normalized_model].append(f"Maintenance Kit: {data['maintenance_kit']['model']}") + + print(f"\n{'='*70}") + print("Summary complete!") + print(f"{'='*70}\n") + + # Print models with their supplies + print_models_with_supplies(models_data) + + # Generate HTML report + html_content = generate_html_report(models_data, all_printers_data) + timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S') + html_file = f"output/printer_report_{timestamp}.html" + + with open(html_file, 'w', encoding='utf-8') as f: + f.write(html_content) + + print(f"\n{'='*70}") + print(f"HTML report generated: {html_file}") + print(f"Self-contained report with embedded logos and assets") + print(f"{'='*70}\n") + + +if __name__ == "__main__": + main() diff --git a/extract_summary_FIXED.py b/extract_summary_FIXED.py new file mode 100644 index 0000000..33b9cb5 --- /dev/null +++ b/extract_summary_FIXED.py @@ -0,0 +1,2338 @@ +#!/usr/bin/env python3 +""" +Extract key printer information from SNMP scan CSVs +Converts all toner levels to percentages (0-100%) +""" + +import csv +import os +import sys +import re +from pathlib import Path +from datetime import datetime + + +def clean_value(value): + """Clean up encoding issues in SNMP values""" + if not value: + return value + + # Remove common encoding prefixes + if value.startswith('รฝรจ'): + value = value[2:] + + # Remove null characters and other control chars + value = ''.join(char for char in value if ord(char) >= 32 or char in '\n\r\t') + + return value.strip() + + +def extract_toner_info(csv_file): + """ + Extract comprehensive toner and supply information from CSV + Maps supply indices to their levels and capacities + """ + supplies = {} + toner_levels_raw = {} # Raw values from 43.11.1.1.9 + toner_max_capacity = {} # Max capacity from 43.11.1.1.8 + supply_current = {} # Current from 43.10.2.1.9 + supply_max = {} # Max from 43.10.2.1.4 + hp_designjet_levels = {} # HP DesignJet ink levels from proprietary OID + + with open(csv_file, 'r', encoding='utf-8') as f: + reader = csv.DictReader(f) + + for row in reader: + oid = row['OID'] + value = clean_value(row['Value']) + + # Extract supply descriptions (43.11.1.1.6) + if '1.3.6.1.2.1.43.11.1.1.6' in oid: + index = oid.split('.')[-1] + if index not in supplies: + supplies[index] = {} + supplies[index]['description'] = value + + # Extract toner max capacity (43.11.1.1.8.1.X) + elif '1.3.6.1.2.1.43.11.1.1.8.1' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + toner_max_capacity[index] = int(value) + except: + pass + + # Extract supply max capacity (43.10.2.1.4) + elif '1.3.6.1.2.1.43.10.2.1.4' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + supply_max[index] = int(value) + except: + pass + + # Extract supply current level (43.10.2.1.9) + elif '1.3.6.1.2.1.43.10.2.1.9' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + supply_current[index] = int(value) + except: + pass + + # Direct toner level readings (43.11.1.1.9.1.X) + elif '1.3.6.1.2.1.43.11.1.1.9.1' in oid: + parts = oid.split('.') + if len(parts) >= 2: + index = parts[-1] + try: + toner_levels_raw[index] = int(value) + except: + pass + + # HP DesignJet ink levels (1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.X.1.0) + elif '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.' in oid: + parts = oid.split('.') + # OID format: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.{cartridge_index}.1.0 + # Example: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.1.1.0 (Matte Black) + if len(parts) >= 18: + index = parts[17] # Cartridge index (1-6) + try: + hp_designjet_levels[index] = int(value) + except: + pass + + return supplies, toner_levels_raw, toner_max_capacity, supply_current, supply_max, hp_designjet_levels + + +def map_hp730_color(part_number): + """ + Map HP 730 part numbers to actual ink colors + Returns color name or None if not recognized + """ + part_number = part_number.upper().strip() + + # HP 730 130ml and 300ml cartridges + hp730_map = { + # 130ml cartridges + 'P2V62A': 'Cyan', + 'P2V63A': 'Magenta', + 'P2V64A': 'Yellow', + 'P2V65A': 'Matte Black', + 'P2V66A': 'Photo Black', + 'P2V67A': 'Gray', + # 300ml cartridges (verified from actual T1700dr installation) + 'P2V68A': 'Cyan', + 'P2V69A': 'Magenta', + 'P2V70A': 'Yellow', + 'P2V71A': 'Matte Black', + 'P2V72A': 'Gray', + 'P2V73A': 'Photo Black', + } + + # Extract part number from description like "HP 730 ( P2V72A )" + for pn, color in hp730_map.items(): + if pn in part_number: + return color + + return None + + +def calculate_toner_percentage(toner_idx, toner_value, toner_max_capacity, supply_current, supply_max): + """ + Calculate toner percentage from various sources + Returns: (percentage, display_string) + """ + # Negative values mean not installed + if toner_value < 0: + return (None, "Not installed") + + # If value is 0-100, it's already a percentage + if 0 <= toner_value <= 100: + return (toner_value, f"{toner_value}%") + + # First try: Use toner max capacity (43.11.1.1.8.1.X) if available + # This is the correct OID for HP printers that report absolute page counts + if toner_idx in toner_max_capacity: + max_val = toner_max_capacity[toner_idx] + if max_val > 0: + percentage = int((toner_value / max_val) * 100) + return (percentage, f"{percentage}% ({toner_value:,}/{max_val:,})") + + # Try to find matching supply data to calculate percentage + # Often toner index '1' = supply '1', '2' = supply '2', etc. + if toner_idx in supply_max and toner_idx in supply_current: + max_val = supply_max[toner_idx] + current_val = supply_current[toner_idx] + if max_val > 0: + percentage = int((current_val / max_val) * 100) + return (percentage, f"{percentage}% ({current_val:,}/{max_val:,})") + + # Alternative: Try supply index '1' for the first toner + if '1' in supply_max and '1' in supply_current: + max_val = supply_max['1'] + current_val = supply_current['1'] + if max_val > 0 and toner_value > 100: + # Estimate percentage based on pages + percentage = int((toner_value / max_val) * 100) + if percentage > 100: + # Raw value is absolute pages, not related to this max + # Just show the raw percentage estimate + # Assume typical cartridge is ~3000-20000 pages + if toner_value < 100: + return (toner_value, f"{toner_value}%") + elif toner_value < 500: + return (10, f"~10% ({toner_value:,} pages remaining)") + elif toner_value < 2000: + return (25, f"~25% ({toner_value:,} pages remaining)") + elif toner_value < 5000: + return (50, f"~50% ({toner_value:,} pages remaining)") + elif toner_value < 10000: + return (75, f"~75% ({toner_value:,} pages remaining)") + else: + return (90, f"~90% ({toner_value:,} pages remaining)") + return (percentage, f"{percentage}%") + + # If we can't calculate, estimate based on page count ranges + if toner_value > 100: + if toner_value < 500: + return (10, f"~10% ({toner_value:,} pages remaining)") + elif toner_value < 2000: + return (25, f"~25% ({toner_value:,} pages remaining)") + elif toner_value < 5000: + return (50, f"~50% ({toner_value:,} pages remaining)") + elif toner_value < 10000: + return (75, f"~75% ({toner_value:,} pages remaining)") + else: + return (90, f"~90% ({toner_value:,} pages remaining)") + + return (None, f"{toner_value}") + + +def get_fqdn_from_ip(ip_address): + """Generate FQDN from IP address""" + # Convert IP like 10.80.92.56 to Printer-10-80-92-56.printer.geaerospace.net + ip_with_dashes = ip_address.replace('.', '-') + return f"Printer-{ip_with_dashes}.printer.geaerospace.net" + + +def normalize_model_name(model_name): + """Normalize model name by removing firmware/system version info""" + # Remove common firmware/version patterns + # Examples: + # "Xerox VersaLink C7125 Color MFP; System 69.21.21, Controller..." -> "Xerox VersaLink C7125" + # "HP LaserJet Pro M404n" stays the same + + # Split on semicolon (common separator for firmware info) + model_clean = model_name.split(';')[0].strip() + + # Remove common version patterns in parentheses + import re + model_clean = re.sub(r'\s*\([^)]*\)', '', model_clean) + + # Remove trailing descriptors that are too specific + # Keep: "Color MFP", "PostScript", etc. + # But remove system versions, dates, etc. + + return model_clean.strip() + + +def normalize_supply_description(description): + """Normalize supply description by removing serial numbers and other unique identifiers""" + import re + + # Remove serial numbers (e.g., ";SN804A5C260...", ";SNunknown") + # Match ;SN followed by anything (letters, numbers, "unknown", etc.) + desc_clean = re.sub(r';SN\w+.*$', '', description) + + # Remove trailing dots/ellipsis + desc_clean = desc_clean.rstrip('.') + + # Clean up extra whitespace + desc_clean = ' '.join(desc_clean.split()) + + return desc_clean.strip() + + +def fix_unknown_part_numbers(description, model): + """ + Replace 'PN unknown' with known part numbers based on printer model + """ + # Normalize model name for matching + normalized_model = normalize_model_name(model) + + # Check if this model has known part number mappings + if normalized_model not in XEROX_PART_NUMBER_MAP: + return description + + # Extract the supply type from description (e.g., "Fuser, PN unknown" -> "Fuser") + supply_type = description.split(',')[0].strip() + + # Check if we have a mapping for this supply type + part_map = XEROX_PART_NUMBER_MAP[normalized_model] + if supply_type in part_map: + # Replace "PN unknown" with the actual part number + known_pn = part_map[supply_type] + return description.replace('PN unknown', f'PN {known_pn}') + + return description + + +# Known part numbers for Xerox models that report generic descriptions +XEROX_PART_NUMBER_MAP = { + 'Xerox VersaLink C7125 Color MFP': { + 'Black Toner Cartridge': '006R01820', + 'Cyan Toner Cartridge': '006R01821', + 'Magenta Toner Cartridge': '006R01822', + 'Yellow Toner Cartridge': '006R01823', + }, + 'Xerox VersaLink C405': { + 'Black Toner Cartridge': '106R03536', + 'Cyan Toner Cartridge': '106R03538', + 'Magenta Toner Cartridge': '106R03539', + 'Yellow Toner Cartridge': '106R03537', + }, + 'Xerox VersaLink B7125 MFP': { + 'Toner Cartridge': '006R01817', + }, + 'Xerox VersaLink B405': { + 'Toner Cartridge': '106R03580', # Standard capacity (5.9K pages) + }, + 'Xerox VersaLink B400': { + 'Toner Cartridge': '106R03580', # Standard capacity (5.9K pages) + }, + 'Xerox EC8036 Color': { + 'Fuser': '008R13063', # 110V + 'Second Bias Transfer Roll': '008R13064', + }, + 'Xerox AltaLink C8135': { + 'Fuser': '008R13102', # 110V + 'Second Bias Transfer Roll': '008R08103', + }, +} + +# Printer supply compatibility groups based on research +COMPATIBILITY_GROUPS = [ + { + 'priority': 'High', + 'name': 'HP LaserJet Pro M404n + M406 Consolidation', + 'models': ['HP LaserJet Pro M404n', 'HP LaserJet Pro M406'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CF258A (58A Standard)', 'CF258X (58X High Yield)']}, + {'type': 'Fuser', 'parts': ['RM2-6461 / RM2-6342']}, + ], + 'benefit': 'Both models share identical toner and fuser - consolidate to single SKUs' + }, + { + 'priority': 'High', + 'name': 'HP DesignJet Plotter Ink Sharing', + 'models': ['HP DesignJet T1700dr', 'HP DesignJet T1600', 'HP DesignJet T2600'], + 'shared_supplies': [ + {'type': 'Ink Cartridges', 'parts': [ + 'HP 730 series (P2V62A-P2V72A)', + 'All colors: Matte Black, Photo Black, Cyan, Magenta, Yellow, Gray' + ]}, + ], + 'benefit': 'T1700dr shares all HP 730 inks with T1600/T2600 series' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 90A/X Family', + 'models': ['HP LaserJet M4555', 'HP LaserJet M602', 'HP LaserJet M603'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CE390A (90A Standard)', 'CE390X (90X High Yield)']}, + ], + 'benefit': 'All use CE390A/X toner cartridges' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 42A/X Family', + 'models': ['HP LaserJet 4250', 'HP LaserJet 4350'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['Q5942A (42A Standard)', 'Q5942X (42X High Yield)']}, + ], + 'benefit': 'Compatible toner across 4250/4350 models' + }, + { + 'priority': 'Medium', + 'name': 'HP LaserJet 55X Family', + 'models': ['HP LaserJet P3015', 'HP LaserJet P3010'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': ['CE255X (55X High Yield)']}, + ], + 'benefit': 'Share CE255X high-yield toner cartridges' + }, + { + 'priority': 'Medium', + 'name': 'Xerox VersaLink C405/C400 Series', + 'models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + '106R03536 (Black)', + '106R03538 (Cyan)', + '106R03539 (Magenta)', + '106R03537 (Yellow)' + ]}, + ], + 'benefit': 'C405 and C400 share identical 106R035xx toner series' + }, + { + 'priority': 'Medium', + 'name': 'Xerox VersaLink B405/B400 Series', + 'models': ['Xerox VersaLink B405', 'Xerox VersaLink B400'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + '106R03580 (Standard Yield)', + '106R03581 (High Yield)', + '106R03582 (Extra High Yield)' + ]}, + ], + 'benefit': 'B405 and B400 share 106R035xx toner family' + }, + { + 'priority': 'Critical', + 'name': 'HP LaserJet Pro M254dw Toner Correction', + 'models': ['HP LaserJet Pro M254dw'], + 'shared_supplies': [ + {'type': 'Toner', 'parts': [ + 'CF500A (202A Black)', + 'CF501A (202A Cyan)', + 'CF502A (202A Magenta)', + 'CF503A (202A Yellow)' + ]}, + ], + 'benefit': 'IMPORTANT: Uses CF500A (202A) series, NOT W2020A (414A). Verify existing stock!' + }, +] + + +def replace_generic_xerox_pn(description, model_name): + """Replace generic Xerox part numbers with known specific ones based on model""" + # Check if we have a mapping for this model + if model_name not in XEROX_PART_NUMBER_MAP: + return description + + # Find which cartridge type this is + for cartridge_type, part_number in XEROX_PART_NUMBER_MAP[model_name].items(): + if cartridge_type in description: + # Handle "PN Genuine Xerox(R) Toner" replacement + if 'PN Genuine Xerox(R) Toner' in description: + return description.replace('PN Genuine Xerox(R) Toner', f'PN {part_number}') + # Handle missing part number (just "Toner Cartridge" with serial) + elif ';SN' in description and 'PN' not in description: + # Insert part number before serial number + return description.replace(';SN', f', PN {part_number};SN') + # Handle simple "Toner Cartridge" without serial + elif description == cartridge_type: + return f'{cartridge_type}, PN {part_number}' + + return description + + +def filter_generic_supplies(supplies_list): + """Remove generic Xerox entries when specific part numbers exist""" + # Convert to list if it's a set + supplies = list(supplies_list) + + # Group by color/type (Black, Cyan, Magenta, Yellow) + # If we have both a specific PN and "Genuine Xerox(R) Toner" for the same color, remove the generic one + filtered = [] + + for supply in supplies: + # Skip generic Xerox entries if we have a real part number for this color + if 'PN Genuine Xerox(R) Toner' in supply: + # Extract the color (Black, Cyan, Magenta, Yellow) + color = None + for c in ['Black', 'Cyan', 'Magenta', 'Yellow']: + if c in supply: + color = c + break + + # Check if we have a real part number for this color + if color: + has_real_pn = any( + color in s and 'PN Genuine Xerox(R) Toner' not in s and 'PN 006R' in s + for s in supplies + ) + if has_real_pn: + continue # Skip this generic entry + + filtered.append(supply) + + return filtered + + +def extract_key_data(csv_file): + """Extract all key printer information from CSV""" + data = { + 'model': 'Unknown', + 'hostname': 'Unknown', + 'serial': 'Unknown', + 'supplies': {}, + 'toner_levels': {}, + 'toner_percentages': {}, + 'maintenance_kit': {}, + 'network': {}, + 'is_color': False + } + + if not os.path.exists(csv_file): + return data + + with open(csv_file, 'r', encoding='utf-8') as f: + reader = csv.DictReader(f) + + for row in reader: + oid = row['OID'] + value = clean_value(row['Value']) + + # System Description + if oid == '1.3.6.1.2.1.1.1.0': + data['model'] = value + + # Device Model (more specific) + elif oid == '1.3.6.1.2.1.25.3.2.1.3.1': + if data['model'] == 'Unknown' or 'ETHERNET' in data['model']: + data['model'] = value + + # Hostname + elif oid == '1.3.6.1.2.1.1.5.0': + data['hostname'] = value + + # Serial Number (standard OID) + elif '1.3.6.1.2.1.43.5.1.1.17' in oid: + data['serial'] = value + + # Serial Number (HP-specific OID for DesignJet and other HP printers) + elif '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0' in oid: + # Only use if we don't already have a serial from standard OID + if data['serial'] == 'Unknown': + data['serial'] = value + + # Maintenance Kit Info (HP) + elif '1.3.6.1.4.1.11.2.3.9.4.2' in oid: + if value and value not in ['0', '', 'N/A']: + if '.1.1.3.3' in oid: + data['maintenance_kit']['model'] = value + elif '.1.1.3.2' in oid: + data['maintenance_kit']['printer_model'] = value + elif '.1.4.1.2' in oid: + data['maintenance_kit']['remaining'] = value + elif '.1.1.3.1' in oid: + data['maintenance_kit']['part_number'] = value + + # Network location + elif oid == '1.3.6.1.2.1.1.6.0': + data['network']['location'] = value + + # Extract toner information + supplies, toner_levels_raw, toner_max_capacity, supply_current, supply_max, hp_designjet_levels = extract_toner_info(csv_file) + data['supplies'] = supplies + + # Detect large format printers (DesignJet, Plotter series) early to determine which OIDs to use + model_lower = data['model'].lower() if data['model'] else '' + data['is_large_format'] = any(keyword in model_lower for keyword in ['designjet', 'plotter', 't1700', 't1600', 't2600']) + + # If HP DesignJet with proprietary ink level OIDs, use those instead of standard OIDs + if hp_designjet_levels and data['is_large_format']: + # HP DesignJet provides direct percentages via proprietary OID + for idx, percentage in hp_designjet_levels.items(): + data['toner_levels'][idx] = f"{percentage}%" + data['toner_percentages'][idx] = percentage + else: + # Standard printer: Calculate percentages from standard OIDs + for idx, raw_value in toner_levels_raw.items(): + percentage, display = calculate_toner_percentage(idx, raw_value, toner_max_capacity, supply_current, supply_max) + data['toner_levels'][idx] = display + data['toner_percentages'][idx] = percentage + + # Determine if printer is color (check for cyan/magenta/yellow indices) + # Indices: 1=Black/Matte Black, 2=Cyan, 3=Magenta, 4=Yellow, 5=Photo Black, 6=Gray + # Check both standard and HP DesignJet OIDs + all_indices = set(toner_levels_raw.keys()) | set(hp_designjet_levels.keys()) + data['is_color'] = any(idx in all_indices for idx in ['2', '3', '4', '5', '6']) + + return data + + +def print_printer_summary(printer_ip, csv_file): + """Print formatted summary for a single printer""" + data = extract_key_data(csv_file) + + print(f"\n{'='*70}") + print(f"Printer: {printer_ip}") + print(f"{'='*70}") + print(f"Model: {data['model']}") + print(f"Hostname: {data['hostname']}") + print(f"Serial: {data['serial']}") + print(f"Type: {'Color' if data['is_color'] else 'Monochrome'}") + + # Toner levels + if data['toner_levels']: + # Use different label for DesignJet (ink) vs standard printers (toner) + supply_type = "Ink Levels" if data.get('is_large_format', False) else "Toner Levels" + print(f"\n {supply_type}:") + + # For HP DesignJets with HP 730 cartridges, map by part number instead of index + # Build index-to-color mapping dynamically + idx_to_color = {} + + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data['toner_levels'].keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + + # If we couldn't map by part number, fall back to generic index mapping + if not idx_to_color: + idx_to_color = { + '1': 'Cartridge 1', + '2': 'Cartridge 2', + '3': 'Cartridge 3', + '4': 'Cartridge 4', + '5': 'Cartridge 5', + '6': 'Cartridge 6' + } + else: + # Standard 4-color printers + idx_to_color = { + '1': 'Black', + '2': 'Cyan', + '3': 'Magenta', + '4': 'Yellow' + } + + # Define display order for colors + color_order = ['Matte Black', 'Photo Black', 'Cyan', 'Magenta', 'Yellow', 'Gray', 'Black'] + + # Sort indices by color order + sorted_indices = sorted( + [idx for idx in data['toner_levels'].keys() if idx in idx_to_color], + key=lambda x: color_order.index(idx_to_color[x]) if idx_to_color[x] in color_order else 999 + ) + + for idx in sorted_indices: + color = idx_to_color.get(idx, f'Index {idx}') + + # Check if this index actually contains toner/cartridge, not maintenance kit + if idx in data['supplies']: + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's clearly not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + + display = data['toner_levels'][idx] + print(f" {color}: {display}") + + # Show cartridge info if available + if idx in data['supplies']: + desc = data['supplies'][idx].get('description', '') + if desc: + if len(desc) > 60: + desc = desc[:60] + "..." + print(f" Cartridge: {desc}") + + # Other supplies (drums, fuser, waste) + if data['supplies']: + other_supplies = [] + for idx, supply in data['supplies'].items(): + # Skip main toners (1-4) or all 6 colors for DesignJet (1-6) + if data.get('is_large_format', False): + if idx in ['1', '2', '3', '4', '5', '6']: + continue + else: + if idx in ['1', '2', '3', '4']: + continue + + desc = supply.get('description', '') + if desc: + # Check if it's a maintenance-related item + keywords = ['fuser', 'drum', 'waste', 'transfer', 'belt', 'roller', 'kit'] + if any(keyword in desc.lower() for keyword in keywords): + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + other_supplies.append((idx, desc)) + + if other_supplies: + print(f"\n Other Supplies (Fuser, Drums, etc.):") + for idx, desc in sorted(other_supplies, key=lambda x: x[1]): + if len(desc) > 70: + desc = desc[:70] + "..." + print(f" {desc}") + + # Maintenance kit (HP specific) + if data['maintenance_kit']: + print(f"\n Maintenance Kit:") + for key, value in data['maintenance_kit'].items(): + if value and value not in ['N/A', '0', '']: + label = key.replace('_', ' ').title() + print(f" {label}: {value}") + + # Network info + if data['network'] and data['network'].get('location'): + print(f"\n Network:") + print(f" Location: {data['network']['location']}") + + +def print_models_with_supplies(models_data): + """Print a breakdown of printer models with their replacement hardware""" + print(f"\n{'='*70}") + print("PRINTER MODELS AND REPLACEMENT HARDWARE") + print(f"{'='*70}\n") + + # Dictionary to track which models use which supplies + supply_to_models = {} + + for model_name in sorted(models_data.keys()): + supplies = models_data[model_name] + print(f"\nModel: {model_name}") + print("-" * 70) + + # Categorize supplies + toner_cartridges = [] + drums = [] + fusers = [] + waste_toners = [] + transfer_items = [] + maintenance_kits = [] + other_items = [] + + # Filter out generic Xerox entries when we have specific PNs + filtered_supplies = filter_generic_supplies(set(supplies)) + + for supply_desc in sorted(filtered_supplies): + supply_lower = supply_desc.lower() + + # Track which models use this supply + if supply_desc not in supply_to_models: + supply_to_models[supply_desc] = [] + if model_name not in supply_to_models[supply_desc]: + supply_to_models[supply_desc].append(model_name) + + if 'toner' in supply_lower and 'waste' not in supply_lower: + toner_cartridges.append(supply_desc) + elif 'drum' in supply_lower: + drums.append(supply_desc) + elif 'fuser' in supply_lower: + fusers.append(supply_desc) + elif 'waste' in supply_lower: + waste_toners.append(supply_desc) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + transfer_items.append(supply_desc) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + maintenance_kits.append(supply_desc) + else: + other_items.append(supply_desc) + + # Print categorized items + if toner_cartridges: + print(" Toner Cartridges:") + for item in sorted(toner_cartridges): + print(f" - {item}") + + if drums: + print(" Drums:") + for item in sorted(drums): + print(f" - {item}") + + if fusers: + print(" Fusers:") + for item in sorted(fusers): + print(f" - {item}") + + if waste_toners: + print(" Waste Toner:") + for item in sorted(waste_toners): + print(f" - {item}") + + if transfer_items: + print(" Transfer/Belt:") + for item in sorted(transfer_items): + print(f" - {item}") + + if maintenance_kits: + print(" Maintenance Kits:") + for item in sorted(maintenance_kits): + print(f" - {item}") + + if other_items: + print(" Other:") + for item in sorted(other_items): + print(f" - {item}") + + # Print consolidated summary + print(f"\n{'='*70}") + print("CONSOLIDATED SUPPLY SUMMARY") + print(f"{'='*70}\n") + print("Supplies grouped by part (showing which models use each):\n") + + # Categorize all supplies globally + categories = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + for supply_desc, model_list in supply_to_models.items(): + supply_lower = supply_desc.lower() + + if 'toner' in supply_lower and 'waste' not in supply_lower: + categories['Toner Cartridges'].append((supply_desc, model_list)) + elif 'drum' in supply_lower: + categories['Drums'].append((supply_desc, model_list)) + elif 'fuser' in supply_lower: + categories['Fusers'].append((supply_desc, model_list)) + elif 'waste' in supply_lower: + categories['Waste Toner'].append((supply_desc, model_list)) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categories['Transfer/Belt'].append((supply_desc, model_list)) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categories['Maintenance Kits'].append((supply_desc, model_list)) + else: + categories['Other'].append((supply_desc, model_list)) + + # Print each category + for category_name, items in categories.items(): + if items: + print(f"{category_name}:") + for supply_desc, model_list in sorted(items): + # Show models using this supply + if len(model_list) > 1: + model_str = f" (used by {len(model_list)} models)" + else: + model_str = f" (used by {model_list[0]})" + print(f" - {supply_desc}{model_str}") + print() + + print(f"{'='*70}\n") + + +def generate_html_report(models_data, all_printers_data): + """Generate a professional HTML report""" + + # Track supplies that need replacement (below 10% or not installed) + low_supplies = [] + + for printer_ip, data in all_printers_data.items(): + # Generate FQDN for this printer + fqdn = get_fqdn_from_ip(printer_ip) + + # Check toner levels - map by part number for DesignJets, use index for standard printers + idx_to_color = {} + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data.get('toner_levels', {}).keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + # Fallback if mapping failed + if not idx_to_color: + idx_to_color = {'1': 'Cartridge 1', '2': 'Cartridge 2', '3': 'Cartridge 3', '4': 'Cartridge 4', '5': 'Cartridge 5', '6': 'Cartridge 6'} + else: + idx_to_color = {'1': 'Black', '2': 'Cyan', '3': 'Magenta', '4': 'Yellow'} + + for idx, color_name in idx_to_color.items(): + # Check if this toner exists in the data + if idx in data.get('toner_levels', {}): + display = data['toner_levels'][idx] + percentage = data.get('toner_percentages', {}).get(idx) + + # Get the cartridge description + cartridge_desc = "Unknown Cartridge" + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + # Normalize the cartridge description to remove serial numbers + cartridge_desc = normalize_supply_description(desc) + + # Add to low supplies if percentage <= 10% or not installed + if percentage is not None and percentage <= 10: + low_supplies.append({ + 'printer_ip': printer_ip, + 'fqdn': fqdn, + 'hostname': data.get('hostname', 'Unknown'), + 'model': data.get('normalized_model', data.get('model', 'Unknown')), + 'color': color_name, + 'percentage': percentage, + 'cartridge': cartridge_desc, + 'status': 'LOW' + }) + elif 'Not installed' in display or 'not installed' in display.lower(): + low_supplies.append({ + 'printer_ip': printer_ip, + 'fqdn': fqdn, + 'hostname': data.get('hostname', 'Unknown'), + 'model': data.get('normalized_model', data.get('model', 'Unknown')), + 'color': color_name, + 'percentage': 0, + 'cartridge': cartridge_desc, + 'status': 'MISSING' + }) + + # Build supply to models mapping + supply_to_models = {} + for model_name, supplies in models_data.items(): + for supply_desc in set(supplies): + if supply_desc not in supply_to_models: + supply_to_models[supply_desc] = [] + if model_name not in supply_to_models[supply_desc]: + supply_to_models[supply_desc].append(model_name) + + # Categorize supplies for consolidated summary + categories = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + for supply_desc, model_list in supply_to_models.items(): + supply_lower = supply_desc.lower() + if 'toner' in supply_lower and 'waste' not in supply_lower: + categories['Toner Cartridges'].append((supply_desc, model_list)) + elif 'drum' in supply_lower: + categories['Drums'].append((supply_desc, model_list)) + elif 'fuser' in supply_lower: + categories['Fusers'].append((supply_desc, model_list)) + elif 'waste' in supply_lower: + categories['Waste Toner'].append((supply_desc, model_list)) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categories['Transfer/Belt'].append((supply_desc, model_list)) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categories['Maintenance Kits'].append((supply_desc, model_list)) + else: + categories['Other'].append((supply_desc, model_list)) + + # Read favicon and convert to base64 + import base64 + try: + with open('output/favicon.ico', 'rb') as f: + favicon_base64 = base64.b64encode(f.read()).decode('utf-8') + favicon_data_uri = f"data:image/x-icon;base64,{favicon_base64}" + except: + favicon_data_uri = "" + + # Embedded SVG logos + logo_svg = ''' + + + + + + +''' + + dark_logo_svg = ''' + + + + + + +''' + + html = f""" + + + + + Printer Inventory Report - West Jefferson Facility + + + + + +
+
+
+
+ +
+
+

Printer Inventory Report

+
West Jefferson Facility
+
+
+
Generated on
{datetime.now().strftime('%B %d, %Y at %I:%M %p')}
+ +
+
+
+ + + + +
+ +
""" + + if low_supplies: + html += f""" +
+

+ + + + + + Supplies Requiring Immediate Replacement ({len(low_supplies)} items) +

+
+""" + for item in sorted(low_supplies, key=lambda x: (0 if x['status'] == 'MISSING' else 1, x['percentage'])): + if item['status'] == 'MISSING': + status_text = f"{item['color']} Toner: NOT INSTALLED" + alert_label = "MISSING CARTRIDGE - INSTALL NOW" + else: + status_text = f"{item['color']} Toner: {item['percentage']}% remaining" + alert_label = "CRITICAL - ORDER NOW" + + html += f""" +
+ {item['fqdn']} +
+
{status_text}
+
Part: {item['cartridge'][:80]}
+
{alert_label}
+
+
+""" + html += """ +
+
+""" + else: + html += """ +
+

+ + + + + Supply Status +

+
All printer supplies are above 10% - No immediate replacements needed
+
+""" + + html += """ +
+ + +
+
+

Individual Printer Status

+
+""" + + # Add each printer + for printer_ip, data in sorted(all_printers_data.items()): + printer_type = 'Color' if data.get('is_color') else 'Monochrome' + badge_class = 'badge-color' if data.get('is_color') else 'badge-mono' + fqdn = get_fqdn_from_ip(printer_ip) + + html += f""" +
+

{fqdn}

+
+ IP Address: + {printer_ip} +
+
+ Model: + {data.get('normalized_model', data.get('model', 'Unknown'))} + {printer_type} +
+
+ Serial: + {data.get('serial', 'Unknown')} +
+""" + + # Add toner levels + if data.get('toner_levels'): + # Use "Ink Levels" for large format printers + supply_label = "Ink Levels" if data.get('is_large_format', False) else "Toner Levels" + html += f""" +
+

{supply_label}

+""" + # Map by part number for DesignJets, use index for standard printers + idx_to_color = {} + if data.get('is_large_format', False): + # Try to map by HP 730 part numbers + for idx in data.get('toner_levels', {}).keys(): + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + color = map_hp730_color(desc) + if color: + idx_to_color[idx] = color + # Fallback if mapping failed + if not idx_to_color: + idx_to_color = {'1': 'Cartridge 1', '2': 'Cartridge 2', '3': 'Cartridge 3', '4': 'Cartridge 4', '5': 'Cartridge 5', '6': 'Cartridge 6'} + else: + idx_to_color = {'1': 'Black', '2': 'Cyan', '3': 'Magenta', '4': 'Yellow'} + + # Define display order for colors + color_order = ['Matte Black', 'Photo Black', 'Cyan', 'Magenta', 'Yellow', 'Gray', 'Black'] + + # Sort indices by color order + sorted_indices = sorted( + [idx for idx in data['toner_levels'].keys() if idx in idx_to_color], + key=lambda x: color_order.index(idx_to_color[x]) if idx_to_color[x] in color_order else 999 + ) + + for idx in sorted_indices: + color = idx_to_color.get(idx, f'Index {idx}') + if idx in data['toner_levels']: + # Check if this index actually contains toner/cartridge, not maintenance kit + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + desc_lower = desc.lower() + # Skip if it's clearly not a toner cartridge + if any(keyword in desc_lower for keyword in ['maintenance kit', 'fuser', 'transfer', 'drum cartridge kit']): + continue + + display = data['toner_levels'][idx] + percentage = data.get('toner_percentages', {}).get(idx) + + # Determine progress bar class + if percentage is not None: + if percentage < 20: + progress_class = 'progress-low' + elif percentage < 50: + progress_class = 'progress-medium' + else: + progress_class = 'progress-high' + width = max(percentage, 5) # Minimum width for visibility + else: + progress_class = '' + width = 0 + + html += f""" +
+
{color}
+
+""" + + if percentage is not None: + html += f""" +
+
+ {percentage}% +
+
+""" + else: + html += f""" + {display} +""" + + html += """ +
+""" + + # Add cartridge info + if idx in data.get('supplies', {}): + desc = data['supplies'][idx].get('description', '') + if desc: + # Replace generic Xerox PNs with known specific ones (before normalizing) + model_name = data.get('normalized_model', data.get('model', '')) + enriched_desc = replace_generic_xerox_pn(desc, model_name) + # Normalize supply description + normalized_desc = normalize_supply_description(enriched_desc) + html += f""" +
Part: {normalized_desc[:80]}
+""" + + html += """ +
+""" + + html += """ +
+""" + + # Add other supplies + if data.get('supplies'): + other_supplies = [] + # Exclude main ink/toner cartridges (1-6 for DesignJets, 1-4 for standard printers) + excluded_indices = ['1', '2', '3', '4', '5', '6'] if data.get('is_large_format', False) else ['1', '2', '3', '4'] + for idx, supply in data['supplies'].items(): + if idx not in excluded_indices: + desc = supply.get('description', '') + if desc: + keywords = ['fuser', 'drum', 'waste', 'transfer', 'belt', 'roller', 'kit'] + if any(keyword in desc.lower() for keyword in keywords): + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + # Normalize supply description to remove serial numbers + normalized_desc = normalize_supply_description(desc) + other_supplies.append(normalized_desc) + + if other_supplies: + html += """ +
+

Other Supplies

+
+""" + for supply in sorted(set(other_supplies)): + html += f""" +
{supply[:90]}
+""" + html += """ +
+
+""" + + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Replacement Parts by Printer Model

+""" + + # Add each model + for model_name in sorted(models_data.keys()): + supplies = models_data[model_name] + + # Categorize supplies + categorized = { + 'Toner Cartridges': [], + 'Drums': [], + 'Fusers': [], + 'Waste Toner': [], + 'Transfer/Belt': [], + 'Maintenance Kits': [], + 'Other': [] + } + + # Filter out generic Xerox entries when we have specific PNs + filtered_supplies = filter_generic_supplies(set(supplies)) + + for supply_desc in sorted(filtered_supplies): + supply_lower = supply_desc.lower() + if 'toner' in supply_lower and 'waste' not in supply_lower: + categorized['Toner Cartridges'].append(supply_desc) + elif 'drum' in supply_lower: + categorized['Drums'].append(supply_desc) + elif 'fuser' in supply_lower: + categorized['Fusers'].append(supply_desc) + elif 'waste' in supply_lower: + categorized['Waste Toner'].append(supply_desc) + elif 'transfer' in supply_lower or 'belt' in supply_lower: + categorized['Transfer/Belt'].append(supply_desc) + elif 'maintenance' in supply_lower or 'kit' in supply_lower: + categorized['Maintenance Kits'].append(supply_desc) + else: + categorized['Other'].append(supply_desc) + + html += f""" +
+

{model_name}

+""" + + for category, items in categorized.items(): + if items: + html += f""" +
+

{category}

+
    +""" + for item in sorted(items): + html += f""" +
  • {item}
  • +""" + html += """ +
+
+""" + + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Supply Inventory - Consolidated View

+
+""" + + for category_name, items in categories.items(): + if items: + html += f""" +
+

{category_name}

+""" + for supply_desc, model_list in sorted(items): + model_count = len(model_list) + if model_count > 1: + count_text = f"{model_count} models" + else: + count_text = model_list[0][:40] + + html += f""" +
+
{supply_desc}
+
{count_text}
+
+""" + html += """ +
+""" + + html += """ +
+
+
+ + +
+
+

Supply Compatibility & Consolidation Opportunities

+

+ Based on manufacturer specifications and cross-reference research, these printer models share compatible supplies. + Consolidating inventory around these groups can reduce SKU count and simplify purchasing. +

+""" + + # Check which models from compatibility groups are actually in our inventory + inventory_models = set(models_data.keys()) + + # Group compatibility items by priority + priority_order = ['Critical', 'High', 'Medium'] + for priority in priority_order: + groups_in_priority = [g for g in COMPATIBILITY_GROUPS if g['priority'] == priority] + + for group in groups_in_priority: + # Check which models from this group are in our inventory + models_in_inventory = [m for m in group['models'] if m in inventory_models] + + priority_class = group['priority'].lower() + html += f""" +
+
+

{group['name']}

+ {group['priority']} Value +
+ +
+ Compatible Models: +
    +""" + for model in group['models']: + in_inventory = ' โœ“ In Inventory' if model in inventory_models else '' + html += f""" +
  • {model}{in_inventory}
  • +""" + html += """ +
+
+ +
+ Shared Supplies: +""" + for supply in group['shared_supplies']: + html += f""" +
+
{supply['type']}
+
    +""" + for part in supply['parts']: + html += f""" +
  • {part}
  • +""" + html += """ +
+
+""" + html += f""" +
+ +
+ Consolidation Benefit: + {group['benefit']} +
+""" + + # Show which printers in our inventory match this group + if models_in_inventory: + html += f""" +
+ Printers in Your Inventory ({len(models_in_inventory)} model{'s' if len(models_in_inventory) > 1 else ''}): +
    +""" + for model in models_in_inventory: + # Count how many printers of this model we have + printer_count = sum(1 for p_data in all_printers_data.values() + if p_data.get('normalized_model') == model) + html += f""" +
  • {model} ({printer_count} printer{'s' if printer_count > 1 else ''})
  • +""" + html += """ +
+
+""" + html += """ +
+""" + + html += """ +
+
+
+ + + + + +""" + + return html + + +def main(): + """Main function to extract summaries from all printer CSVs""" + output_dir = "output" + + if not os.path.exists(output_dir): + print(f"Error: Output directory '{output_dir}' not found") + print("Please run snmp_scanner.py first") + sys.exit(1) + + csv_files = list(Path(output_dir).glob("printer-*.csv")) + + if not csv_files: + print(f"No CSV files found in {output_dir}/") + sys.exit(1) + + print(f"Found {len(csv_files)} printer scan files") + print("\n" + "="*70) + print("PRINTER SNMP DATA SUMMARY") + print("="*70) + + # Dictionary to collect models and their supplies + models_data = {} + all_printers_data = {} + + for csv_file in sorted(csv_files): + # Extract IP from filename + filename = csv_file.stem + ip_match = re.search(r'printer-(\d+)-(\d+)-(\d+)-(\d+)', filename) + if ip_match: + printer_ip = '.'.join(ip_match.groups()) + print_printer_summary(printer_ip, csv_file) + + # Extract data for model summary + data = extract_key_data(csv_file) + model = data['model'] + normalized_model = normalize_model_name(model) + + # Store printer data with both original and normalized model + data['normalized_model'] = normalized_model + all_printers_data[printer_ip] = data + + if normalized_model not in models_data: + models_data[normalized_model] = [] + + # Add all supplies for this model + for idx, supply in data['supplies'].items(): + desc = supply.get('description', '') + if desc: + # Fix unknown part numbers with known ones based on model + desc = fix_unknown_part_numbers(desc, data['model']) + # Replace generic Xerox PNs with known specific ones (before normalizing) + enriched_desc = replace_generic_xerox_pn(desc, normalized_model) + # Normalize supply description to remove serial numbers + normalized_desc = normalize_supply_description(enriched_desc) + models_data[normalized_model].append(normalized_desc) + + # Add maintenance kit info if available + if data['maintenance_kit']: + if 'model' in data['maintenance_kit']: + models_data[normalized_model].append(f"Maintenance Kit: {data['maintenance_kit']['model']}") + + print(f"\n{'='*70}") + print("Summary complete!") + print(f"{'='*70}\n") + + # Print models with their supplies + print_models_with_supplies(models_data) + + # Generate HTML report + html_content = generate_html_report(models_data, all_printers_data) + html_file = "output/printer_report.html" + + with open(html_file, 'w', encoding='utf-8') as f: + f.write(html_content) + + print(f"\n{'='*70}") + print(f"HTML report generated: {html_file}") + print(f"Self-contained report with embedded logos and assets") + print(f"{'='*70}\n") + + +if __name__ == "__main__": + main() diff --git a/generate_printer_templates.py b/generate_printer_templates.py new file mode 100644 index 0000000..9709db7 --- /dev/null +++ b/generate_printer_templates.py @@ -0,0 +1,792 @@ +#!/usr/bin/env python3 +""" +Generate separate Zabbix templates for different printer types +Based on actual SNMP analysis of network printers +Includes supply compatibility/consolidation recommendations +""" + +import json +import uuid +import yaml + +# Supply compatibility and consolidation data +# Maps specific part numbers to compatible/consolidated alternatives +SUPPLY_COMPATIBILITY = { + # HP LaserJet Pro M404n/M406 - HIGH VALUE consolidation + 'CF258A': { + 'consolidated': 'CF258A or CF258X (58A/58X)', + 'compatible_models': ['HP LaserJet Pro M404n', 'HP LaserJet Pro M406'], + 'note': 'Both models share identical toner and fuser' + }, + 'CF258X': { + 'consolidated': 'CF258A or CF258X (58A/58X)', + 'compatible_models': ['HP LaserJet Pro M404n', 'HP LaserJet Pro M406'], + 'note': 'High-yield version - Both models compatible' + }, + + # HP Color LaserJet M254dw - CRITICAL correction + 'CF500A': { + 'consolidated': 'CF500A (202A Black)', + 'compatible_models': ['HP Color LaserJet M254dw'], + 'note': 'Uses 202A series, NOT 414A series' + }, + 'CF501A': { + 'consolidated': 'CF501A (202A Cyan)', + 'compatible_models': ['HP Color LaserJet M254dw'], + 'note': 'Uses 202A series, NOT 414A series' + }, + 'CF502A': { + 'consolidated': 'CF502A (202A Magenta)', + 'compatible_models': ['HP Color LaserJet M254dw'], + 'note': 'Uses 202A series, NOT 414A series' + }, + 'CF503A': { + 'consolidated': 'CF503A (202A Yellow)', + 'compatible_models': ['HP Color LaserJet M254dw'], + 'note': 'Uses 202A series, NOT 414A series' + }, + + # HP LaserJet 90A/X family + 'CE390A': { + 'consolidated': 'CE390A or CE390X (90A/90X)', + 'compatible_models': ['HP LaserJet M4555', 'HP LaserJet M602', 'HP LaserJet M603'], + 'note': 'Standard yield - compatible across M4555/M602/M603' + }, + 'CE390X': { + 'consolidated': 'CE390A or CE390X (90A/90X)', + 'compatible_models': ['HP LaserJet M4555', 'HP LaserJet M602', 'HP LaserJet M603'], + 'note': 'High yield - compatible across M4555/M602/M603' + }, + + # HP LaserJet 42A/X family + 'Q5942A': { + 'consolidated': 'Q5942A or Q5942X (42A/42X)', + 'compatible_models': ['HP LaserJet 4250', 'HP LaserJet 4350'], + 'note': 'Standard yield - compatible across 4250/4350' + }, + 'Q5942X': { + 'consolidated': 'Q5942A or Q5942X (42A/42X)', + 'compatible_models': ['HP LaserJet 4250', 'HP LaserJet 4350'], + 'note': 'High yield - compatible across 4250/4350' + }, + + # HP LaserJet 55X family + 'CE255X': { + 'consolidated': 'CE255X (55X)', + 'compatible_models': ['HP LaserJet P3015', 'HP LaserJet P3010'], + 'note': 'High yield - compatible across P3015/P3010' + }, + + # Xerox VersaLink C405/C400 series + '106R03536': { + 'consolidated': '106R03536 (Black)', + 'compatible_models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'note': 'C405 and C400 share identical toner series' + }, + '106R03537': { + 'consolidated': '106R03537 (Yellow)', + 'compatible_models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'note': 'C405 and C400 share identical toner series' + }, + '106R03538': { + 'consolidated': '106R03538 (Cyan)', + 'compatible_models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'note': 'C405 and C400 share identical toner series' + }, + '106R03539': { + 'consolidated': '106R03539 (Magenta)', + 'compatible_models': ['Xerox VersaLink C405', 'Xerox VersaLink C400'], + 'note': 'C405 and C400 share identical toner series' + }, + + # Xerox VersaLink B405/B400 series + '106R03580': { + 'consolidated': '106R03580/81/82 (Standard/High/Extra-High)', + 'compatible_models': ['Xerox VersaLink B405', 'Xerox VersaLink B400'], + 'note': 'B405 and B400 share 106R035xx toner family' + }, + '106R03581': { + 'consolidated': '106R03580/81/82 (Standard/High/Extra-High)', + 'compatible_models': ['Xerox VersaLink B405', 'Xerox VersaLink B400'], + 'note': 'B405 and B400 share 106R035xx toner family' + }, + '106R03582': { + 'consolidated': '106R03580/81/82 (Standard/High/Extra-High)', + 'compatible_models': ['Xerox VersaLink B405', 'Xerox VersaLink B400'], + 'note': 'B405 and B400 share 106R035xx toner family' + }, +} + +def get_compatibility_info(part_number_string): + """ + Extract part number and look up compatibility information + Returns consolidated recommendation or original part number + """ + if not part_number_string: + return None + + # Extract part number patterns (e.g., "CF258A", "106R03536") + import re + # Look for common HP/Xerox part number patterns + patterns = [ + r'([A-Z]{2}\d{3,4}[A-Z]{0,1})', # HP: CF258A, CE390X, etc. + r'(\d{3}R\d{5})', # Xerox: 106R03536, etc. + ] + + for pattern in patterns: + match = re.search(pattern, part_number_string) + if match: + part_num = match.group(1) + if part_num in SUPPLY_COMPATIBILITY: + compat = SUPPLY_COMPATIBILITY[part_num] + return f"{compat['consolidated']} - {compat['note']}" + + # No compatibility info found, return original + return None + + +# Common preprocessing JavaScript for hex-encoded strings +HEX_PREPROCESSOR = """// Handle hex-encoded SNMP strings +// Try multiple approaches to convert hex to ASCII + +// First, check if it looks like hex (with spaces, newlines, or other separators) +var hexPattern = /^[0-9A-Fa-f\\s]+$/; +if (hexPattern.test(value) && value.length > 4) { + // Extract all hex pairs (2 characters) + var hexBytes = value.match(/[0-9A-Fa-f]{2}/g); + if (hexBytes && hexBytes.length > 0) { + var result = ''; + for (var i = 0; i < hexBytes.length; i++) { + var code = parseInt(hexBytes[i], 16); + // Only keep printable ASCII (0x20-0x7E) + if (code >= 32 && code <= 126) { + result += String.fromCharCode(code); + } + } + if (result.length > 0) { + return result; + } + } +} + +// Fallback: Remove non-printable characters +return value.replace(/[^\\x20-\\x7E]/g, '');""" + +# Preprocessing for numeric items that may return -3 (unknown), -2 (unknown), or other negative "special" values +# Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown +# Convert negative values to 0 (indicates empty/problem state) +UNKNOWN_VALUE_PREPROCESSOR = """// Handle SNMP unknown values (-3, -2, etc.) +// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown +// Convert to 0 to indicate empty/problem state +var numValue = parseInt(value); +if (numValue < 0) { + return '0'; +} +return value;""" + +# Preprocessing for part number fields - removes serial numbers and firmware info +PART_NUMBER_CLEANER = """// Clean up part number by removing serial numbers and firmware +// Handles formats like: +// "Toner Cartridge;SNACC7952D80730000" -> "Toner Cartridge" +// "Black Cartridge HP 58A (CF258A);FW:V4.23.3" -> "Black Cartridge HP 58A (CF258A)" +// "Drum Cartridge, PN 101R00554;SN2600A90008100000" -> "Drum Cartridge, PN 101R00554" + +// First, apply hex conversion if needed +var hexPattern = /^[0-9A-Fa-f\\s]+$/; +if (hexPattern.test(value) && value.length > 4) { + var hexBytes = value.match(/[0-9A-Fa-f]{2}/g); + if (hexBytes && hexBytes.length > 0) { + var result = ''; + for (var i = 0; i < hexBytes.length; i++) { + var code = parseInt(hexBytes[i], 16); + if (code >= 32 && code <= 126) { + result += String.fromCharCode(code); + } + } + if (result.length > 0) { + value = result; + } + } +} + +// Remove serial numbers (;SN followed by anything) +value = value.replace(/;SN[^;]*/g, ''); + +// Remove firmware info (;FW: or ;FW followed by anything) +value = value.replace(/;FW[^;]*/g, ''); + +// Remove any other semicolon-separated metadata +// (but keep the main description before first semicolon) +var parts = value.split(';'); +value = parts[0]; + +// Trim whitespace +value = value.trim(); + +// For Xerox printers reporting just "Toner Cartridge" without PN, +// try to add known part numbers (must match model-specific logic) +// This is handled by triggers showing compatibility notes instead + +return value;""" + +# Template configurations +TEMPLATES = { + "hp_mono": { + "name": "HP LaserJet - Monochrome", + "description": "HP LaserJet printers (all models - mono)", + "items": [ + # Basic info + {"name": "Printer Model", "key": "printer.model", "oid": "1.3.6.1.2.1.25.3.2.1.3.1", "type": "text"}, + {"name": "Printer Hostname", "key": "printer.hostname", "oid": "1.3.6.1.2.1.1.5.0", "type": "text"}, + {"name": "Printer Serial Number", "key": "printer.serial", "oid": "1.3.6.1.2.1.43.5.1.1.17.1", "type": "text"}, + {"name": "System Location", "key": "printer.location", "oid": "1.3.6.1.2.1.1.6.0", "type": "text"}, + + # Black toner - Index 1 + {"name": "Black Toner Part Number", "key": "printer.cartridge.black", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", "type": "text"}, + {"name": "Black Toner Current", "key": "printer.toner.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Max", "key": "printer.toner.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Level", "key": "printer.toner.black", "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", "part_key": "printer.cartridge.black", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Maintenance kit - Index 2 or HP MIB + {"name": "Maintenance Kit Part Number", "key": "printer.maintenance.model", "oid": "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0", "type": "text"}, + {"name": "Maintenance Kit Remaining", "key": "printer.maintenance.remaining", "oid": "1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0", "type": "numeric", "units": "pages", + "part_key": "printer.maintenance.model", "triggers": [ + {"severity": "warning", "threshold": 10000, "expression": "<"}, + {"severity": "high", "threshold": 5000, "expression": "<"} + ]}, + ] + }, + + "hp_color": { + "name": "HP LaserJet - Color", + "description": "HP Color LaserJet printers (all models)", + "items": [ + # Basic info + {"name": "Printer Model", "key": "printer.model", "oid": "1.3.6.1.2.1.25.3.2.1.3.1", "type": "text"}, + {"name": "Printer Hostname", "key": "printer.hostname", "oid": "1.3.6.1.2.1.1.5.0", "type": "text"}, + {"name": "Printer Serial Number", "key": "printer.serial", "oid": "1.3.6.1.2.1.43.5.1.1.17.1", "type": "text"}, + {"name": "System Location", "key": "printer.location", "oid": "1.3.6.1.2.1.1.6.0", "type": "text"}, + + # Toner cartridges - Indices 1-4 + {"name": "Black Toner Part Number", "key": "printer.cartridge.black", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", "type": "text"}, + {"name": "Black Toner Current", "key": "printer.toner.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Max", "key": "printer.toner.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Level", "key": "printer.toner.black", "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", "color": "black", "part_key": "printer.cartridge.black", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Cyan Toner Part Number", "key": "printer.cartridge.cyan", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.2", "type": "text"}, + {"name": "Cyan Toner Current", "key": "printer.toner.cyan.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Max", "key": "printer.toner.cyan.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Level", "key": "printer.toner.cyan", "type": "calculated", + "formula": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "units": "%", "color": "cyan", "part_key": "printer.cartridge.cyan", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Magenta Toner Part Number", "key": "printer.cartridge.magenta", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.3", "type": "text"}, + {"name": "Magenta Toner Current", "key": "printer.toner.magenta.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Max", "key": "printer.toner.magenta.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Level", "key": "printer.toner.magenta", "type": "calculated", + "formula": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "units": "%", "color": "magenta", "part_key": "printer.cartridge.magenta", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Yellow Toner Part Number", "key": "printer.cartridge.yellow", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.4", "type": "text"}, + {"name": "Yellow Toner Current", "key": "printer.toner.yellow.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Max", "key": "printer.toner.yellow.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Level", "key": "printer.toner.yellow", "type": "calculated", + "formula": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "units": "%", "color": "yellow", "part_key": "printer.cartridge.yellow", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + ] + }, + + "xerox_color": { + "name": "Xerox VersaLink - Color", + "description": "Xerox VersaLink Color multifunction printers", + "items": [ + # Basic info + {"name": "Printer Model", "key": "printer.model", "oid": "1.3.6.1.2.1.25.3.2.1.3.1", "type": "text"}, + {"name": "Printer Hostname", "key": "printer.hostname", "oid": "1.3.6.1.2.1.1.5.0", "type": "text"}, + {"name": "Printer Serial Number", "key": "printer.serial", "oid": "1.3.6.1.2.1.43.5.1.1.17.1", "type": "text"}, + {"name": "System Location", "key": "printer.location", "oid": "1.3.6.1.2.1.1.6.0", "type": "text"}, + + # Toner cartridges - Indices 1-4 + {"name": "Black Toner Part Number", "key": "printer.toner.black.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", "type": "text"}, + {"name": "Black Toner Current", "key": "printer.toner.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Max", "key": "printer.toner.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Level", "key": "printer.toner.black", "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", "color": "black", "part_key": "printer.toner.black.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Yellow Toner Part Number", "key": "printer.toner.yellow.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.2", "type": "text"}, + {"name": "Yellow Toner Current", "key": "printer.toner.yellow.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Max", "key": "printer.toner.yellow.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Level", "key": "printer.toner.yellow", "type": "calculated", + "formula": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "units": "%", "color": "yellow", "part_key": "printer.toner.yellow.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Magenta Toner Part Number", "key": "printer.toner.magenta.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.3", "type": "text"}, + {"name": "Magenta Toner Current", "key": "printer.toner.magenta.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Max", "key": "printer.toner.magenta.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Level", "key": "printer.toner.magenta", "type": "calculated", + "formula": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "units": "%", "color": "magenta", "part_key": "printer.toner.magenta.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Cyan Toner Part Number", "key": "printer.toner.cyan.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.4", "type": "text"}, + {"name": "Cyan Toner Current", "key": "printer.toner.cyan.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Max", "key": "printer.toner.cyan.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Level", "key": "printer.toner.cyan", "type": "calculated", + "formula": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "units": "%", "color": "cyan", "part_key": "printer.toner.cyan.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Waste cartridge - Index 5 + {"name": "Waste Cartridge Part Number", "key": "printer.waste.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.5", "type": "text"}, + {"name": "Waste Cartridge Level", "key": "printer.waste.level", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.5", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.waste.part", "triggers": [ + {"severity": "warning", "threshold": 80, "expression": ">"}, + {"severity": "high", "threshold": 90, "expression": ">"} + ]}, + + # Drum cartridges - Indices 6-9 + {"name": "Black Drum Part Number", "key": "printer.drum.black.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.6", "type": "text"}, + {"name": "Black Drum Current", "key": "printer.drum.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.6", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Drum Max", "key": "printer.drum.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.6", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Drum Level", "key": "printer.drum.black", "type": "calculated", + "formula": "round((last(//printer.drum.black.current)/last(//printer.drum.black.max))*100,0)", + "units": "%", "part_key": "printer.drum.black.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Yellow Drum Part Number", "key": "printer.drum.yellow.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.7", "type": "text"}, + {"name": "Yellow Drum Current", "key": "printer.drum.yellow.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.7", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Drum Max", "key": "printer.drum.yellow.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.7", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Drum Level", "key": "printer.drum.yellow", "type": "calculated", + "formula": "round((last(//printer.drum.yellow.current)/last(//printer.drum.yellow.max))*100,0)", + "units": "%", "part_key": "printer.drum.yellow.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Magenta Drum Part Number", "key": "printer.drum.magenta.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.8", "type": "text"}, + {"name": "Magenta Drum Current", "key": "printer.drum.magenta.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.8", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Drum Max", "key": "printer.drum.magenta.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.8", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Drum Level", "key": "printer.drum.magenta", "type": "calculated", + "formula": "round((last(//printer.drum.magenta.current)/last(//printer.drum.magenta.max))*100,0)", + "units": "%", "part_key": "printer.drum.magenta.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Cyan Drum Part Number", "key": "printer.drum.cyan.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.9", "type": "text"}, + {"name": "Cyan Drum Current", "key": "printer.drum.cyan.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.9", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Drum Max", "key": "printer.drum.cyan.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.9", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Drum Level", "key": "printer.drum.cyan", "type": "calculated", + "formula": "round((last(//printer.drum.cyan.current)/last(//printer.drum.cyan.max))*100,0)", + "units": "%", "part_key": "printer.drum.cyan.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Transfer components - Indices 10-11 + {"name": "Transfer Roller Part Number", "key": "printer.transfer.roller.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.10", "type": "text"}, + {"name": "Transfer Belt Part Number", "key": "printer.transfer.belt.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.11", "type": "text"}, + + # Fuser - Index 12 + {"name": "Fuser Part Number", "key": "printer.fuser.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.12", "type": "text"}, + ] + }, + + "xerox_enterprise": { + "name": "Xerox Enterprise - Color", + "description": "Xerox EC8036, AltaLink C8xxx enterprise color printers", + "items": [ + # Basic info + {"name": "Printer Model", "key": "printer.model", "oid": "1.3.6.1.2.1.25.3.2.1.3.1", "type": "text"}, + {"name": "Printer Hostname", "key": "printer.hostname", "oid": "1.3.6.1.2.1.1.5.0", "type": "text"}, + {"name": "Printer Serial Number", "key": "printer.serial", "oid": "1.3.6.1.2.1.43.5.1.1.17.1", "type": "text"}, + {"name": "System Location", "key": "printer.location", "oid": "1.3.6.1.2.1.1.6.0", "type": "text"}, + + # Toner cartridges - Indices 1-4 + {"name": "Black Toner Part Number", "key": "printer.toner.black.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", "type": "text"}, + {"name": "Black Toner Current", "key": "printer.toner.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Max", "key": "printer.toner.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Black Toner Level", "key": "printer.toner.black", "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", "color": "black", "part_key": "printer.toner.black.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Cyan Toner Part Number", "key": "printer.toner.cyan.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.2", "type": "text"}, + {"name": "Cyan Toner Current", "key": "printer.toner.cyan.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Max", "key": "printer.toner.cyan.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.2", "type": "numeric", "can_be_unknown": True}, + {"name": "Cyan Toner Level", "key": "printer.toner.cyan", "type": "calculated", + "formula": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "units": "%", "color": "cyan", "part_key": "printer.toner.cyan.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Magenta Toner Part Number", "key": "printer.toner.magenta.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.3", "type": "text"}, + {"name": "Magenta Toner Current", "key": "printer.toner.magenta.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Max", "key": "printer.toner.magenta.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.3", "type": "numeric", "can_be_unknown": True}, + {"name": "Magenta Toner Level", "key": "printer.toner.magenta", "type": "calculated", + "formula": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "units": "%", "color": "magenta", "part_key": "printer.toner.magenta.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Yellow Toner Part Number", "key": "printer.toner.yellow.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.4", "type": "text"}, + {"name": "Yellow Toner Current", "key": "printer.toner.yellow.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Max", "key": "printer.toner.yellow.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.4", "type": "numeric", "can_be_unknown": True}, + {"name": "Yellow Toner Level", "key": "printer.toner.yellow", "type": "calculated", + "formula": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "units": "%", "color": "yellow", "part_key": "printer.toner.yellow.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Drum cartridges - Indices 5-8 (percentage-based) + {"name": "Drum Cartridge R1 Part Number", "key": "printer.drum.r1.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.5", "type": "text"}, + {"name": "Drum Cartridge R1 Level", "key": "printer.drum.r1", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.5", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.drum.r1.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Drum Cartridge R2 Part Number", "key": "printer.drum.r2.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.6", "type": "text"}, + {"name": "Drum Cartridge R2 Level", "key": "printer.drum.r2", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.6", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.drum.r2.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Drum Cartridge R3 Part Number", "key": "printer.drum.r3.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.7", "type": "text"}, + {"name": "Drum Cartridge R3 Level", "key": "printer.drum.r3", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.7", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.drum.r3.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Drum Cartridge R4 Part Number", "key": "printer.drum.r4.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.8", "type": "text"}, + {"name": "Drum Cartridge R4 Level", "key": "printer.drum.r4", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.8", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.drum.r4.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Fuser - Index 9 + {"name": "Fuser Part Number", "key": "printer.fuser.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.9", "type": "text"}, + {"name": "Fuser Level", "key": "printer.fuser", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.9", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.fuser.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Waste container - Index 10 + {"name": "Waste Container Part Number", "key": "printer.waste.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.10", "type": "text"}, + {"name": "Waste Container Level", "key": "printer.waste", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.10", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.waste.part", "triggers": [ + {"severity": "warning", "threshold": 80, "expression": ">"}, + {"severity": "high", "threshold": 90, "expression": ">"} + ]}, + + # Transfer components - Indices 11-12 + {"name": "Transfer Belt Cleaner Part Number", "key": "printer.transfer.belt.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.11", "type": "text"}, + {"name": "Transfer Belt Cleaner Level", "key": "printer.transfer.belt", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.11", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.transfer.belt.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + {"name": "Second Bias Transfer Roll Part Number", "key": "printer.transfer.roller.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.12", "type": "text"}, + {"name": "Second Bias Transfer Roll Level", "key": "printer.transfer.roller", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.12", "type": "numeric", "units": "%", + "can_be_unknown": True, "part_key": "printer.transfer.roller.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + ] + }, + + "xerox_mono": { + "name": "Xerox VersaLink - Monochrome", + "description": "Xerox VersaLink B&W multifunction printers", + "items": [ + # Basic info + {"name": "Printer Model", "key": "printer.model", "oid": "1.3.6.1.2.1.25.3.2.1.3.1", "type": "text"}, + {"name": "Printer Hostname", "key": "printer.hostname", "oid": "1.3.6.1.2.1.1.5.0", "type": "text"}, + {"name": "Printer Serial Number", "key": "printer.serial", "oid": "1.3.6.1.2.1.43.5.1.1.17.1", "type": "text"}, + {"name": "System Location", "key": "printer.location", "oid": "1.3.6.1.2.1.1.6.0", "type": "text"}, + + # Toner cartridge - Index 1 + {"name": "Toner Part Number", "key": "printer.toner.black.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", "type": "text"}, + {"name": "Toner Current", "key": "printer.toner.black.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Toner Max", "key": "printer.toner.black.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", "type": "numeric", "can_be_unknown": True}, + {"name": "Toner Level", "key": "printer.toner.black", "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", "part_key": "printer.toner.black.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Drum cartridge - Index 6 + {"name": "Drum Part Number", "key": "printer.drum.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.6", "type": "text"}, + {"name": "Drum Current", "key": "printer.drum.current", "oid": "1.3.6.1.2.1.43.11.1.1.9.1.6", "type": "numeric", "can_be_unknown": True}, + {"name": "Drum Max", "key": "printer.drum.max", "oid": "1.3.6.1.2.1.43.11.1.1.8.1.6", "type": "numeric", "can_be_unknown": True}, + {"name": "Drum Level", "key": "printer.drum", "type": "calculated", + "formula": "round((last(//printer.drum.current)/last(//printer.drum.max))*100,0)", + "units": "%", "part_key": "printer.drum.part", "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ]}, + + # Transfer roller - Index 10 + {"name": "Transfer Roller Part Number", "key": "printer.transfer.roller.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.10", "type": "text"}, + + # Fuser - Index 12 + {"name": "Fuser Part Number", "key": "printer.fuser.part", "oid": "1.3.6.1.2.1.43.11.1.1.6.1.12", "type": "text"}, + ] + } +} + + +def create_zabbix_item(item_def, template_name): + """Create a Zabbix item from definition""" + + if item_def['type'] == 'calculated': + # Calculated item + zabbix_item = { + "uuid": uuid.uuid4().hex, + "name": item_def['name'], + "type": "CALCULATED", + "key": item_def['key'], + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": item_def['formula'], + "description": item_def.get('description', item_def['name']), + "tags": [ + {"tag": "component", "value": "supplies"}, + {"tag": "type", "value": "level"} + ] + } + + if 'color' in item_def: + zabbix_item['tags'].append({"tag": "color", "value": item_def['color']}) + + else: + # SNMP item + zabbix_item = { + "uuid": uuid.uuid4().hex, + "name": item_def['name'], + "type": "SNMP_AGENT", + "snmp_oid": f"get[{item_def['oid']}]", + "key": item_def['key'], + "delay": "1h", + "history": "90d", + "trends": "365d" if item_def['type'] == 'numeric' else "0d", + "value_type": "TEXT" if item_def['type'] == 'text' else "FLOAT", + "description": item_def.get('description', item_def['name']), + "tags": [ + {"tag": "component", "value": "printer"}, + {"tag": "type", "value": "info" if item_def['type'] == 'text' else "raw"} + ] + } + + # Add preprocessing for text items + if item_def['type'] == 'text': + # Use part number cleaner for items with "Part Number" in the name + if 'Part Number' in item_def['name'] or 'part' in item_def.get('key', ''): + zabbix_item['preprocessing'] = [ + { + "type": "JAVASCRIPT", + "parameters": [PART_NUMBER_CLEANER] + } + ] + else: + # Use hex preprocessor for other text items + zabbix_item['preprocessing'] = [ + { + "type": "JAVASCRIPT", + "parameters": [HEX_PREPROCESSOR] + } + ] + + # Add preprocessing for numeric items that can report unknown values + # This applies to items marked with 'can_be_unknown' flag + if item_def['type'] == 'numeric' and item_def.get('can_be_unknown', False): + zabbix_item['preprocessing'] = [ + { + "type": "JAVASCRIPT", + "parameters": [UNKNOWN_VALUE_PREPROCESSOR] + } + ] + + # Add units if specified + if 'units' in item_def: + zabbix_item['units'] = item_def['units'] + + # Add triggers if specified + if 'triggers' in item_def: + zabbix_item['triggers'] = [] + for trigger_def in item_def['triggers']: + severity_map = {"warning": "WARNING", "high": "HIGH", "average": "AVERAGE"} + + # Build expression + expression = f"last(/{template_name}/{item_def['key']}){trigger_def['expression']}{trigger_def['threshold']}" + + # Add part number check if specified + description = f"{item_def['name']} is {'high' if trigger_def['expression'] == '>' else 'low'} on {{{{HOST.NAME}}}}" + if 'part_key' in item_def: + expression += f" and length(last(/{template_name}/{item_def['part_key']}))>0" + + # Check if we have compatibility info for common parts + # This will be displayed in the trigger description to help with ordering + part_recommendation = "{{ITEM.LASTVALUE2}}" + + # Add note about checking compatibility table for alternatives + description += f". Current level: {{{{ITEM.LASTVALUE}}}}. Replacement part: {part_recommendation}" + description += " (See compatibility notes for potential alternatives)" + + trigger = { + "uuid": uuid.uuid4().hex, + "expression": expression, + "name": description, + "priority": severity_map.get(trigger_def['severity'], "WARNING"), + "tags": [{"tag": "scope", "value": "availability"}] + } + + zabbix_item['triggers'].append(trigger) + + return zabbix_item + + +def generate_template(template_key): + """Generate a complete Zabbix template""" + config = TEMPLATES[template_key] + + template = { + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": uuid.uuid4().hex, + "template": config['name'], + "name": config['name'], + "description": config['description'], + "groups": [{"name": "Printers"}], + "items": [] + } + ] + } + } + + # Add all items + for item_def in config['items']: + zabbix_item = create_zabbix_item(item_def, config['name']) + template["zabbix_export"]["templates"][0]["items"].append(zabbix_item) + + return template + + +def main(): + """Generate all templates""" + print("=" * 100) + print("GENERATING ZABBIX PRINTER TEMPLATES") + print("=" * 100) + + for template_key in TEMPLATES.keys(): + config = TEMPLATES[template_key] + print(f"\nGenerating: {config['name']}") + print(f"Description: {config['description']}") + print(f"Items: {len(config['items'])}") + + template = generate_template(template_key) + + # Save YAML + yaml_filename = f"zabbix_template_{template_key}.yaml" + yaml_output = yaml.dump(template, default_flow_style=False, sort_keys=False, allow_unicode=True, width=1000) + with open(yaml_filename, 'w') as f: + f.write(yaml_output) + print(f" โœ“ Saved: {yaml_filename}") + + # Save JSON + json_filename = f"zabbix_template_{template_key}.json" + json_output = json.dumps(template, indent=2) + with open(json_filename, 'w') as f: + f.write(json_output) + print(f" โœ“ Saved: {json_filename}") + + print("\n" + "=" * 100) + print("TEMPLATE USAGE GUIDE") + print("=" * 100) + print("\n1. HP LaserJet - Monochrome") + print(" Use for: HP LaserJet Pro 4xxx, M4xx, M6xx (B&W models)") + print(" Monitors: Black toner, Maintenance kit") + print() + print("2. HP LaserJet - Color") + print(" Use for: HP Color LaserJet Pro, M4xx, M2xx (Color models)") + print(" Monitors: Black/Cyan/Magenta/Yellow toner") + print() + print("3. Xerox VersaLink - Color") + print(" Use for: Xerox VersaLink C7xxx, C4xxx (Color MFPs)") + print(" Monitors: 4 toners, 4 drums, waste, transfer components, fuser") + print() + print("4. Xerox VersaLink - Monochrome") + print(" Use for: Xerox VersaLink B7xxx, B4xxx (B&W MFPs)") + print(" Monitors: Toner, drum, transfer roller, fuser") + print() + print("5. Xerox Enterprise - Color") + print(" Use for: Xerox EC8036, AltaLink C8xxx (Enterprise Color MFPs)") + print(" Monitors: 4 toners, 4 drums, fuser, waste, 2 transfer components (all percentage-based)") + print() + print("\n" + "=" * 100) + print("IMPORT INSTRUCTIONS") + print("=" * 100) + print("\n1. In Zabbix web UI: Configuration โ†’ Templates โ†’ Import") + print("2. Select the appropriate YAML or JSON file for each printer type") + print("3. Link template to printer hosts") + print("4. Configure SNMP interface:") + print(" - Port: 161") + print(" - SNMP version: SNMPv2") + print(" - Community: WestJeff2025") + print() + +if __name__ == "__main__": + main() diff --git a/generate_zabbix_config.py b/generate_zabbix_config.py new file mode 100644 index 0000000..bd0dc23 --- /dev/null +++ b/generate_zabbix_config.py @@ -0,0 +1,683 @@ +#!/usr/bin/env python3 +""" +Generate Zabbix SNMP Item Configuration +Creates Zabbix item definitions for printer monitoring +Includes: Toner, Maintenance Kit, Fuser, Drums, Waste +""" + +import json +import uuid +import yaml + +# Zabbix SNMP items configuration for HP & Xerox printers +ZABBIX_ITEMS = { + "printer_info": [ + { + "name": "Printer Model", + "key": "printer.model", + "oid": "1.3.6.1.2.1.25.3.2.1.3.1", + "type": "text", + "description": "Device model information" + }, + { + "name": "Printer Hostname", + "key": "printer.hostname", + "oid": "1.3.6.1.2.1.1.5.0", + "type": "text", + "description": "System hostname" + }, + { + "name": "Printer Serial Number", + "key": "printer.serial", + "oid": "1.3.6.1.2.1.43.5.1.1.17.1", + "type": "text", + "description": "Printer serial number" + }, + { + "name": "System Location", + "key": "printer.location", + "oid": "1.3.6.1.2.1.1.6.0", + "type": "text", + "description": "Physical location" + }, + { + "name": "MAC Address", + "key": "printer.macaddress", + "oid": "1.3.6.1.2.1.2.2.1.6.2", + "type": "text", + "description": "Primary network interface MAC address" + } + ], + "toner_levels": [ + { + "name": "Black Toner Current", + "key": "printer.toner.black.current", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.1", + "type": "numeric_unsigned", + "units": "", + "description": "Black toner current level (raw value)" + }, + { + "name": "Black Toner Max", + "key": "printer.toner.black.max", + "oid": "1.3.6.1.2.1.43.11.1.1.8.1.1", + "type": "numeric_unsigned", + "units": "", + "description": "Black toner maximum capacity" + }, + { + "name": "Black Toner Level", + "key": "printer.toner.black", + "type": "calculated", + "formula": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "units": "%", + "description": "Black toner percentage", + "color": "black", + "is_percentage": True, + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + { + "name": "Cyan Toner Current", + "key": "printer.toner.cyan.current", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.2", + "type": "numeric_unsigned", + "units": "", + "description": "Cyan toner current level (raw value)" + }, + { + "name": "Cyan Toner Max", + "key": "printer.toner.cyan.max", + "oid": "1.3.6.1.2.1.43.11.1.1.8.1.2", + "type": "numeric_unsigned", + "units": "", + "description": "Cyan toner maximum capacity" + }, + { + "name": "Cyan Toner Level", + "key": "printer.toner.cyan", + "type": "calculated", + "formula": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "units": "%", + "description": "Cyan toner percentage", + "color": "cyan", + "is_percentage": True, + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + { + "name": "Magenta Toner Current", + "key": "printer.toner.magenta.current", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.3", + "type": "numeric_unsigned", + "units": "", + "description": "Magenta toner current level (raw value)" + }, + { + "name": "Magenta Toner Max", + "key": "printer.toner.magenta.max", + "oid": "1.3.6.1.2.1.43.11.1.1.8.1.3", + "type": "numeric_unsigned", + "units": "", + "description": "Magenta toner maximum capacity" + }, + { + "name": "Magenta Toner Level", + "key": "printer.toner.magenta", + "type": "calculated", + "formula": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "units": "%", + "description": "Magenta toner percentage", + "color": "magenta", + "is_percentage": True, + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + { + "name": "Yellow Toner Current", + "key": "printer.toner.yellow.current", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.4", + "type": "numeric_unsigned", + "units": "", + "description": "Yellow toner current level (raw value)" + }, + { + "name": "Yellow Toner Max", + "key": "printer.toner.yellow.max", + "oid": "1.3.6.1.2.1.43.11.1.1.8.1.4", + "type": "numeric_unsigned", + "units": "", + "description": "Yellow toner maximum capacity" + }, + { + "name": "Yellow Toner Level", + "key": "printer.toner.yellow", + "type": "calculated", + "formula": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "units": "%", + "description": "Yellow toner percentage", + "color": "yellow", + "is_percentage": True, + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + } + ], + "cartridge_info": [ + { + "name": "Black Cartridge Part Number", + "key": "printer.cartridge.black", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.1", + "type": "text", + "description": "Black toner cartridge model/part number" + }, + { + "name": "Cyan Cartridge Part Number", + "key": "printer.cartridge.cyan", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.2", + "type": "text", + "description": "Cyan toner cartridge model/part number" + }, + { + "name": "Magenta Cartridge Part Number", + "key": "printer.cartridge.magenta", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.3", + "type": "text", + "description": "Magenta toner cartridge model/part number" + }, + { + "name": "Yellow Cartridge Part Number", + "key": "printer.cartridge.yellow", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.4", + "type": "text", + "description": "Yellow toner cartridge model/part number" + } + ], + "other_supplies": [ + # Drum Cartridge R1 + { + "name": "Drum Cartridge R1 Part Number", + "key": "printer.drum.r1", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.5", + "type": "text", + "description": "Drum cartridge R1 part number" + }, + { + "name": "Drum Cartridge R1 Level", + "key": "printer.drum.r1.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.5", + "type": "numeric_unsigned", + "units": "%", + "description": "Drum cartridge R1 remaining life percentage", + "part_number_item": "printer.drum.r1", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + # Drum Cartridge R2 + { + "name": "Drum Cartridge R2 Part Number", + "key": "printer.drum.r2", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.6", + "type": "text", + "description": "Drum cartridge R2 part number" + }, + { + "name": "Drum Cartridge R2 Level", + "key": "printer.drum.r2.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.6", + "type": "numeric_unsigned", + "units": "%", + "description": "Drum cartridge R2 remaining life percentage", + "part_number_item": "printer.drum.r2", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + # Drum Cartridge R3 + { + "name": "Drum Cartridge R3 Part Number", + "key": "printer.drum.r3", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.7", + "type": "text", + "description": "Drum cartridge R3 part number" + }, + { + "name": "Drum Cartridge R3 Level", + "key": "printer.drum.r3.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.7", + "type": "numeric_unsigned", + "units": "%", + "description": "Drum cartridge R3 remaining life percentage", + "part_number_item": "printer.drum.r3", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + # Drum Cartridge R4 + { + "name": "Drum Cartridge R4 Part Number", + "key": "printer.drum.r4", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.8", + "type": "text", + "description": "Drum cartridge R4 part number" + }, + { + "name": "Drum Cartridge R4 Level", + "key": "printer.drum.r4.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.8", + "type": "numeric_unsigned", + "units": "%", + "description": "Drum cartridge R4 remaining life percentage", + "part_number_item": "printer.drum.r4", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + # Waste Toner Container + { + "name": "Waste Toner Container Part Number", + "key": "printer.waste.partnumber", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.9", + "type": "text", + "description": "Waste toner container part number" + }, + { + "name": "Waste Toner Container Level", + "key": "printer.waste.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.9", + "type": "numeric_unsigned", + "units": "%", + "description": "Waste toner container fill level (higher is more full)", + "part_number_item": "printer.waste.partnumber", + "triggers": [ + {"severity": "warning", "threshold": 80, "expression": ">"}, + {"severity": "high", "threshold": 90, "expression": ">"} + ] + }, + # Transfer Belt Cleaner + { + "name": "Transfer Belt Cleaner Part Number", + "key": "printer.transfer.belt", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.10", + "type": "text", + "description": "Transfer belt cleaner part number" + }, + { + "name": "Transfer Belt Cleaner Level", + "key": "printer.transfer.belt.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.10", + "type": "numeric_unsigned", + "units": "%", + "description": "Transfer belt cleaner remaining life percentage", + "part_number_item": "printer.transfer.belt", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + }, + # Second Bias Transfer Roll + { + "name": "Second Bias Transfer Roll Part Number", + "key": "printer.transfer.roller", + "oid": "1.3.6.1.2.1.43.11.1.1.6.1.11", + "type": "text", + "description": "Second bias transfer roll part number" + }, + { + "name": "Second Bias Transfer Roll Level", + "key": "printer.transfer.roller.level", + "oid": "1.3.6.1.2.1.43.11.1.1.9.1.11", + "type": "numeric_unsigned", + "units": "%", + "description": "Second bias transfer roll remaining life percentage", + "part_number_item": "printer.transfer.roller", + "triggers": [ + {"severity": "warning", "threshold": 20, "expression": "<"}, + {"severity": "high", "threshold": 10, "expression": "<"} + ] + } + ], + "maintenance_kit_hp": [ + { + "name": "Maintenance Kit Model (HP)", + "key": "printer.maintenance.model", + "oid": "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0", + "type": "text", + "description": "HP maintenance kit model/serial number" + }, + { + "name": "Maintenance Kit Remaining (HP)", + "key": "printer.maintenance.remaining", + "oid": "1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0", + "type": "numeric_unsigned", + "units": "pages", + "description": "HP maintenance kit remaining pages", + "part_number_item": "printer.maintenance.model", + "triggers": [ + {"severity": "warning", "threshold": 10000, "expression": "<"}, + {"severity": "high", "threshold": 5000, "expression": "<"} + ] + }, + { + "name": "Printer Model (HP MIB)", + "key": "printer.maintenance.printer_model", + "oid": "1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0", + "type": "text", + "description": "Printer model from HP maintenance MIB" + } + ], + "supply_capacity": [ + { + "name": "Supply 1 Max Capacity", + "key": "printer.supply.1.max", + "oid": "1.3.6.1.2.1.43.10.2.1.4.1.1", + "type": "numeric_unsigned", + "description": "Maximum capacity for supply index 1 (usually black)" + }, + { + "name": "Supply 1 Current Level", + "key": "printer.supply.1.current", + "oid": "1.3.6.1.2.1.43.10.2.1.9.1.1", + "type": "numeric_unsigned", + "description": "Current level for supply index 1 (usually black)" + } + ] +} + + +def generate_zabbix_cli_commands(): + """ + Generate Zabbix CLI commands for adding SNMP items + """ + print("=" * 80) + print("ZABBIX SNMP ITEM CONFIGURATION") + print("=" * 80) + print("\nThese commands can be used in Zabbix CLI or adapted for the web interface.\n") + + for category, items in ZABBIX_ITEMS.items(): + print(f"\n## {category.replace('_', ' ').title()}") + print("-" * 80) + + for item in items: + print(f"\n### {item['name']}") + if 'oid' in item: + print(f"OID: {item['oid']}") + if 'formula' in item: + print(f"Formula: {item['formula']}") + print(f"Key: {item['key']}") + print(f"Type: {item['type']}") + if 'units' in item: + print(f"Units: {item['units']}") + print(f"Description: {item['description']}") + + if 'triggers' in item: + print(f"\nRecommended Triggers:") + for trigger in item['triggers']: + print(f" - {trigger['severity'].upper()}: " + f"{item['name']} {trigger['expression']} {trigger['threshold']}{item.get('units', '')}") + + print() + + +def generate_zabbix_import_json(): + """ + Generate a Zabbix 7.4 importable JSON template + Note: Zabbix requires UUIDs to be 32 characters without hyphens + """ + template = { + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": uuid.uuid4().hex, + "template": "Printer SNMP Monitor", + "name": "Printer SNMP Monitor", + "groups": [ + { + "name": "Printers" + } + ], + "items": [] + } + ] + } + } + + # Build items list with Zabbix 7.4 format + for category, items in ZABBIX_ITEMS.items(): + for item in items: + # Handle calculated items differently + if item['type'] == 'calculated': + # Only add component:toner and color tags if this is a percentage item + is_percentage = item.get('is_percentage', False) + + zabbix_item = { + "uuid": uuid.uuid4().hex, + "name": item['name'], + "type": "CALCULATED", + "key": item['key'], + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": item['formula'], + "description": item['description'], + "tags": [ + { + "tag": "component", + "value": "toner" if is_percentage else "printer" + }, + { + "tag": "category", + "value": category + } + ] + } + + # Add color tag only for toner percentage items + if is_percentage and 'color' in item: + zabbix_item['tags'].append({ + "tag": "color", + "value": item['color'] + }) + else: + # Use get[OID] for better performance in Zabbix 7.4 + snmp_oid = f"get[{item['oid']}]" + + zabbix_item = { + "uuid": uuid.uuid4().hex, + "name": item['name'], + "type": "SNMP_AGENT", + "snmp_oid": snmp_oid, + "key": item['key'], + "delay": "1h", + "history": "90d", + "trends": "365d" if item['type'] != 'text' else "0d", + "value_type": "TEXT" if item['type'] == 'text' else "FLOAT", + "description": item['description'], + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": category + } + ] + } + + # Add inventory mapping for specific items + if item['key'] == 'printer.model': + zabbix_item['inventory_link'] = 'MODEL' + elif item['key'] == 'printer.serial': + zabbix_item['inventory_link'] = 'SERIALNO_A' + elif item['key'] == 'printer.hostname': + zabbix_item['inventory_link'] = 'NAME' + elif item['key'] == 'printer.macaddress': + zabbix_item['inventory_link'] = 'MACADDRESS_A' + + # Add preprocessing for text items to handle hex-encoded strings + # Some SNMP values come as hex strings like "FD E8 48 50 20 4C 61..." + # or as binary with control chars like "รฝรจHP LaserJet" + if item['type'] == 'text': + zabbix_item['preprocessing'] = [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + + if 'units' in item: + zabbix_item['units'] = item['units'] + + # Add triggers if defined - nested inside the item + if 'triggers' in item: + zabbix_item['triggers'] = [] + for trigger_def in item['triggers']: + severity_map = { + "warning": "WARNING", + "high": "HIGH", + "average": "AVERAGE" + } + + template_name = template['zabbix_export']['templates'][0]['template'] + + # Build description and expression with part number reference + description = f"{item['name']} has dropped below {trigger_def['threshold']}{item.get('units', '')}" + + # Build base expression + expression = f"last(/{template_name}/{item['key']}){trigger_def['expression']}{trigger_def['threshold']}" + + # Add replacement part reference for toner items + # We need to add the part number item to the expression so we can reference it with {ITEM.LASTVALUE2} + if 'color' in item and category == "toner_levels": + color = item['color'].lower() + part_key = f"printer.cartridge.{color}" + # Add the part number item to the expression using "and" so it's evaluated but doesn't affect trigger logic + expression = f"last(/{template_name}/{item['key']}){trigger_def['expression']}{trigger_def['threshold']} and length(last(/{template_name}/{part_key}))>0" + description += ". Replacement part: {ITEM.LASTVALUE2}" + # Add replacement part reference for other items with part_number_item + elif 'part_number_item' in item: + part_key = item['part_number_item'] + # Add the part number item to the expression using "and" so it's evaluated but doesn't affect trigger logic + expression = f"last(/{template_name}/{item['key']}){trigger_def['expression']}{trigger_def['threshold']} and length(last(/{template_name}/{part_key}))>0" + description += ". Replacement part: {ITEM.LASTVALUE2}" + + trigger = { + "uuid": uuid.uuid4().hex, + "expression": expression, + "name": f"{item['name']} is low on {{{{HOST.NAME}}}}", + "priority": severity_map.get(trigger_def['severity'], "WARNING"), + "description": description, + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + + zabbix_item['triggers'].append(trigger) + + template["zabbix_export"]["templates"][0]["items"].append(zabbix_item) + + return template + + +def main(): + """ + Main function + """ + print("\n" + "=" * 80) + print("ZABBIX CONFIGURATION GENERATOR FOR PRINTER SNMP MONITORING") + print("Includes: Toner, Maintenance Kit, Fuser, Drums, Waste, Transfer components") + print("=" * 80) + + # Generate CLI-friendly output + generate_zabbix_cli_commands() + + # Generate importable template + print("\n" + "=" * 80) + print("ZABBIX IMPORT TEMPLATE") + print("=" * 80) + print("\nSave this template to a file and import it into Zabbix:") + print("Configuration -> Templates -> Import\n") + + template_data = generate_zabbix_import_json() + + # Save as YAML (like the working example) + # Use default_flow_style=None to let PyYAML choose when to quote + yaml_output = yaml.dump(template_data, default_flow_style=False, sort_keys=False, allow_unicode=True, width=1000) + print(yaml_output) + + with open('zabbix_printer_template.yaml', 'w') as f: + f.write(yaml_output) + + # Also save JSON version + json_output = json.dumps(template_data, indent=2) + with open('zabbix_printer_template.json', 'w') as f: + f.write(json_output) + + print("\n" + "=" * 80) + print(f"โœ“ Zabbix template saved to: zabbix_printer_template.yaml (YAML)") + print(f"โœ“ Zabbix template saved to: zabbix_printer_template.json (JSON)") + print("=" * 80) + + print("\n## Quick Setup Instructions:") + print("1. Import zabbix_printer_template.json into Zabbix") + print("2. Create/Edit a host for each printer") + print("3. Set the SNMP interface with:") + print(" - IP address: [printer IP]") + print(" - Port: 161") + print(f" - SNMP community: WestJeff2025") + print(" - SNMP version: SNMPv2") + print("4. Link the 'SNMP Printer Template (HP & Xerox) - Complete' to each host") + print("5. Wait 1 hour for data collection to begin (or trigger manual check)") + + print("\n## What Gets Monitored:") + print("โœ“ Toner levels (Black, Cyan, Magenta, Yellow)") + print("โœ“ Cartridge part numbers for ordering") + print("โœ“ Maintenance kit status (HP printers)") + print("โœ“ Fuser assembly part number") + print("โœ“ Drum cartridge part numbers (all colors)") + print("โœ“ Waste cartridge part number") + print("โœ“ Transfer belt/roller part numbers") + print("โœ“ Supply capacity data for percentage calculations") + + print("\n## Triggers Configured:") + print("- Warning: Toner < 20%") + print("- Critical: Toner < 10%") + print("- Warning: Maintenance kit < 10,000 pages") + print("- Critical: Maintenance kit < 5,000 pages") + + print("\n## Notes:") + print("- Not all OIDs exist on all printers (e.g., drums on HP, maintenance on Xerox)") + print("- Color toner OIDs only exist on color printers") + print("- HP-specific MIB items only work on HP printers") + print("- Check interval is 1 hour (supplies don't change rapidly)") + print() + + +if __name__ == "__main__": + main() diff --git a/printer_template_mapping.py b/printer_template_mapping.py new file mode 100644 index 0000000..51fd215 --- /dev/null +++ b/printer_template_mapping.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python3 +""" +Map each printer IP to the correct Zabbix template +""" + +import os + +MODEL_OID = "1.3.6.1.2.1.25.3.2.1.3.1" + +def parse_csv(filepath): + """Parse printer SNMP CSV file""" + data = {} + try: + with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: + for line in f: + parts = line.strip().split(',', 2) + if len(parts) >= 2: + oid = parts[0] + value = parts[1].strip('"') + data[oid] = value + except Exception as e: + print(f"Error reading {filepath}: {e}") + return data + +def extract_ip(filename): + """Extract IP from filename like printer-10-80-92-20.printer.geaerospace.net.csv""" + # Remove .csv and domain + name = filename.replace('.printer.geaerospace.net.csv', '') + # Remove printer- prefix + name = name.replace('printer-', '') + # Convert dashes to dots + return name.replace('-', '.') + +def determine_template(model): + """Determine which template to use based on model""" + model_lower = model.lower() + + # Xerox Enterprise (EC8036, AltaLink) + if 'xerox ec' in model_lower or 'xerox altalink' in model_lower: + return "xerox_enterprise", "Xerox Enterprise - Color" + + # Xerox VersaLink Color + if 'xerox versalink c' in model_lower: + return "xerox_color", "Xerox VersaLink - Color" + + # Xerox VersaLink Mono + if 'xerox versalink b' in model_lower: + return "xerox_mono", "Xerox VersaLink - Monochrome" + + # HP Color + if 'hp color laserjet' in model_lower or 'color laserjet' in model_lower: + return "hp_color", "HP LaserJet - Color" + + # HP Mono (includes DesignJet for now - they use different indices but similar structure) + if 'hp laserjet' in model_lower or 'hp designjet' in model_lower or 'laserjet' in model_lower: + return "hp_mono", "HP LaserJet - Monochrome" + + return "unknown", "UNKNOWN - Manual Assignment Required" + +def main(): + output_dir = '/home/camp/output' + + # Collect all printers + printers = [] + + for filename in sorted(os.listdir(output_dir)): + if not filename.endswith('.csv'): + continue + + filepath = os.path.join(output_dir, filename) + data = parse_csv(filepath) + model = data.get(MODEL_OID, "Unknown") + ip = extract_ip(filename) + + template_key, template_name = determine_template(model) + + printers.append({ + 'ip': ip, + 'filename': filename, + 'model': model, + 'template_key': template_key, + 'template_name': template_name + }) + + # Group by template + by_template = {} + for p in printers: + key = p['template_key'] + if key not in by_template: + by_template[key] = [] + by_template[key].append(p) + + # Print summary + print("=" * 120) + print("PRINTER TO TEMPLATE MAPPING") + print("=" * 120) + print() + + # Print by template type + for template_key in ['hp_mono', 'hp_color', 'xerox_color', 'xerox_mono', 'unknown']: + if template_key not in by_template: + continue + + printers_list = by_template[template_key] + template_name = printers_list[0]['template_name'] + + print(f"\n{'='*120}") + print(f"TEMPLATE: {template_name}") + print(f"File: zabbix_template_{template_key}.yaml / .json") + print(f"Count: {len(printers_list)} printers") + print(f"{'='*120}") + print(f"{'IP Address':<18} {'Hostname':<45} {'Model':<50}") + print("-" * 120) + + for p in sorted(printers_list, key=lambda x: x['ip']): + hostname = p['filename'].replace('.csv', '').replace('printer-', '') + print(f"{p['ip']:<18} {hostname:<45} {p['model'][:48]:<50}") + + # Create importable CSV for Zabbix bulk operations + print("\n" + "=" * 120) + print("ZABBIX BULK IMPORT FORMAT") + print("=" * 120) + print("\nCopy this to use with Zabbix CSV import or manual configuration:\n") + print(f"{'IP Address':<18} {'Template':<35} {'SNMP Community':<20} {'Model'}") + print("-" * 120) + + for p in sorted(printers, key=lambda x: x['ip']): + print(f"{p['ip']:<18} {p['template_name']:<35} WestJeff2025{' '*8} {p['model'][:40]}") + + # Create a quick reference table + print("\n" + "=" * 120) + print("QUICK REFERENCE - IP TO TEMPLATE") + print("=" * 120) + print() + + for template_key in ['hp_mono', 'hp_color', 'xerox_color', 'xerox_mono']: + if template_key not in by_template: + continue + + template_file = f"zabbix_template_{template_key}.yaml" + ips = [p['ip'] for p in sorted(by_template[template_key], key=lambda x: x['ip'])] + + print(f"\n{template_file}:") + print(" IPs: " + ", ".join(ips)) + +if __name__ == "__main__": + main() diff --git a/regenerate_designjet_template.py b/regenerate_designjet_template.py new file mode 100644 index 0000000..f0ce5e0 --- /dev/null +++ b/regenerate_designjet_template.py @@ -0,0 +1,282 @@ +#!/usr/bin/env python3 +""" +Regenerate HP DesignJet T1700 Zabbix template with proper UUIDs +Fixes "UUIDv4 is expected" import error +""" + +import uuid +import yaml + +def generate_uuid(): + """Generate UUID without hyphens (Zabbix format)""" + return uuid.uuid4().hex + +# HP DesignJet T1700 Template with proper UUID generation +template = { + 'zabbix_export': { + 'version': '7.4', + 'template_groups': [ + { + 'uuid': '3cd4e8d0b828464e8f4b3becf13a9dbd', # Standard Printers group UUID + 'name': 'Printers' + } + ], + 'templates': [ + { + 'uuid': generate_uuid(), + 'template': 'HP DesignJet T1700', + 'name': 'HP DesignJet T1700', + 'description': '''HP DesignJet T1700/T1700dr PostScript Large Format Printer (44" wide) with 6-color ink system. +Uses HP-specific OIDs for ink levels (1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.X.1.0) + +Correct HP 730 300ml cartridge mapping (verified from actual installation): +- P2V68A = Cyan +- P2V69A = Magenta +- P2V70A = Yellow +- P2V71A = Matte Black +- P2V72A = Gray +- P2V73A = Photo Black''', + 'groups': [ + {'name': 'Printers'} + ], + 'items': [] + } + ] + } +} + +# Ink cartridge definitions with correct SNMP index mapping +INK_CARTRIDGES = [ + { + 'color': 'Matte Black', + 'key': 'matte_black', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.3', # Index 3 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.3.1.0', + 'part_number': 'P2V71A', + 'description': 'Matte Black Ink' + }, + { + 'color': 'Photo Black', + 'key': 'photo_black', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.2', # Index 2 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.2.1.0', + 'part_number': 'P2V73A', + 'description': 'Photo Black Ink' + }, + { + 'color': 'Cyan', + 'key': 'cyan', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.6', # Index 6 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.6.1.0', + 'part_number': 'P2V68A', + 'description': 'Cyan Ink' + }, + { + 'color': 'Magenta', + 'key': 'magenta', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.5', # Index 5 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.5.1.0', + 'part_number': 'P2V69A', + 'description': 'Magenta Ink' + }, + { + 'color': 'Yellow', + 'key': 'yellow', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.4', # Index 4 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.4.1.0', + 'part_number': 'P2V70A', + 'description': 'Yellow Ink' + }, + { + 'color': 'Gray', + 'key': 'gray', + 'part_oid': '1.3.6.1.2.1.43.11.1.1.6.1.1', # Index 1 + 'level_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.1.1.0', + 'part_number': 'P2V72A', + 'description': 'Gray Ink' + } +] + +# Standard preprocessing for text fields (handles hex-encoded and binary SNMP data) +TEXT_PREPROCESSING = [ + { + 'type': 'JAVASCRIPT', + 'parameters': [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } +] + +# Printer info items +items = template['zabbix_export']['templates'][0]['items'] + +# Add basic printer info items +items.extend([ + { + 'uuid': generate_uuid(), + 'name': 'Printer Model', + 'type': 'SNMP_AGENT', + 'snmp_oid': '1.3.6.1.2.1.25.3.2.1.3.1', + 'key': 'printer.model', + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': 'Printer Model', + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'printer'}, + {'tag': 'type', 'value': 'info'} + ] + }, + { + 'uuid': generate_uuid(), + 'name': 'Printer Hostname', + 'type': 'SNMP_AGENT', + 'snmp_oid': '1.3.6.1.2.1.1.5.0', + 'key': 'printer.hostname', + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': 'Printer Hostname', + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'printer'}, + {'tag': 'type', 'value': 'info'} + ] + }, + { + 'uuid': generate_uuid(), + 'name': 'Printer Serial Number', + 'type': 'SNMP_AGENT', + 'snmp_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0', + 'key': 'printer.serial', + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': 'Printer Serial Number (HP-specific OID)', + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'printer'}, + {'tag': 'type', 'value': 'info'} + ] + }, + { + 'uuid': generate_uuid(), + 'name': 'System Location', + 'type': 'SNMP_AGENT', + 'snmp_oid': '1.3.6.1.2.1.1.6.0', + 'key': 'printer.location', + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': 'System Location', + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'printer'}, + {'tag': 'type', 'value': 'info'} + ] + }, + { + 'uuid': generate_uuid(), + 'name': 'Firmware Version', + 'type': 'SNMP_AGENT', + 'snmp_oid': '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.6.0', + 'key': 'printer.firmware', + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': 'Printer Firmware Version', + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'printer'}, + {'tag': 'type', 'value': 'info'} + ] + } +]) + +# Add ink cartridge items +for ink in INK_CARTRIDGES: + # Part number item + items.append({ + 'uuid': generate_uuid(), + 'name': f"{ink['color']} Cartridge Part Number", + 'type': 'SNMP_AGENT', + 'snmp_oid': ink['part_oid'], + 'key': f"printer.cartridge.{ink['key']}", + 'delay': '1h', + 'history': '90d', + 'trends': '0d', + 'value_type': 'TEXT', + 'description': f"{ink['description']} Cartridge Part Number (HP 730 {ink['part_number']})", + 'preprocessing': TEXT_PREPROCESSING, + 'tags': [ + {'tag': 'component', 'value': 'supplies'}, + {'tag': 'type', 'value': 'info'} + ] + }) + + # Ink level item with triggers + items.append({ + 'uuid': generate_uuid(), + 'name': f"{ink['color']} Ink Level", + 'type': 'SNMP_AGENT', + 'snmp_oid': ink['level_oid'], + 'key': f"printer.ink.{ink['key']}", + 'delay': '1h', + 'history': '90d', + 'trends': '365d', + 'value_type': 'FLOAT', + 'units': '%', + 'description': f"{ink['description']} Level Percentage (HP proprietary OID)", + 'tags': [ + {'tag': 'component', 'value': 'supplies'}, + {'tag': 'type', 'value': 'level'}, + {'tag': 'color', 'value': ink['key']} + ], + 'triggers': [ + { + 'uuid': generate_uuid(), + 'expression': f"last(/HP DesignJet T1700/printer.ink.{ink['key']})<20 and length(last(/HP DesignJet T1700/printer.cartridge.{ink['key']}))>0", + 'name': f"{ink['color']} Ink Level is low on {{{{HOST.NAME}}}}. Current level: {{{{ITEM.LASTVALUE}}}}%. Replacement part: {{{{ITEM.LASTVALUE2}}}}", + 'priority': 'WARNING', + 'tags': [ + {'tag': 'scope', 'value': 'availability'} + ] + }, + { + 'uuid': generate_uuid(), + 'expression': f"last(/HP DesignJet T1700/printer.ink.{ink['key']})<10 and length(last(/HP DesignJet T1700/printer.cartridge.{ink['key']}))>0", + 'name': f"{ink['color']} Ink Level is critically low on {{{{HOST.NAME}}}}. Current level: {{{{ITEM.LASTVALUE}}}}%. Replacement part: {{{{ITEM.LASTVALUE2}}}}", + 'priority': 'HIGH', + 'tags': [ + {'tag': 'scope', 'value': 'availability'} + ] + } + ] + }) + +# Generate YAML output +yaml_output = yaml.dump(template, default_flow_style=False, sort_keys=False, allow_unicode=True, width=1000) + +# Save to file +with open('zabbix_template_hp_designjet_t1700.yaml', 'w') as f: + f.write(yaml_output) + +print("=" * 80) +print("HP DesignJet T1700 Zabbix Template Generated") +print("=" * 80) +print(f"\nโœ“ Template saved to: zabbix_template_hp_designjet_t1700.yaml") +print(f"โœ“ All UUIDs generated properly (32-char hex format)") +print(f"โœ“ Template includes {len(INK_CARTRIDGES)} ink cartridges with correct OID mapping") +print(f"โœ“ Ready for import into Zabbix 7.4") +print("\nImport Instructions:") +print("1. Go to Zabbix: Data collection โ†’ Templates") +print("2. Click 'Import'") +print("3. Select zabbix_template_hp_designjet_t1700.yaml") +print("4. Click 'Import'") +print("\n" + "=" * 80) diff --git a/snmp_scanner.py b/snmp_scanner.py new file mode 100644 index 0000000..ced2aa5 --- /dev/null +++ b/snmp_scanner.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python3 +""" +SNMP Scanner for HP and Xerox Printers +Walks useful OID ranges and exports to individual CSV files +Compatible with pysnmp v7.1 (pysnmp-lextudio) +""" + +import asyncio +from pysnmp.hlapi.v3arch.asyncio import * +import csv +import os +from datetime import datetime + +# Configuration +PRINTERS = [ + "10.80.92.70", + "10.80.92.23", + "10.80.92.45", + "10.80.92.52", + "10.80.92.48", + "10.80.92.69", + "10.80.92.252", + "10.80.92.54", + "10.80.92.46", + "10.80.92.57", + "10.80.92.26", + "10.80.92.53", + "10.80.92.24", + "10.80.92.62", + "10.80.92.28", + "10.80.92.51", + "10.80.92.56", + "10.80.92.25", + "10.80.92.49", + "10.80.92.20", + "10.80.92.63", + "10.80.92.67", + "10.80.92.55", + "10.80.92.65", + "10.80.92.71", + "10.80.92.251", + "10.80.92.61", + "10.80.92.253", + "10.80.92.222" +] + +COMMUNITY = "WestJeff2025" +OUTPUT_DIR = "output" + +# Optimized OID ranges - only what we need for reports and Zabbix +# This significantly speeds up scanning by avoiding unnecessary data +OID_RANGES = [ + "1.3.6.1.2.1.1", # System info (sysDescr, sysName, sysLocation) + "1.3.6.1.2.1.25.3.2.1.3", # Device model + "1.3.6.1.2.1.43.5.1.1.17", # Printer serial number + "1.3.6.1.2.1.43.10.2.1.4", # Supply max capacity + "1.3.6.1.2.1.43.10.2.1.9", # Supply current level + "1.3.6.1.2.1.43.11.1.1.6", # Supply descriptions (part numbers) + "1.3.6.1.2.1.43.11.1.1.8", # Supply max capacity (toner/ink cartridges) + "1.3.6.1.2.1.43.11.1.1.9", # Supply level (percentage or pages) + "1.3.6.1.2.1.2.2.1.6", # MAC address + "1.3.6.1.4.1.11.2.3.9.4.2.1", # HP maintenance kit info + "1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4", # HP DesignJet ink level percentages +] + +# Specific single OIDs - these are retrieved first for speed +SPECIFIC_OIDS = [ + "1.3.6.1.2.1.1.1.0", # sysDescr (basic model info) + "1.3.6.1.2.1.1.5.0", # sysName (hostname) + "1.3.6.1.2.1.1.6.0", # sysLocation + "1.3.6.1.2.1.25.3.2.1.3.1", # Device model (primary) +] + + +async def snmp_get(printer_ip, community, oid): + """ + Perform SNMP GET on a specific OID + Returns tuple: (oid, value) or None on error + """ + try: + snmpEngine = SnmpEngine() + + errorIndication, errorStatus, errorIndex, varBinds = await get_cmd( + snmpEngine, + CommunityData(community, mpModel=0), + await UdpTransportTarget.create((printer_ip, 161), timeout=2.0, retries=2), + ContextData(), + ObjectType(ObjectIdentity(oid)) + ) + + snmpEngine.close_dispatcher() + + if errorIndication: + return None + elif errorStatus: + return None + else: + for varBind in varBinds: + return (str(varBind[0]), str(varBind[1])) + except Exception as e: + return None + + +async def snmp_walk(printer_ip, community, oid): + """ + Perform SNMP walk on a specific OID for a printer + Returns list of tuples: (oid, value) + """ + results = [] + + try: + snmpEngine = SnmpEngine() + + async for (errorIndication, errorStatus, errorIndex, varBinds) in walk_cmd( + snmpEngine, + CommunityData(community, mpModel=0), + await UdpTransportTarget.create((printer_ip, 161), timeout=2.0, retries=2), + ContextData(), + ObjectType(ObjectIdentity(oid)), + lexicographicMode=False + ): + if errorIndication: + print(f" Error on {printer_ip}: {errorIndication}") + break + elif errorStatus: + print(f" Error on {printer_ip}: {errorStatus.prettyPrint()} at {errorIndex}") + break + else: + for varBind in varBinds: + oid_str = str(varBind[0]) + value = str(varBind[1]) + results.append((oid_str, value)) + + snmpEngine.close_dispatcher() + + except Exception as e: + print(f" Exception on {printer_ip}: {e}") + + return results + + +async def scan_printer(printer_ip): + """ + Scan a single printer and save results to CSV + """ + printer_name = f"printer-{printer_ip.replace('.', '-')}.printer.geaerospace.net" + csv_filename = os.path.join(OUTPUT_DIR, f"{printer_name}.csv") + + print(f"Scanning {printer_ip}...") + + all_results = [] + + # Get specific OIDs concurrently (much faster) + get_tasks = [snmp_get(printer_ip, COMMUNITY, oid) for oid in SPECIFIC_OIDS] + get_results = await asyncio.gather(*get_tasks, return_exceptions=True) + + for result in get_results: + if result and not isinstance(result, Exception): + all_results.append(result) + + # Walk each OID range (walks must be sequential per OID) + for oid in OID_RANGES: + print(f" Walking OID {oid}...") + results = await snmp_walk(printer_ip, COMMUNITY, oid) + all_results.extend(results) + + # Save to CSV + if all_results: + with open(csv_filename, 'w', newline='', encoding='utf-8') as csvfile: + writer = csv.writer(csvfile) + writer.writerow(['OID', 'Value', 'Scanned_At']) + + timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + for oid, value in all_results: + writer.writerow([oid, value, timestamp]) + + print(f" โœ“ Saved {len(all_results)} OIDs to {csv_filename}") + else: + print(f" โœ— No data retrieved from {printer_ip}") + + return printer_ip, len(all_results) + + +async def scan_printers_batch(printers, batch_size=10): + """ + Scan printers in batches to avoid overwhelming the network + Increased to 10 concurrent scans for faster performance + """ + results = [] + + for i in range(0, len(printers), batch_size): + batch = printers[i:i + batch_size] + print(f"\nBatch {i//batch_size + 1}: Scanning {len(batch)} printers concurrently...") + batch_results = await asyncio.gather(*[scan_printer(ip) for ip in batch], return_exceptions=True) + + for result in batch_results: + if isinstance(result, Exception): + print(f" Error in batch: {result}") + else: + results.append(result) + + return results + + +async def main(): + """ + Main function to scan all printers + """ + print("=" * 60) + print("SNMP Printer Scanner - Optimized for Reports & Zabbix") + print("=" * 60) + print(f"Total printers to scan: {len(PRINTERS)}") + print(f"Community string: {COMMUNITY}") + print(f"Output directory: {OUTPUT_DIR}") + print(f"Scanning {len(OID_RANGES)} optimized OID ranges (supplies, model, serial)") + print("=" * 60) + print() + + # Create output directory if it doesn't exist + os.makedirs(OUTPUT_DIR, exist_ok=True) + + start_time = datetime.now() + + # Scan printers in batches (10 concurrent scans for speed) + results = await scan_printers_batch(PRINTERS, batch_size=10) + + end_time = datetime.now() + duration = (end_time - start_time).total_seconds() + + # Summary + print() + print("=" * 60) + print("Scan Complete") + print("=" * 60) + successful = sum(1 for _, count in results if count > 0) + print(f"Successful scans: {successful}/{len(PRINTERS)}") + print(f"Total time: {duration:.2f} seconds") + print(f"Results saved to: {OUTPUT_DIR}/") + print("=" * 60) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/zabbix_printer_template.json b/zabbix_printer_template.json new file mode 100644 index 0000000..c5e5f8a --- /dev/null +++ b/zabbix_printer_template.json @@ -0,0 +1,1425 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "8559e8ebcbb849eca59287790b707168", + "template": "Printer SNMP Monitor", + "name": "Printer SNMP Monitor", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "f14061bd0a6f4b4aae84fa631c06ad06", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Device model information", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "printer_info" + } + ], + "inventory_link": "MODEL", + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "8cdc1529f9b94279bbb82376f5384197", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "printer_info" + } + ], + "inventory_link": "NAME", + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "a1a7295be9a5424192c33d37160792de", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer serial number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "printer_info" + } + ], + "inventory_link": "SERIALNO_A", + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "77ef807ba8214781a162252ca8d47b49", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Physical location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "printer_info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "5ec3baa71dd94dd588dfdbdabd5bdb74", + "name": "MAC Address", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.2.2.1.6.2]", + "key": "printer.macaddress", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Primary network interface MAC address", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "printer_info" + } + ], + "inventory_link": "MACADDRESS_A", + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "1ca63a9ace904cb9953d8073939d80b1", + "name": "Black Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black toner current level (raw value)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "8425ee5c66984653bb93325a0fa00e6e", + "name": "Black Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black toner maximum capacity", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "a30f2233f3e8460b9888716fa0545fd0", + "name": "Black Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Black toner percentage", + "tags": [ + { + "tag": "component", + "value": "toner" + }, + { + "tag": "category", + "value": "toner_levels" + }, + { + "tag": "color", + "value": "black" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "67c0cc9e72734c79a09ad5bdeaf341ff", + "expression": "last(/Printer SNMP Monitor/printer.toner.black)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Black Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "6a585ec7829b4c2d8d8a22b6510383b6", + "expression": "last(/Printer SNMP Monitor/printer.toner.black)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Black Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "210e86285b074d828a8dfb02ff5839f8", + "name": "Cyan Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.2]", + "key": "printer.toner.cyan.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan toner current level (raw value)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "55e83440391e49d6bba87f3a9b5895e7", + "name": "Cyan Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.2]", + "key": "printer.toner.cyan.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan toner maximum capacity", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "ae0c1782f0b74d6f88be391a446d661e", + "name": "Cyan Toner Level", + "type": "CALCULATED", + "key": "printer.toner.cyan", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "description": "Cyan toner percentage", + "tags": [ + { + "tag": "component", + "value": "toner" + }, + { + "tag": "category", + "value": "toner_levels" + }, + { + "tag": "color", + "value": "cyan" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "221671dfccdb44579cd7dc9f0abad794", + "expression": "last(/Printer SNMP Monitor/printer.toner.cyan)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.cyan))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Cyan Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "63b13139e7374ac689072ec7d8e2ba27", + "expression": "last(/Printer SNMP Monitor/printer.toner.cyan)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.cyan))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Cyan Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "b74db9fdbf3642d7b27433d553636293", + "name": "Magenta Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.3]", + "key": "printer.toner.magenta.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta toner current level (raw value)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "bbd164aed85d4f7db496dded965080ee", + "name": "Magenta Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.3]", + "key": "printer.toner.magenta.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta toner maximum capacity", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "3a93c394f95b4c959cc3c20b2f18e014", + "name": "Magenta Toner Level", + "type": "CALCULATED", + "key": "printer.toner.magenta", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "description": "Magenta toner percentage", + "tags": [ + { + "tag": "component", + "value": "toner" + }, + { + "tag": "category", + "value": "toner_levels" + }, + { + "tag": "color", + "value": "magenta" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "c0bc98d818d440ccbdc0e2d9c3f68cdf", + "expression": "last(/Printer SNMP Monitor/printer.toner.magenta)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.magenta))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Magenta Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "a880d1f24ce24c56ab420bd2d3d46961", + "expression": "last(/Printer SNMP Monitor/printer.toner.magenta)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.magenta))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Magenta Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "e6131ba3c3a84901a62e46fb3e1a558d", + "name": "Yellow Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.4]", + "key": "printer.toner.yellow.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow toner current level (raw value)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "9efc8706ede34244a3f6146aa329fcc3", + "name": "Yellow Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.4]", + "key": "printer.toner.yellow.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow toner maximum capacity", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "toner_levels" + } + ], + "units": "" + }, + { + "uuid": "4b6760dc4b9d4b2eb10e88a130d93a31", + "name": "Yellow Toner Level", + "type": "CALCULATED", + "key": "printer.toner.yellow", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "description": "Yellow toner percentage", + "tags": [ + { + "tag": "component", + "value": "toner" + }, + { + "tag": "category", + "value": "toner_levels" + }, + { + "tag": "color", + "value": "yellow" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "65ed6a1b74db412d927656c90a265136", + "expression": "last(/Printer SNMP Monitor/printer.toner.yellow)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.yellow))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Yellow Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "af4da363f9a04f8a8fdd41927e7c71fd", + "expression": "last(/Printer SNMP Monitor/printer.toner.yellow)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.yellow))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Yellow Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "197a06c64c204e4d977cef902d0503b2", + "name": "Black Cartridge Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.cartridge.black", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black toner cartridge model/part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "cartridge_info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "6f07f404171946b697f1bfa3850036ff", + "name": "Cyan Cartridge Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.2]", + "key": "printer.cartridge.cyan", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Cyan toner cartridge model/part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "cartridge_info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "52e13188182649c2a788326288e0cd6d", + "name": "Magenta Cartridge Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.3]", + "key": "printer.cartridge.magenta", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Magenta toner cartridge model/part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "cartridge_info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "fd58812f0fde467c8444b0b6c2dcb337", + "name": "Yellow Cartridge Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.4]", + "key": "printer.cartridge.yellow", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Yellow toner cartridge model/part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "cartridge_info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "eaa234629c2443cfaa2c6679239ddb53", + "name": "Drum Cartridge R1 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.5]", + "key": "printer.drum.r1", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum cartridge R1 part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "94b6b40dfffa4a8eb4386cb345e33d64", + "name": "Drum Cartridge R1 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.5]", + "key": "printer.drum.r1.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum cartridge R1 remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "ae07bd0a7f214d92ad84c1b5b0f333d7", + "expression": "last(/Printer SNMP Monitor/printer.drum.r1.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r1))>0", + "name": "Drum Cartridge R1 Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Drum Cartridge R1 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "87029b70ab414d3aa9370e01468e0bc9", + "expression": "last(/Printer SNMP Monitor/printer.drum.r1.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r1))>0", + "name": "Drum Cartridge R1 Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Drum Cartridge R1 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "a05ab2cbf4384a6a93e12d006bc8f8ed", + "name": "Drum Cartridge R2 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.6]", + "key": "printer.drum.r2", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum cartridge R2 part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "55250c2fc46d4086a7d3c110db50dc46", + "name": "Drum Cartridge R2 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.6]", + "key": "printer.drum.r2.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum cartridge R2 remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "da956bb03a7145558ceed46f22f59180", + "expression": "last(/Printer SNMP Monitor/printer.drum.r2.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r2))>0", + "name": "Drum Cartridge R2 Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Drum Cartridge R2 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "606e8d5f08f7460eae72015cab07d789", + "expression": "last(/Printer SNMP Monitor/printer.drum.r2.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r2))>0", + "name": "Drum Cartridge R2 Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Drum Cartridge R2 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "b582a5b3352a4406aa1a28fefa6b929c", + "name": "Drum Cartridge R3 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.7]", + "key": "printer.drum.r3", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum cartridge R3 part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "a8646395156b4fbb90438347522ee6fa", + "name": "Drum Cartridge R3 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.7]", + "key": "printer.drum.r3.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum cartridge R3 remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "ab6425f3dc484e6fbc029be8de0ea6eb", + "expression": "last(/Printer SNMP Monitor/printer.drum.r3.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r3))>0", + "name": "Drum Cartridge R3 Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Drum Cartridge R3 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "2b04057e9e4e43c5bcbfdd8cdd69de58", + "expression": "last(/Printer SNMP Monitor/printer.drum.r3.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r3))>0", + "name": "Drum Cartridge R3 Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Drum Cartridge R3 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "31a2f55026c94912a41049bfb22834b4", + "name": "Drum Cartridge R4 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.8]", + "key": "printer.drum.r4", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum cartridge R4 part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d90ac9cf6dd041eca83fa23b339de473", + "name": "Drum Cartridge R4 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.8]", + "key": "printer.drum.r4.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum cartridge R4 remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "07c79834c5b848c298ed090f8d1e7b8b", + "expression": "last(/Printer SNMP Monitor/printer.drum.r4.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r4))>0", + "name": "Drum Cartridge R4 Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Drum Cartridge R4 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "7241561532a24d7fa9598ed3ea74e44e", + "expression": "last(/Printer SNMP Monitor/printer.drum.r4.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r4))>0", + "name": "Drum Cartridge R4 Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Drum Cartridge R4 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "cdfce3b4df8c49859d454a8883c1cec4", + "name": "Waste Toner Container Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.9]", + "key": "printer.waste.partnumber", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Waste toner container part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "38a4a4150ba949b2ae62d1d20e411c4e", + "name": "Waste Toner Container Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.9]", + "key": "printer.waste.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Waste toner container fill level (higher is more full)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "fbf34636cdf242f2850b73d77a339220", + "expression": "last(/Printer SNMP Monitor/printer.waste.level)>80 and length(last(/Printer SNMP Monitor/printer.waste.partnumber))>0", + "name": "Waste Toner Container Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Waste Toner Container Level has dropped below 80%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "f8f3473f933749e88eb9b6b08bf0bd4a", + "expression": "last(/Printer SNMP Monitor/printer.waste.level)>90 and length(last(/Printer SNMP Monitor/printer.waste.partnumber))>0", + "name": "Waste Toner Container Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Waste Toner Container Level has dropped below 90%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "1210838ab6df401ab235653b975421f2", + "name": "Transfer Belt Cleaner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.10]", + "key": "printer.transfer.belt", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Transfer belt cleaner part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d5e1f76785cd4198a3170a5c55856627", + "name": "Transfer Belt Cleaner Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.10]", + "key": "printer.transfer.belt.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Transfer belt cleaner remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "87789c39b16d41e5843846e6f33a41d5", + "expression": "last(/Printer SNMP Monitor/printer.transfer.belt.level)<20 and length(last(/Printer SNMP Monitor/printer.transfer.belt))>0", + "name": "Transfer Belt Cleaner Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Transfer Belt Cleaner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "8bfab1ce66734b8e99729fb9dd8a0821", + "expression": "last(/Printer SNMP Monitor/printer.transfer.belt.level)<10 and length(last(/Printer SNMP Monitor/printer.transfer.belt))>0", + "name": "Transfer Belt Cleaner Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Transfer Belt Cleaner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "06718c135cf8495ab4f64a248bed0597", + "name": "Second Bias Transfer Roll Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.11]", + "key": "printer.transfer.roller", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Second bias transfer roll part number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "fc3a32dba72945d89809c0c202fab5d2", + "name": "Second Bias Transfer Roll Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.11]", + "key": "printer.transfer.roller.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Second bias transfer roll remaining life percentage", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "other_supplies" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "371a3230e24c4f41841a0f2f58a81e34", + "expression": "last(/Printer SNMP Monitor/printer.transfer.roller.level)<20 and length(last(/Printer SNMP Monitor/printer.transfer.roller))>0", + "name": "Second Bias Transfer Roll Level is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Second Bias Transfer Roll Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "6210babed1284bfc890a00d05328dedf", + "expression": "last(/Printer SNMP Monitor/printer.transfer.roller.level)<10 and length(last(/Printer SNMP Monitor/printer.transfer.roller))>0", + "name": "Second Bias Transfer Roll Level is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Second Bias Transfer Roll Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "94f4bb2c7f8c494ead740f091846f978", + "name": "Maintenance Kit Model (HP)", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0]", + "key": "printer.maintenance.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "HP maintenance kit model/serial number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "maintenance_kit_hp" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "dfa98041e7b24981bc41bb3d05dacd77", + "name": "Maintenance Kit Remaining (HP)", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0]", + "key": "printer.maintenance.remaining", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "HP maintenance kit remaining pages", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "maintenance_kit_hp" + } + ], + "units": "pages", + "triggers": [ + { + "uuid": "30b01b873ae643e99c1b55efa7584313", + "expression": "last(/Printer SNMP Monitor/printer.maintenance.remaining)<10000 and length(last(/Printer SNMP Monitor/printer.maintenance.model))>0", + "name": "Maintenance Kit Remaining (HP) is low on {{HOST.NAME}}", + "priority": "WARNING", + "description": "Maintenance Kit Remaining (HP) has dropped below 10000pages. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "59b58b9fb96e448f8907a68ab21a68bd", + "expression": "last(/Printer SNMP Monitor/printer.maintenance.remaining)<5000 and length(last(/Printer SNMP Monitor/printer.maintenance.model))>0", + "name": "Maintenance Kit Remaining (HP) is low on {{HOST.NAME}}", + "priority": "HIGH", + "description": "Maintenance Kit Remaining (HP) has dropped below 5000pages. Replacement part: {ITEM.LASTVALUE2}", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "3352d313b0cf499f8a22e14d9f36e7ce", + "name": "Printer Model (HP MIB)", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0]", + "key": "printer.maintenance.printer_model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer model from HP maintenance MIB", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "maintenance_kit_hp" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "3126905128cc4eb78326021449df7d67", + "name": "Supply 1 Max Capacity", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.10.2.1.4.1.1]", + "key": "printer.supply.1.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Maximum capacity for supply index 1 (usually black)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "supply_capacity" + } + ] + }, + { + "uuid": "329ab388b8664648877bedf551dd370d", + "name": "Supply 1 Current Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.10.2.1.9.1.1]", + "key": "printer.supply.1.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Current level for supply index 1 (usually black)", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "category", + "value": "supply_capacity" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_printer_template.yaml b/zabbix_printer_template.yaml new file mode 100644 index 0000000..43e6c2b --- /dev/null +++ b/zabbix_printer_template.yaml @@ -0,0 +1,920 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: 8559e8ebcbb849eca59287790b707168 + template: Printer SNMP Monitor + name: Printer SNMP Monitor + groups: + - name: Printers + items: + - uuid: f14061bd0a6f4b4aae84fa631c06ad06 + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Device model information + tags: + - tag: component + value: printer + - tag: category + value: printer_info + inventory_link: MODEL + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 8cdc1529f9b94279bbb82376f5384197 + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System hostname + tags: + - tag: component + value: printer + - tag: category + value: printer_info + inventory_link: NAME + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: a1a7295be9a5424192c33d37160792de + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer serial number + tags: + - tag: component + value: printer + - tag: category + value: printer_info + inventory_link: SERIALNO_A + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 77ef807ba8214781a162252ca8d47b49 + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Physical location + tags: + - tag: component + value: printer + - tag: category + value: printer_info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 5ec3baa71dd94dd588dfdbdabd5bdb74 + name: MAC Address + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.2.2.1.6.2] + key: printer.macaddress + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Primary network interface MAC address + tags: + - tag: component + value: printer + - tag: category + value: printer_info + inventory_link: MACADDRESS_A + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 1ca63a9ace904cb9953d8073939d80b1 + name: Black Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black toner current level (raw value) + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: 8425ee5c66984653bb93325a0fa00e6e + name: Black Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black toner maximum capacity + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: a30f2233f3e8460b9888716fa0545fd0 + name: Black Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Black toner percentage + tags: + - tag: component + value: toner + - tag: category + value: toner_levels + - tag: color + value: black + units: '%' + triggers: + - uuid: 67c0cc9e72734c79a09ad5bdeaf341ff + expression: last(/Printer SNMP Monitor/printer.toner.black)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.black))>0 + name: Black Toner Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Black Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 6a585ec7829b4c2d8d8a22b6510383b6 + expression: last(/Printer SNMP Monitor/printer.toner.black)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.black))>0 + name: Black Toner Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Black Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 210e86285b074d828a8dfb02ff5839f8 + name: Cyan Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.2] + key: printer.toner.cyan.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan toner current level (raw value) + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: 55e83440391e49d6bba87f3a9b5895e7 + name: Cyan Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.2] + key: printer.toner.cyan.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan toner maximum capacity + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: ae0c1782f0b74d6f88be391a446d661e + name: Cyan Toner Level + type: CALCULATED + key: printer.toner.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0) + description: Cyan toner percentage + tags: + - tag: component + value: toner + - tag: category + value: toner_levels + - tag: color + value: cyan + units: '%' + triggers: + - uuid: 221671dfccdb44579cd7dc9f0abad794 + expression: last(/Printer SNMP Monitor/printer.toner.cyan)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.cyan))>0 + name: Cyan Toner Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Cyan Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 63b13139e7374ac689072ec7d8e2ba27 + expression: last(/Printer SNMP Monitor/printer.toner.cyan)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.cyan))>0 + name: Cyan Toner Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Cyan Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: b74db9fdbf3642d7b27433d553636293 + name: Magenta Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.3] + key: printer.toner.magenta.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta toner current level (raw value) + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: bbd164aed85d4f7db496dded965080ee + name: Magenta Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.3] + key: printer.toner.magenta.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta toner maximum capacity + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: 3a93c394f95b4c959cc3c20b2f18e014 + name: Magenta Toner Level + type: CALCULATED + key: printer.toner.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0) + description: Magenta toner percentage + tags: + - tag: component + value: toner + - tag: category + value: toner_levels + - tag: color + value: magenta + units: '%' + triggers: + - uuid: c0bc98d818d440ccbdc0e2d9c3f68cdf + expression: last(/Printer SNMP Monitor/printer.toner.magenta)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.magenta))>0 + name: Magenta Toner Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Magenta Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: a880d1f24ce24c56ab420bd2d3d46961 + expression: last(/Printer SNMP Monitor/printer.toner.magenta)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.magenta))>0 + name: Magenta Toner Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Magenta Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: e6131ba3c3a84901a62e46fb3e1a558d + name: Yellow Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.4] + key: printer.toner.yellow.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow toner current level (raw value) + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: 9efc8706ede34244a3f6146aa329fcc3 + name: Yellow Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.4] + key: printer.toner.yellow.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow toner maximum capacity + tags: + - tag: component + value: printer + - tag: category + value: toner_levels + units: '' + - uuid: 4b6760dc4b9d4b2eb10e88a130d93a31 + name: Yellow Toner Level + type: CALCULATED + key: printer.toner.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0) + description: Yellow toner percentage + tags: + - tag: component + value: toner + - tag: category + value: toner_levels + - tag: color + value: yellow + units: '%' + triggers: + - uuid: 65ed6a1b74db412d927656c90a265136 + expression: last(/Printer SNMP Monitor/printer.toner.yellow)<20 and length(last(/Printer SNMP Monitor/printer.cartridge.yellow))>0 + name: Yellow Toner Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Yellow Toner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: af4da363f9a04f8a8fdd41927e7c71fd + expression: last(/Printer SNMP Monitor/printer.toner.yellow)<10 and length(last(/Printer SNMP Monitor/printer.cartridge.yellow))>0 + name: Yellow Toner Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Yellow Toner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 197a06c64c204e4d977cef902d0503b2 + name: Black Cartridge Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.cartridge.black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black toner cartridge model/part number + tags: + - tag: component + value: printer + - tag: category + value: cartridge_info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 6f07f404171946b697f1bfa3850036ff + name: Cyan Cartridge Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.2] + key: printer.cartridge.cyan + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan toner cartridge model/part number + tags: + - tag: component + value: printer + - tag: category + value: cartridge_info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 52e13188182649c2a788326288e0cd6d + name: Magenta Cartridge Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.3] + key: printer.cartridge.magenta + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta toner cartridge model/part number + tags: + - tag: component + value: printer + - tag: category + value: cartridge_info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: fd58812f0fde467c8444b0b6c2dcb337 + name: Yellow Cartridge Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.4] + key: printer.cartridge.yellow + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow toner cartridge model/part number + tags: + - tag: component + value: printer + - tag: category + value: cartridge_info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: eaa234629c2443cfaa2c6679239ddb53 + name: Drum Cartridge R1 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.5] + key: printer.drum.r1 + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum cartridge R1 part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 94b6b40dfffa4a8eb4386cb345e33d64 + name: Drum Cartridge R1 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.5] + key: printer.drum.r1.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum cartridge R1 remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: ae07bd0a7f214d92ad84c1b5b0f333d7 + expression: last(/Printer SNMP Monitor/printer.drum.r1.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r1))>0 + name: Drum Cartridge R1 Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Drum Cartridge R1 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 87029b70ab414d3aa9370e01468e0bc9 + expression: last(/Printer SNMP Monitor/printer.drum.r1.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r1))>0 + name: Drum Cartridge R1 Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Drum Cartridge R1 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: a05ab2cbf4384a6a93e12d006bc8f8ed + name: Drum Cartridge R2 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.6] + key: printer.drum.r2 + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum cartridge R2 part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 55250c2fc46d4086a7d3c110db50dc46 + name: Drum Cartridge R2 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.6] + key: printer.drum.r2.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum cartridge R2 remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: da956bb03a7145558ceed46f22f59180 + expression: last(/Printer SNMP Monitor/printer.drum.r2.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r2))>0 + name: Drum Cartridge R2 Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Drum Cartridge R2 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 606e8d5f08f7460eae72015cab07d789 + expression: last(/Printer SNMP Monitor/printer.drum.r2.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r2))>0 + name: Drum Cartridge R2 Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Drum Cartridge R2 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: b582a5b3352a4406aa1a28fefa6b929c + name: Drum Cartridge R3 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.7] + key: printer.drum.r3 + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum cartridge R3 part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: a8646395156b4fbb90438347522ee6fa + name: Drum Cartridge R3 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.7] + key: printer.drum.r3.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum cartridge R3 remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: ab6425f3dc484e6fbc029be8de0ea6eb + expression: last(/Printer SNMP Monitor/printer.drum.r3.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r3))>0 + name: Drum Cartridge R3 Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Drum Cartridge R3 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 2b04057e9e4e43c5bcbfdd8cdd69de58 + expression: last(/Printer SNMP Monitor/printer.drum.r3.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r3))>0 + name: Drum Cartridge R3 Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Drum Cartridge R3 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 31a2f55026c94912a41049bfb22834b4 + name: Drum Cartridge R4 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.8] + key: printer.drum.r4 + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum cartridge R4 part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d90ac9cf6dd041eca83fa23b339de473 + name: Drum Cartridge R4 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.8] + key: printer.drum.r4.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum cartridge R4 remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: 07c79834c5b848c298ed090f8d1e7b8b + expression: last(/Printer SNMP Monitor/printer.drum.r4.level)<20 and length(last(/Printer SNMP Monitor/printer.drum.r4))>0 + name: Drum Cartridge R4 Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Drum Cartridge R4 Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 7241561532a24d7fa9598ed3ea74e44e + expression: last(/Printer SNMP Monitor/printer.drum.r4.level)<10 and length(last(/Printer SNMP Monitor/printer.drum.r4))>0 + name: Drum Cartridge R4 Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Drum Cartridge R4 Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: cdfce3b4df8c49859d454a8883c1cec4 + name: Waste Toner Container Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.9] + key: printer.waste.partnumber + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Waste toner container part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 38a4a4150ba949b2ae62d1d20e411c4e + name: Waste Toner Container Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.9] + key: printer.waste.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Waste toner container fill level (higher is more full) + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: fbf34636cdf242f2850b73d77a339220 + expression: last(/Printer SNMP Monitor/printer.waste.level)>80 and length(last(/Printer SNMP Monitor/printer.waste.partnumber))>0 + name: Waste Toner Container Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Waste Toner Container Level has dropped below 80%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: f8f3473f933749e88eb9b6b08bf0bd4a + expression: last(/Printer SNMP Monitor/printer.waste.level)>90 and length(last(/Printer SNMP Monitor/printer.waste.partnumber))>0 + name: Waste Toner Container Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Waste Toner Container Level has dropped below 90%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 1210838ab6df401ab235653b975421f2 + name: Transfer Belt Cleaner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.10] + key: printer.transfer.belt + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Transfer belt cleaner part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d5e1f76785cd4198a3170a5c55856627 + name: Transfer Belt Cleaner Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.10] + key: printer.transfer.belt.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Transfer belt cleaner remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: 87789c39b16d41e5843846e6f33a41d5 + expression: last(/Printer SNMP Monitor/printer.transfer.belt.level)<20 and length(last(/Printer SNMP Monitor/printer.transfer.belt))>0 + name: Transfer Belt Cleaner Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Transfer Belt Cleaner Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 8bfab1ce66734b8e99729fb9dd8a0821 + expression: last(/Printer SNMP Monitor/printer.transfer.belt.level)<10 and length(last(/Printer SNMP Monitor/printer.transfer.belt))>0 + name: Transfer Belt Cleaner Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Transfer Belt Cleaner Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 06718c135cf8495ab4f64a248bed0597 + name: Second Bias Transfer Roll Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.11] + key: printer.transfer.roller + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Second bias transfer roll part number + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: fc3a32dba72945d89809c0c202fab5d2 + name: Second Bias Transfer Roll Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.11] + key: printer.transfer.roller.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Second bias transfer roll remaining life percentage + tags: + - tag: component + value: printer + - tag: category + value: other_supplies + units: '%' + triggers: + - uuid: 371a3230e24c4f41841a0f2f58a81e34 + expression: last(/Printer SNMP Monitor/printer.transfer.roller.level)<20 and length(last(/Printer SNMP Monitor/printer.transfer.roller))>0 + name: Second Bias Transfer Roll Level is low on {{HOST.NAME}} + priority: WARNING + description: 'Second Bias Transfer Roll Level has dropped below 20%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 6210babed1284bfc890a00d05328dedf + expression: last(/Printer SNMP Monitor/printer.transfer.roller.level)<10 and length(last(/Printer SNMP Monitor/printer.transfer.roller))>0 + name: Second Bias Transfer Roll Level is low on {{HOST.NAME}} + priority: HIGH + description: 'Second Bias Transfer Roll Level has dropped below 10%. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 94f4bb2c7f8c494ead740f091846f978 + name: Maintenance Kit Model (HP) + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0] + key: printer.maintenance.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: HP maintenance kit model/serial number + tags: + - tag: component + value: printer + - tag: category + value: maintenance_kit_hp + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: dfa98041e7b24981bc41bb3d05dacd77 + name: Maintenance Kit Remaining (HP) + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0] + key: printer.maintenance.remaining + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: HP maintenance kit remaining pages + tags: + - tag: component + value: printer + - tag: category + value: maintenance_kit_hp + units: pages + triggers: + - uuid: 30b01b873ae643e99c1b55efa7584313 + expression: last(/Printer SNMP Monitor/printer.maintenance.remaining)<10000 and length(last(/Printer SNMP Monitor/printer.maintenance.model))>0 + name: Maintenance Kit Remaining (HP) is low on {{HOST.NAME}} + priority: WARNING + description: 'Maintenance Kit Remaining (HP) has dropped below 10000pages. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 59b58b9fb96e448f8907a68ab21a68bd + expression: last(/Printer SNMP Monitor/printer.maintenance.remaining)<5000 and length(last(/Printer SNMP Monitor/printer.maintenance.model))>0 + name: Maintenance Kit Remaining (HP) is low on {{HOST.NAME}} + priority: HIGH + description: 'Maintenance Kit Remaining (HP) has dropped below 5000pages. Replacement part: {ITEM.LASTVALUE2}' + tags: + - tag: scope + value: availability + - uuid: 3352d313b0cf499f8a22e14d9f36e7ce + name: Printer Model (HP MIB) + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0] + key: printer.maintenance.printer_model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer model from HP maintenance MIB + tags: + - tag: component + value: printer + - tag: category + value: maintenance_kit_hp + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 3126905128cc4eb78326021449df7d67 + name: Supply 1 Max Capacity + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.10.2.1.4.1.1] + key: printer.supply.1.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Maximum capacity for supply index 1 (usually black) + tags: + - tag: component + value: printer + - tag: category + value: supply_capacity + - uuid: 329ab388b8664648877bedf551dd370d + name: Supply 1 Current Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.10.2.1.9.1.1] + key: printer.supply.1.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Current level for supply index 1 (usually black) + tags: + - tag: component + value: printer + - tag: category + value: supply_capacity diff --git a/zabbix_template_hp_color.json b/zabbix_template_hp_color.json new file mode 100644 index 0000000..89b6dfe --- /dev/null +++ b/zabbix_template_hp_color.json @@ -0,0 +1,718 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "5b4251076337468bb04052554407101c", + "template": "HP LaserJet - Color", + "name": "HP LaserJet - Color", + "description": "HP Color LaserJet printers (all models)", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "cd75da9e4de041e0bb9f3e57900f8b6d", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Model", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "374e92b48ce549f3a04d675bf9bb6e70", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "8aaaf6bdd8e84052bcb8bb596f5a1d43", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Serial Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "132dfbc5a4884d7ba499bc2fe91c0f84", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System Location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d31c61cec36f4ae68468e27e694e3218", + "name": "Black Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.cartridge.black", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "bb6a571308fd46bc85988ce6477efc55", + "name": "Black Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "45367819a65141f893c7b7bd507953a1", + "name": "Black Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "b569608c9cdf40f5819a84720033b034", + "name": "Black Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Black Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "black" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "3a0f279ecf0f4556a29f2a40c2208827", + "expression": "last(/HP LaserJet - Color/printer.toner.black)<20 and length(last(/HP LaserJet - Color/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "50969fda64a24d43bdbeca9fe95fc91b", + "expression": "last(/HP LaserJet - Color/printer.toner.black)<10 and length(last(/HP LaserJet - Color/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "a6fd78dc1d36425bac353be9c51d14f3", + "name": "Cyan Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.2]", + "key": "printer.cartridge.cyan", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Cyan Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "a4babdb9346a4dc7b571ce91338d942f", + "name": "Cyan Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.2]", + "key": "printer.toner.cyan.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "10c4d323bd0f4382915198aa164d4841", + "name": "Cyan Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.2]", + "key": "printer.toner.cyan.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "cc368936127a4d79b96770b2d7617525", + "name": "Cyan Toner Level", + "type": "CALCULATED", + "key": "printer.toner.cyan", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "description": "Cyan Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "cyan" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "c8a211b0cfb445d8b1425f7c9d8a50f8", + "expression": "last(/HP LaserJet - Color/printer.toner.cyan)<20 and length(last(/HP LaserJet - Color/printer.cartridge.cyan))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "7de45329db3143fe8ba99c7ec88d01fa", + "expression": "last(/HP LaserJet - Color/printer.toner.cyan)<10 and length(last(/HP LaserJet - Color/printer.cartridge.cyan))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "8308972f1147410faa4a860d3029a2f7", + "name": "Magenta Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.3]", + "key": "printer.cartridge.magenta", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Magenta Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "c676b81f7ae248388105333b1a0e232d", + "name": "Magenta Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.3]", + "key": "printer.toner.magenta.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "deb6ac4789814d948a0e51c25c6dd7e6", + "name": "Magenta Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.3]", + "key": "printer.toner.magenta.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "684ef735b4994be081507955dbb2c739", + "name": "Magenta Toner Level", + "type": "CALCULATED", + "key": "printer.toner.magenta", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "description": "Magenta Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "magenta" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "e2fe4c5aa88543329b92feb052851fad", + "expression": "last(/HP LaserJet - Color/printer.toner.magenta)<20 and length(last(/HP LaserJet - Color/printer.cartridge.magenta))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "452b391488114b42b2a8790d494f4797", + "expression": "last(/HP LaserJet - Color/printer.toner.magenta)<10 and length(last(/HP LaserJet - Color/printer.cartridge.magenta))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "01469d513b354c09ac4391ea1ed29a31", + "name": "Yellow Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.4]", + "key": "printer.cartridge.yellow", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Yellow Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "cee83b3849644ea08de1d9d2b8ab9925", + "name": "Yellow Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.4]", + "key": "printer.toner.yellow.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "e42d93341a2a44dc9cc8017c50984753", + "name": "Yellow Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.4]", + "key": "printer.toner.yellow.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "1930935043d34c279c57c14558bb8504", + "name": "Yellow Toner Level", + "type": "CALCULATED", + "key": "printer.toner.yellow", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "description": "Yellow Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "yellow" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "9388fa0b74d947c1962023be87118bd2", + "expression": "last(/HP LaserJet - Color/printer.toner.yellow)<20 and length(last(/HP LaserJet - Color/printer.cartridge.yellow))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "35ab015073364b8897b00b7e1beeb368", + "expression": "last(/HP LaserJet - Color/printer.toner.yellow)<10 and length(last(/HP LaserJet - Color/printer.cartridge.yellow))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_template_hp_color.yaml b/zabbix_template_hp_color.yaml new file mode 100644 index 0000000..3f77588 --- /dev/null +++ b/zabbix_template_hp_color.yaml @@ -0,0 +1,453 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: 5b4251076337468bb04052554407101c + template: HP LaserJet - Color + name: HP LaserJet - Color + description: HP Color LaserJet printers (all models) + groups: + - name: Printers + items: + - uuid: cd75da9e4de041e0bb9f3e57900f8b6d + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 374e92b48ce549f3a04d675bf9bb6e70 + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 8aaaf6bdd8e84052bcb8bb596f5a1d43 + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 132dfbc5a4884d7ba499bc2fe91c0f84 + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d31c61cec36f4ae68468e27e694e3218 + name: Black Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.cartridge.black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: bb6a571308fd46bc85988ce6477efc55 + name: Black Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 45367819a65141f893c7b7bd507953a1 + name: Black Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: b569608c9cdf40f5819a84720033b034 + name: Black Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Black Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: black + units: '%' + triggers: + - uuid: 3a0f279ecf0f4556a29f2a40c2208827 + expression: last(/HP LaserJet - Color/printer.toner.black)<20 and length(last(/HP LaserJet - Color/printer.cartridge.black))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 50969fda64a24d43bdbeca9fe95fc91b + expression: last(/HP LaserJet - Color/printer.toner.black)<10 and length(last(/HP LaserJet - Color/printer.cartridge.black))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: a6fd78dc1d36425bac353be9c51d14f3 + name: Cyan Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.2] + key: printer.cartridge.cyan + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: a4babdb9346a4dc7b571ce91338d942f + name: Cyan Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.2] + key: printer.toner.cyan.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 10c4d323bd0f4382915198aa164d4841 + name: Cyan Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.2] + key: printer.toner.cyan.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: cc368936127a4d79b96770b2d7617525 + name: Cyan Toner Level + type: CALCULATED + key: printer.toner.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0) + description: Cyan Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: cyan + units: '%' + triggers: + - uuid: c8a211b0cfb445d8b1425f7c9d8a50f8 + expression: last(/HP LaserJet - Color/printer.toner.cyan)<20 and length(last(/HP LaserJet - Color/printer.cartridge.cyan))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 7de45329db3143fe8ba99c7ec88d01fa + expression: last(/HP LaserJet - Color/printer.toner.cyan)<10 and length(last(/HP LaserJet - Color/printer.cartridge.cyan))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 8308972f1147410faa4a860d3029a2f7 + name: Magenta Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.3] + key: printer.cartridge.magenta + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: c676b81f7ae248388105333b1a0e232d + name: Magenta Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.3] + key: printer.toner.magenta.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: deb6ac4789814d948a0e51c25c6dd7e6 + name: Magenta Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.3] + key: printer.toner.magenta.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 684ef735b4994be081507955dbb2c739 + name: Magenta Toner Level + type: CALCULATED + key: printer.toner.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0) + description: Magenta Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: magenta + units: '%' + triggers: + - uuid: e2fe4c5aa88543329b92feb052851fad + expression: last(/HP LaserJet - Color/printer.toner.magenta)<20 and length(last(/HP LaserJet - Color/printer.cartridge.magenta))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 452b391488114b42b2a8790d494f4797 + expression: last(/HP LaserJet - Color/printer.toner.magenta)<10 and length(last(/HP LaserJet - Color/printer.cartridge.magenta))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 01469d513b354c09ac4391ea1ed29a31 + name: Yellow Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.4] + key: printer.cartridge.yellow + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: cee83b3849644ea08de1d9d2b8ab9925 + name: Yellow Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.4] + key: printer.toner.yellow.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: e42d93341a2a44dc9cc8017c50984753 + name: Yellow Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.4] + key: printer.toner.yellow.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 1930935043d34c279c57c14558bb8504 + name: Yellow Toner Level + type: CALCULATED + key: printer.toner.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0) + description: Yellow Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: yellow + units: '%' + triggers: + - uuid: 9388fa0b74d947c1962023be87118bd2 + expression: last(/HP LaserJet - Color/printer.toner.yellow)<20 and length(last(/HP LaserJet - Color/printer.cartridge.yellow))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 35ab015073364b8897b00b7e1beeb368 + expression: last(/HP LaserJet - Color/printer.toner.yellow)<10 and length(last(/HP LaserJet - Color/printer.cartridge.yellow))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability diff --git a/zabbix_template_hp_designjet_t1700.yaml b/zabbix_template_hp_designjet_t1700.yaml new file mode 100644 index 0000000..852eacc --- /dev/null +++ b/zabbix_template_hp_designjet_t1700.yaml @@ -0,0 +1,407 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: cc0010f556eb4cb2bad376dcc3a9ad48 + template: HP DesignJet T1700 + name: HP DesignJet T1700 + description: 'HP DesignJet T1700/T1700dr PostScript Large Format Printer (44" wide) with 6-color ink system. + + Uses HP-specific OIDs for ink levels (1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.X.1.0) + + + Correct HP 730 300ml cartridge mapping (verified from actual installation): + + - P2V68A = Cyan + + - P2V69A = Magenta + + - P2V70A = Yellow + + - P2V71A = Matte Black + + - P2V72A = Gray + + - P2V73A = Photo Black' + groups: + - name: Printers + items: + - uuid: 28f681e3fa0c4dd1a770bd84f537c01f + name: Printer Model + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.25.3.2.1.3.1 + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + preprocessing: &id001 + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 24c3f04df954430d9afa4af057edf563 + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.1.5.0 + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + preprocessing: *id001 + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 92c3223b193546b89d43ab18e831e518 + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0 + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number (HP-specific OID) + preprocessing: *id001 + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 42c7f27d030b4498a083bd9837dadf28 + name: System Location + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.1.6.0 + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + preprocessing: *id001 + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 31edf9cd21fb444a8df1ca6d8f3208ac + name: Firmware Version + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.6.0 + key: printer.firmware + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Firmware Version + preprocessing: *id001 + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: edb403c646ac4b80af0473dce49569e3 + name: Matte Black Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.3 + key: printer.cartridge.matte_black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Matte Black Ink Cartridge Part Number (HP 730 P2V71A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: b59e604c50684e1a93b42e2c5ff9193b + name: Matte Black Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.3.1.0 + key: printer.ink.matte_black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Matte Black Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: matte_black + triggers: + - uuid: 11a36271e33b464590c4004f14779875 + expression: last(/HP DesignJet T1700/printer.ink.matte_black)<20 and length(last(/HP DesignJet T1700/printer.cartridge.matte_black))>0 + name: 'Matte Black Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: c74bea431f284f99a226303bd1a8c4fa + expression: last(/HP DesignJet T1700/printer.ink.matte_black)<10 and length(last(/HP DesignJet T1700/printer.cartridge.matte_black))>0 + name: 'Matte Black Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: ca0401e4b6ad4ea4a3997aa784f0cf44 + name: Photo Black Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.2 + key: printer.cartridge.photo_black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Photo Black Ink Cartridge Part Number (HP 730 P2V73A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 696a16edeec14b8eb49e8faaecc620a0 + name: Photo Black Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.2.1.0 + key: printer.ink.photo_black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Photo Black Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: photo_black + triggers: + - uuid: 3546b3857d41408dbe0c9bdca2894d3d + expression: last(/HP DesignJet T1700/printer.ink.photo_black)<20 and length(last(/HP DesignJet T1700/printer.cartridge.photo_black))>0 + name: 'Photo Black Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 86bdf2ac709c4aa190fff165854d1ac1 + expression: last(/HP DesignJet T1700/printer.ink.photo_black)<10 and length(last(/HP DesignJet T1700/printer.cartridge.photo_black))>0 + name: 'Photo Black Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: f556642dedc0478199756286434e402e + name: Cyan Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.6 + key: printer.cartridge.cyan + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Ink Cartridge Part Number (HP 730 P2V68A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 08bdb3aae6d241b3b7deb7710e3a975c + name: Cyan Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.6.1.0 + key: printer.ink.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Cyan Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: cyan + triggers: + - uuid: 1631b17f908a4f3db74f64d1d5d8777e + expression: last(/HP DesignJet T1700/printer.ink.cyan)<20 and length(last(/HP DesignJet T1700/printer.cartridge.cyan))>0 + name: 'Cyan Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 0e9990ee0cd9456b9ceb1f92296aa6de + expression: last(/HP DesignJet T1700/printer.ink.cyan)<10 and length(last(/HP DesignJet T1700/printer.cartridge.cyan))>0 + name: 'Cyan Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 3b5fa9757ad94156853abcc84835f2e7 + name: Magenta Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.5 + key: printer.cartridge.magenta + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Ink Cartridge Part Number (HP 730 P2V69A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 2f282ed4cf084d08a979c55950cef358 + name: Magenta Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.5.1.0 + key: printer.ink.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Magenta Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: magenta + triggers: + - uuid: 919c27a3aedb4f76a9f59e603e5dcded + expression: last(/HP DesignJet T1700/printer.ink.magenta)<20 and length(last(/HP DesignJet T1700/printer.cartridge.magenta))>0 + name: 'Magenta Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: a25e8aeaba3f4e18ba40708d66c07094 + expression: last(/HP DesignJet T1700/printer.ink.magenta)<10 and length(last(/HP DesignJet T1700/printer.cartridge.magenta))>0 + name: 'Magenta Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 8066d531aeef4232a2f86c7673dcb0ca + name: Yellow Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.4 + key: printer.cartridge.yellow + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Ink Cartridge Part Number (HP 730 P2V70A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: b4c3b5b7a70e4479adc666bfa2b5dee5 + name: Yellow Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.4.1.0 + key: printer.ink.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Yellow Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: yellow + triggers: + - uuid: 45590af45de840b691c9ce240ea59358 + expression: last(/HP DesignJet T1700/printer.ink.yellow)<20 and length(last(/HP DesignJet T1700/printer.cartridge.yellow))>0 + name: 'Yellow Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 0a60116b422e44398fe9965e78efde24 + expression: last(/HP DesignJet T1700/printer.ink.yellow)<10 and length(last(/HP DesignJet T1700/printer.cartridge.yellow))>0 + name: 'Yellow Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: d2d5e4c992b1430b96a0c81001bda0f4 + name: Gray Ink Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.1 + key: printer.cartridge.gray + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Gray Ink Cartridge Part Number (HP 730 P2V72A) + preprocessing: *id001 + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 62fd4c82a74c405993e2133fc2482bdf + name: Gray Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.1.1.0 + key: printer.ink.gray + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Gray Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: gray + triggers: + - uuid: d4ff92150d2b4cc693ab656efe57748f + expression: last(/HP DesignJet T1700/printer.ink.gray)<20 and length(last(/HP DesignJet T1700/printer.cartridge.gray))>0 + name: 'Gray Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: d99de94b22c24ef69154f5719f5b865f + expression: last(/HP DesignJet T1700/printer.ink.gray)<10 and length(last(/HP DesignJet T1700/printer.cartridge.gray))>0 + name: 'Gray Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability diff --git a/zabbix_template_hp_designjet_t1700_v2.yaml b/zabbix_template_hp_designjet_t1700_v2.yaml new file mode 100644 index 0000000..43ad6e0 --- /dev/null +++ b/zabbix_template_hp_designjet_t1700_v2.yaml @@ -0,0 +1,378 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d + template: HP DesignJet T1700 + name: HP DesignJet T1700 + description: | + HP DesignJet T1700/T1700dr PostScript Large Format Printer (44" wide) with 6-color ink system. + Uses HP-specific OIDs for ink levels (1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.X.1.0) + groups: + - name: Printers + items: + - uuid: fafe30cd886a4101ad26dcb05a350c00 + name: Printer Model + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.25.3.2.1.3.1 + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: ffacedf934484723bc7a4172b88885ec + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.1.5.0 + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: feedac9ef35b4d47a8811460c68d571d + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0 + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number (HP-specific OID) + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 8be8122000a344f4b047ecae6d8fcd9b + name: System Location + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.1.6.0 + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c01 + name: Matte Black Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.1 + key: printer.cartridge.matte_black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Matte Black Ink Cartridge Part Number (HP 730 P2V72A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c04 + name: Matte Black Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.1.1.0 + key: printer.ink.matte_black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Matte Black Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: matte_black + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c05 + expression: last(/HP DesignJet T1700/printer.ink.matte_black)<20 and length(last(/HP DesignJet T1700/printer.cartridge.matte_black))>0 + name: 'Matte Black Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c06 + expression: last(/HP DesignJet T1700/printer.ink.matte_black)<10 and length(last(/HP DesignJet T1700/printer.cartridge.matte_black))>0 + name: 'Matte Black Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c07 + name: Cyan Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.2 + key: printer.cartridge.cyan + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Ink Cartridge Part Number (HP 730 P2V73A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c0a + name: Cyan Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.2.1.0 + key: printer.ink.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Cyan Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: cyan + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c0b + expression: last(/HP DesignJet T1700/printer.ink.cyan)<20 and length(last(/HP DesignJet T1700/printer.cartridge.cyan))>0 + name: 'Cyan Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c0c + expression: last(/HP DesignJet T1700/printer.ink.cyan)<10 and length(last(/HP DesignJet T1700/printer.cartridge.cyan))>0 + name: 'Cyan Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c0d + name: Magenta Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.3 + key: printer.cartridge.magenta + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Ink Cartridge Part Number (HP 730 P2V71A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c10 + name: Magenta Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.3.1.0 + key: printer.ink.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Magenta Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: magenta + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c11 + expression: last(/HP DesignJet T1700/printer.ink.magenta)<20 and length(last(/HP DesignJet T1700/printer.cartridge.magenta))>0 + name: 'Magenta Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c12 + expression: last(/HP DesignJet T1700/printer.ink.magenta)<10 and length(last(/HP DesignJet T1700/printer.cartridge.magenta))>0 + name: 'Magenta Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c13 + name: Yellow Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.4 + key: printer.cartridge.yellow + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Ink Cartridge Part Number (HP 730 P2V70A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c16 + name: Yellow Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.4.1.0 + key: printer.ink.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Yellow Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: yellow + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c17 + expression: last(/HP DesignJet T1700/printer.ink.yellow)<20 and length(last(/HP DesignJet T1700/printer.cartridge.yellow))>0 + name: 'Yellow Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c18 + expression: last(/HP DesignJet T1700/printer.ink.yellow)<10 and length(last(/HP DesignJet T1700/printer.cartridge.yellow))>0 + name: 'Yellow Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c19 + name: Photo Black Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.5 + key: printer.cartridge.photo_black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Photo Black Ink Cartridge Part Number (HP 730 P2V69A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c1c + name: Photo Black Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.5.1.0 + key: printer.ink.photo_black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Photo Black Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: photo_black + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c1d + expression: last(/HP DesignJet T1700/printer.ink.photo_black)<20 and length(last(/HP DesignJet T1700/printer.cartridge.photo_black))>0 + name: 'Photo Black Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c1e + expression: last(/HP DesignJet T1700/printer.ink.photo_black)<10 and length(last(/HP DesignJet T1700/printer.cartridge.photo_black))>0 + name: 'Photo Black Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c1f + name: Gray Cartridge Part Number + type: SNMP_AGENT + snmp_oid: 1.3.6.1.2.1.43.11.1.1.6.1.6 + key: printer.cartridge.gray + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Gray Ink Cartridge Part Number (HP 730 P2V68A) + tags: + - tag: component + value: supplies + - tag: type + value: info + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c22 + name: Gray Ink Level + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.5.4.6.1.0 + key: printer.ink.gray + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + units: '%' + description: Gray Ink Level Percentage (HP proprietary OID) + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: gray + triggers: + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c23 + expression: last(/HP DesignJet T1700/printer.ink.gray)<20 and length(last(/HP DesignJet T1700/printer.cartridge.gray))>0 + name: 'Gray Ink Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c24 + expression: last(/HP DesignJet T1700/printer.ink.gray)<10 and length(last(/HP DesignJet T1700/printer.cartridge.gray))>0 + name: 'Gray Ink Level is critically low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}%. Replacement part: {{ITEM.LASTVALUE2}}' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c25 + name: Firmware Version + type: SNMP_AGENT + snmp_oid: 1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.6.0 + key: printer.firmware + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Firmware Version + tags: + - tag: component + value: printer + - tag: type + value: info diff --git a/zabbix_template_hp_mono.json b/zabbix_template_hp_mono.json new file mode 100644 index 0000000..c44863e --- /dev/null +++ b/zabbix_template_hp_mono.json @@ -0,0 +1,364 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "737fbe29a53540109e13ebbf61ed6eec", + "template": "HP LaserJet - Monochrome", + "name": "HP LaserJet - Monochrome", + "description": "HP LaserJet printers (all models - mono)", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "227f072b96694bff9c5d908652957c23", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Model", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "7e8af2ec750a4ca59fd36cb431ad406c", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "845eb41cb4c44404a30cf25b3dd27625", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Serial Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "9b6c3fe6dc57455ab27e0fc37dda9548", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System Location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "8048a1831e60432d92d68ed84b14337b", + "name": "Black Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.cartridge.black", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "e8a6e88325684ba7becb20cd7594e3ee", + "name": "Black Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "fcb17eb74a054da9956f58b1fc6f1966", + "name": "Black Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "fa8cdd36a1c145aba509a1fa1cb45fa6", + "name": "Black Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Black Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "50d1ec3985124431b218e560976a7f74", + "expression": "last(/HP LaserJet - Monochrome/printer.toner.black)<20 and length(last(/HP LaserJet - Monochrome/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "8b3fd779d96242a283b4e624da3fd84c", + "expression": "last(/HP LaserJet - Monochrome/printer.toner.black)<10 and length(last(/HP LaserJet - Monochrome/printer.cartridge.black))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "2f42ce1f233c4d8cb5e3b1dedd4d7ddb", + "name": "Maintenance Kit Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0]", + "key": "printer.maintenance.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Maintenance Kit Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "6dd361f669354c1f8e4c7d8a06de531d", + "name": "Maintenance Kit Remaining", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0]", + "key": "printer.maintenance.remaining", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Maintenance Kit Remaining", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "units": "pages", + "triggers": [ + { + "uuid": "2f962a6eab824126b1270e464e265d97", + "expression": "last(/HP LaserJet - Monochrome/printer.maintenance.remaining)<10000 and length(last(/HP LaserJet - Monochrome/printer.maintenance.model))>0", + "name": "Maintenance Kit Remaining is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "67f1ab49058d4be89b40ba9eff8c027b", + "expression": "last(/HP LaserJet - Monochrome/printer.maintenance.remaining)<5000 and length(last(/HP LaserJet - Monochrome/printer.maintenance.model))>0", + "name": "Maintenance Kit Remaining is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_template_hp_mono.yaml b/zabbix_template_hp_mono.yaml new file mode 100644 index 0000000..b2dbd51 --- /dev/null +++ b/zabbix_template_hp_mono.yaml @@ -0,0 +1,229 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: 737fbe29a53540109e13ebbf61ed6eec + template: HP LaserJet - Monochrome + name: HP LaserJet - Monochrome + description: HP LaserJet printers (all models - mono) + groups: + - name: Printers + items: + - uuid: 227f072b96694bff9c5d908652957c23 + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 7e8af2ec750a4ca59fd36cb431ad406c + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 845eb41cb4c44404a30cf25b3dd27625 + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 9b6c3fe6dc57455ab27e0fc37dda9548 + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 8048a1831e60432d92d68ed84b14337b + name: Black Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.cartridge.black + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: e8a6e88325684ba7becb20cd7594e3ee + name: Black Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: fcb17eb74a054da9956f58b1fc6f1966 + name: Black Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: fa8cdd36a1c145aba509a1fa1cb45fa6 + name: Black Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Black Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: 50d1ec3985124431b218e560976a7f74 + expression: last(/HP LaserJet - Monochrome/printer.toner.black)<20 and length(last(/HP LaserJet - Monochrome/printer.cartridge.black))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 8b3fd779d96242a283b4e624da3fd84c + expression: last(/HP LaserJet - Monochrome/printer.toner.black)<10 and length(last(/HP LaserJet - Monochrome/printer.cartridge.black))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 2f42ce1f233c4d8cb5e3b1dedd4d7ddb + name: Maintenance Kit Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0] + key: printer.maintenance.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Maintenance Kit Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 6dd361f669354c1f8e4c7d8a06de531d + name: Maintenance Kit Remaining + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.0] + key: printer.maintenance.remaining + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Maintenance Kit Remaining + tags: + - tag: component + value: printer + - tag: type + value: raw + units: pages + triggers: + - uuid: 2f962a6eab824126b1270e464e265d97 + expression: last(/HP LaserJet - Monochrome/printer.maintenance.remaining)<10000 and length(last(/HP LaserJet - Monochrome/printer.maintenance.model))>0 + name: 'Maintenance Kit Remaining is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 67f1ab49058d4be89b40ba9eff8c027b + expression: last(/HP LaserJet - Monochrome/printer.maintenance.remaining)<5000 and length(last(/HP LaserJet - Monochrome/printer.maintenance.model))>0 + name: 'Maintenance Kit Remaining is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability diff --git a/zabbix_template_xerox_color.json b/zabbix_template_xerox_color.json new file mode 100644 index 0000000..4500a25 --- /dev/null +++ b/zabbix_template_xerox_color.json @@ -0,0 +1,1451 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "b642a0ea839c4027a7e6a52a245c3451", + "template": "Xerox VersaLink - Color", + "name": "Xerox VersaLink - Color", + "description": "Xerox VersaLink Color multifunction printers", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "f7107cc25a854f6fb68e9b2c861cc421", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Model", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "daba1e575ed04f31b7bcf9b453cd4e6c", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d094a9080b214036abc973111d6dd8ff", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Serial Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "f72c5fccc0274c1598df4c93fd7ee3e3", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System Location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d76926198de641309eccc0b46f5e424d", + "name": "Black Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.toner.black.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "31b5eeb9e1d44f498bb7f0dd66c668e3", + "name": "Black Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "a9f68b277d794eb5861b9586c06bec4d", + "name": "Black Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "2d2a13236f2d4a4c820102f1ebd473c2", + "name": "Black Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Black Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "black" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "79797eefe8004698b02d45aee88d2f46", + "expression": "last(/Xerox VersaLink - Color/printer.toner.black)<20 and length(last(/Xerox VersaLink - Color/printer.toner.black.part))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "97a49eb30be44c449ad15236c3a2292f", + "expression": "last(/Xerox VersaLink - Color/printer.toner.black)<10 and length(last(/Xerox VersaLink - Color/printer.toner.black.part))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "b4b21d5261e1493586a87d4a737b83ae", + "name": "Yellow Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.2]", + "key": "printer.toner.yellow.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Yellow Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "52631b827a7947329514736e841f3ffb", + "name": "Yellow Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.2]", + "key": "printer.toner.yellow.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "3e3471b5a153410a93043806d141baa2", + "name": "Yellow Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.2]", + "key": "printer.toner.yellow.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "9d16978ccef6495e8a5c3c4135df15e0", + "name": "Yellow Toner Level", + "type": "CALCULATED", + "key": "printer.toner.yellow", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "description": "Yellow Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "yellow" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "70a7e1c08a394f9bad35f851bc2e9b0a", + "expression": "last(/Xerox VersaLink - Color/printer.toner.yellow)<20 and length(last(/Xerox VersaLink - Color/printer.toner.yellow.part))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "1e5d6d55cb894bb1a4c30a1810e69cb5", + "expression": "last(/Xerox VersaLink - Color/printer.toner.yellow)<10 and length(last(/Xerox VersaLink - Color/printer.toner.yellow.part))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "46add5511ed049a6987e4383f4744683", + "name": "Magenta Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.3]", + "key": "printer.toner.magenta.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Magenta Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "ce99e1d2f0784fe9ab2b935277b2b602", + "name": "Magenta Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.3]", + "key": "printer.toner.magenta.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "045b02be84c64edfa6371195073c7548", + "name": "Magenta Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.3]", + "key": "printer.toner.magenta.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "f0f5ee2d31e54cdebdfbca234d344af7", + "name": "Magenta Toner Level", + "type": "CALCULATED", + "key": "printer.toner.magenta", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "description": "Magenta Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "magenta" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "961f014b9e2941e4bf497cc07e0433ac", + "expression": "last(/Xerox VersaLink - Color/printer.toner.magenta)<20 and length(last(/Xerox VersaLink - Color/printer.toner.magenta.part))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "8101c478181547848351b9584aa8c5d8", + "expression": "last(/Xerox VersaLink - Color/printer.toner.magenta)<10 and length(last(/Xerox VersaLink - Color/printer.toner.magenta.part))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "e6995a3e91b748cca3aafea261c5dfdb", + "name": "Cyan Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.4]", + "key": "printer.toner.cyan.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Cyan Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "7aa03745aedb4dd094fd3fd891d105bd", + "name": "Cyan Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.4]", + "key": "printer.toner.cyan.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "61cd61ec69dc443db8baa0c6fbacd49b", + "name": "Cyan Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.4]", + "key": "printer.toner.cyan.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "99aa1d37060045bdb1f1b71d11a58209", + "name": "Cyan Toner Level", + "type": "CALCULATED", + "key": "printer.toner.cyan", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "description": "Cyan Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "cyan" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "ad2d9b2805af40a180c4be0e2af1e4be", + "expression": "last(/Xerox VersaLink - Color/printer.toner.cyan)<20 and length(last(/Xerox VersaLink - Color/printer.toner.cyan.part))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "a3baaeec40a94734a1caa8a5acdb9bb2", + "expression": "last(/Xerox VersaLink - Color/printer.toner.cyan)<10 and length(last(/Xerox VersaLink - Color/printer.toner.cyan.part))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "13a5a1cfbe4d4acdb76cf2ac824a7558", + "name": "Waste Cartridge Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.5]", + "key": "printer.waste.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Waste Cartridge Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "8ef52118a55f4ab8b3ffc33a6568584f", + "name": "Waste Cartridge Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.5]", + "key": "printer.waste.level", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Waste Cartridge Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "1303b15de2c444f297476f0ac76814ca", + "expression": "last(/Xerox VersaLink - Color/printer.waste.level)>80 and length(last(/Xerox VersaLink - Color/printer.waste.part))>0", + "name": "Waste Cartridge Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "9c0e8ebd1c8144c7b370c7a48845532c", + "expression": "last(/Xerox VersaLink - Color/printer.waste.level)>90 and length(last(/Xerox VersaLink - Color/printer.waste.part))>0", + "name": "Waste Cartridge Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "948e14983e8f4118813dc71ecd71fa07", + "name": "Black Drum Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.6]", + "key": "printer.drum.black.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black Drum Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "2e6e9de29ab041d6bb76db2805899c70", + "name": "Black Drum Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.6]", + "key": "printer.drum.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Drum Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "fc814174ee7349239e18616b77e3d48b", + "name": "Black Drum Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.6]", + "key": "printer.drum.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Drum Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "48873ffb49724bdf9579adb2da0e5cdb", + "name": "Black Drum Level", + "type": "CALCULATED", + "key": "printer.drum.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.drum.black.current)/last(//printer.drum.black.max))*100,0)", + "description": "Black Drum Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "a26f322ae0a043b9bbabb779221b81bf", + "expression": "last(/Xerox VersaLink - Color/printer.drum.black)<20 and length(last(/Xerox VersaLink - Color/printer.drum.black.part))>0", + "name": "Black Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "278f30be2a40424dbc3af0be623c3a37", + "expression": "last(/Xerox VersaLink - Color/printer.drum.black)<10 and length(last(/Xerox VersaLink - Color/printer.drum.black.part))>0", + "name": "Black Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "09cd943b26c34c659a864d15fcaa1774", + "name": "Yellow Drum Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.7]", + "key": "printer.drum.yellow.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Yellow Drum Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "4425c4cd54404217b876de974d417f97", + "name": "Yellow Drum Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.7]", + "key": "printer.drum.yellow.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Drum Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "3607ac3861f64384a6296b70ff3bfdf8", + "name": "Yellow Drum Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.7]", + "key": "printer.drum.yellow.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Drum Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "d0afd17fec7d40188aa14f260d73fa13", + "name": "Yellow Drum Level", + "type": "CALCULATED", + "key": "printer.drum.yellow", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.drum.yellow.current)/last(//printer.drum.yellow.max))*100,0)", + "description": "Yellow Drum Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "e5767395d8e2439aaa24bd8700d2467a", + "expression": "last(/Xerox VersaLink - Color/printer.drum.yellow)<20 and length(last(/Xerox VersaLink - Color/printer.drum.yellow.part))>0", + "name": "Yellow Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "73b6ac5dddc9444da35e05053332ae93", + "expression": "last(/Xerox VersaLink - Color/printer.drum.yellow)<10 and length(last(/Xerox VersaLink - Color/printer.drum.yellow.part))>0", + "name": "Yellow Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "e856ccb45cac41adafc2edcb67098dbe", + "name": "Magenta Drum Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.8]", + "key": "printer.drum.magenta.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Magenta Drum Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "06f01b9113214dcd82aced4b448740b6", + "name": "Magenta Drum Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.8]", + "key": "printer.drum.magenta.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Drum Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "21697c90516b4c3c9bf738fba4435823", + "name": "Magenta Drum Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.8]", + "key": "printer.drum.magenta.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Drum Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "6da2c8a87be14926b8d1006bc3f61d7e", + "name": "Magenta Drum Level", + "type": "CALCULATED", + "key": "printer.drum.magenta", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.drum.magenta.current)/last(//printer.drum.magenta.max))*100,0)", + "description": "Magenta Drum Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "13ac161870e5470a97e7da6963972967", + "expression": "last(/Xerox VersaLink - Color/printer.drum.magenta)<20 and length(last(/Xerox VersaLink - Color/printer.drum.magenta.part))>0", + "name": "Magenta Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "de333dcd0cf046d1a5109334de1f014c", + "expression": "last(/Xerox VersaLink - Color/printer.drum.magenta)<10 and length(last(/Xerox VersaLink - Color/printer.drum.magenta.part))>0", + "name": "Magenta Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "cb41e58df07e4eb2bf11fcaa6cf7b390", + "name": "Cyan Drum Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.9]", + "key": "printer.drum.cyan.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Cyan Drum Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "d4d0f2562edc4f73aae2efcacc159137", + "name": "Cyan Drum Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.9]", + "key": "printer.drum.cyan.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Drum Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "90e0d130a32d47fa81fce7adc54a661d", + "name": "Cyan Drum Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.9]", + "key": "printer.drum.cyan.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Drum Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "fa59b63b6fae47a190ae838200069d79", + "name": "Cyan Drum Level", + "type": "CALCULATED", + "key": "printer.drum.cyan", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.drum.cyan.current)/last(//printer.drum.cyan.max))*100,0)", + "description": "Cyan Drum Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "4540db9127f4454aa6d1c084b87139aa", + "expression": "last(/Xerox VersaLink - Color/printer.drum.cyan)<20 and length(last(/Xerox VersaLink - Color/printer.drum.cyan.part))>0", + "name": "Cyan Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "e188954e41a242e39a9f262ed82eaaee", + "expression": "last(/Xerox VersaLink - Color/printer.drum.cyan)<10 and length(last(/Xerox VersaLink - Color/printer.drum.cyan.part))>0", + "name": "Cyan Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "cd898e728e4e4b41b34edc2b23d22d6f", + "name": "Transfer Roller Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.10]", + "key": "printer.transfer.roller.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Transfer Roller Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "6961fd351bf440efb54c3ac7bc2c1a84", + "name": "Transfer Belt Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.11]", + "key": "printer.transfer.belt.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Transfer Belt Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "3bc8a2cbb96b4b8185240e9ffeb79a83", + "name": "Fuser Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.12]", + "key": "printer.fuser.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Fuser Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_template_xerox_color.yaml b/zabbix_template_xerox_color.yaml new file mode 100644 index 0000000..c5a8f69 --- /dev/null +++ b/zabbix_template_xerox_color.yaml @@ -0,0 +1,924 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: b642a0ea839c4027a7e6a52a245c3451 + template: Xerox VersaLink - Color + name: Xerox VersaLink - Color + description: Xerox VersaLink Color multifunction printers + groups: + - name: Printers + items: + - uuid: f7107cc25a854f6fb68e9b2c861cc421 + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: daba1e575ed04f31b7bcf9b453cd4e6c + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d094a9080b214036abc973111d6dd8ff + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: f72c5fccc0274c1598df4c93fd7ee3e3 + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d76926198de641309eccc0b46f5e424d + name: Black Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.toner.black.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 31b5eeb9e1d44f498bb7f0dd66c668e3 + name: Black Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: a9f68b277d794eb5861b9586c06bec4d + name: Black Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 2d2a13236f2d4a4c820102f1ebd473c2 + name: Black Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Black Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: black + units: '%' + triggers: + - uuid: 79797eefe8004698b02d45aee88d2f46 + expression: last(/Xerox VersaLink - Color/printer.toner.black)<20 and length(last(/Xerox VersaLink - Color/printer.toner.black.part))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 97a49eb30be44c449ad15236c3a2292f + expression: last(/Xerox VersaLink - Color/printer.toner.black)<10 and length(last(/Xerox VersaLink - Color/printer.toner.black.part))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: b4b21d5261e1493586a87d4a737b83ae + name: Yellow Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.2] + key: printer.toner.yellow.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 52631b827a7947329514736e841f3ffb + name: Yellow Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.2] + key: printer.toner.yellow.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 3e3471b5a153410a93043806d141baa2 + name: Yellow Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.2] + key: printer.toner.yellow.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 9d16978ccef6495e8a5c3c4135df15e0 + name: Yellow Toner Level + type: CALCULATED + key: printer.toner.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0) + description: Yellow Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: yellow + units: '%' + triggers: + - uuid: 70a7e1c08a394f9bad35f851bc2e9b0a + expression: last(/Xerox VersaLink - Color/printer.toner.yellow)<20 and length(last(/Xerox VersaLink - Color/printer.toner.yellow.part))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 1e5d6d55cb894bb1a4c30a1810e69cb5 + expression: last(/Xerox VersaLink - Color/printer.toner.yellow)<10 and length(last(/Xerox VersaLink - Color/printer.toner.yellow.part))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 46add5511ed049a6987e4383f4744683 + name: Magenta Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.3] + key: printer.toner.magenta.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: ce99e1d2f0784fe9ab2b935277b2b602 + name: Magenta Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.3] + key: printer.toner.magenta.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 045b02be84c64edfa6371195073c7548 + name: Magenta Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.3] + key: printer.toner.magenta.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: f0f5ee2d31e54cdebdfbca234d344af7 + name: Magenta Toner Level + type: CALCULATED + key: printer.toner.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0) + description: Magenta Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: magenta + units: '%' + triggers: + - uuid: 961f014b9e2941e4bf497cc07e0433ac + expression: last(/Xerox VersaLink - Color/printer.toner.magenta)<20 and length(last(/Xerox VersaLink - Color/printer.toner.magenta.part))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 8101c478181547848351b9584aa8c5d8 + expression: last(/Xerox VersaLink - Color/printer.toner.magenta)<10 and length(last(/Xerox VersaLink - Color/printer.toner.magenta.part))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: e6995a3e91b748cca3aafea261c5dfdb + name: Cyan Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.4] + key: printer.toner.cyan.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 7aa03745aedb4dd094fd3fd891d105bd + name: Cyan Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.4] + key: printer.toner.cyan.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 61cd61ec69dc443db8baa0c6fbacd49b + name: Cyan Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.4] + key: printer.toner.cyan.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 99aa1d37060045bdb1f1b71d11a58209 + name: Cyan Toner Level + type: CALCULATED + key: printer.toner.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0) + description: Cyan Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: cyan + units: '%' + triggers: + - uuid: ad2d9b2805af40a180c4be0e2af1e4be + expression: last(/Xerox VersaLink - Color/printer.toner.cyan)<20 and length(last(/Xerox VersaLink - Color/printer.toner.cyan.part))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: a3baaeec40a94734a1caa8a5acdb9bb2 + expression: last(/Xerox VersaLink - Color/printer.toner.cyan)<10 and length(last(/Xerox VersaLink - Color/printer.toner.cyan.part))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 13a5a1cfbe4d4acdb76cf2ac824a7558 + name: Waste Cartridge Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.5] + key: printer.waste.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Waste Cartridge Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 8ef52118a55f4ab8b3ffc33a6568584f + name: Waste Cartridge Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.5] + key: printer.waste.level + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Waste Cartridge Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 1303b15de2c444f297476f0ac76814ca + expression: last(/Xerox VersaLink - Color/printer.waste.level)>80 and length(last(/Xerox VersaLink - Color/printer.waste.part))>0 + name: 'Waste Cartridge Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 9c0e8ebd1c8144c7b370c7a48845532c + expression: last(/Xerox VersaLink - Color/printer.waste.level)>90 and length(last(/Xerox VersaLink - Color/printer.waste.part))>0 + name: 'Waste Cartridge Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 948e14983e8f4118813dc71ecd71fa07 + name: Black Drum Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.6] + key: printer.drum.black.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black Drum Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 2e6e9de29ab041d6bb76db2805899c70 + name: Black Drum Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.6] + key: printer.drum.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Drum Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: fc814174ee7349239e18616b77e3d48b + name: Black Drum Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.6] + key: printer.drum.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Drum Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 48873ffb49724bdf9579adb2da0e5cdb + name: Black Drum Level + type: CALCULATED + key: printer.drum.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.drum.black.current)/last(//printer.drum.black.max))*100,0) + description: Black Drum Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: a26f322ae0a043b9bbabb779221b81bf + expression: last(/Xerox VersaLink - Color/printer.drum.black)<20 and length(last(/Xerox VersaLink - Color/printer.drum.black.part))>0 + name: 'Black Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 278f30be2a40424dbc3af0be623c3a37 + expression: last(/Xerox VersaLink - Color/printer.drum.black)<10 and length(last(/Xerox VersaLink - Color/printer.drum.black.part))>0 + name: 'Black Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 09cd943b26c34c659a864d15fcaa1774 + name: Yellow Drum Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.7] + key: printer.drum.yellow.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Drum Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 4425c4cd54404217b876de974d417f97 + name: Yellow Drum Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.7] + key: printer.drum.yellow.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Drum Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 3607ac3861f64384a6296b70ff3bfdf8 + name: Yellow Drum Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.7] + key: printer.drum.yellow.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Drum Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: d0afd17fec7d40188aa14f260d73fa13 + name: Yellow Drum Level + type: CALCULATED + key: printer.drum.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.drum.yellow.current)/last(//printer.drum.yellow.max))*100,0) + description: Yellow Drum Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: e5767395d8e2439aaa24bd8700d2467a + expression: last(/Xerox VersaLink - Color/printer.drum.yellow)<20 and length(last(/Xerox VersaLink - Color/printer.drum.yellow.part))>0 + name: 'Yellow Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 73b6ac5dddc9444da35e05053332ae93 + expression: last(/Xerox VersaLink - Color/printer.drum.yellow)<10 and length(last(/Xerox VersaLink - Color/printer.drum.yellow.part))>0 + name: 'Yellow Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: e856ccb45cac41adafc2edcb67098dbe + name: Magenta Drum Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.8] + key: printer.drum.magenta.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Drum Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 06f01b9113214dcd82aced4b448740b6 + name: Magenta Drum Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.8] + key: printer.drum.magenta.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Drum Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 21697c90516b4c3c9bf738fba4435823 + name: Magenta Drum Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.8] + key: printer.drum.magenta.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Drum Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 6da2c8a87be14926b8d1006bc3f61d7e + name: Magenta Drum Level + type: CALCULATED + key: printer.drum.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.drum.magenta.current)/last(//printer.drum.magenta.max))*100,0) + description: Magenta Drum Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: 13ac161870e5470a97e7da6963972967 + expression: last(/Xerox VersaLink - Color/printer.drum.magenta)<20 and length(last(/Xerox VersaLink - Color/printer.drum.magenta.part))>0 + name: 'Magenta Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: de333dcd0cf046d1a5109334de1f014c + expression: last(/Xerox VersaLink - Color/printer.drum.magenta)<10 and length(last(/Xerox VersaLink - Color/printer.drum.magenta.part))>0 + name: 'Magenta Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: cb41e58df07e4eb2bf11fcaa6cf7b390 + name: Cyan Drum Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.9] + key: printer.drum.cyan.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Drum Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: d4d0f2562edc4f73aae2efcacc159137 + name: Cyan Drum Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.9] + key: printer.drum.cyan.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Drum Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 90e0d130a32d47fa81fce7adc54a661d + name: Cyan Drum Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.9] + key: printer.drum.cyan.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Drum Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: fa59b63b6fae47a190ae838200069d79 + name: Cyan Drum Level + type: CALCULATED + key: printer.drum.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.drum.cyan.current)/last(//printer.drum.cyan.max))*100,0) + description: Cyan Drum Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: 4540db9127f4454aa6d1c084b87139aa + expression: last(/Xerox VersaLink - Color/printer.drum.cyan)<20 and length(last(/Xerox VersaLink - Color/printer.drum.cyan.part))>0 + name: 'Cyan Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: e188954e41a242e39a9f262ed82eaaee + expression: last(/Xerox VersaLink - Color/printer.drum.cyan)<10 and length(last(/Xerox VersaLink - Color/printer.drum.cyan.part))>0 + name: 'Cyan Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: cd898e728e4e4b41b34edc2b23d22d6f + name: Transfer Roller Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.10] + key: printer.transfer.roller.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Transfer Roller Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 6961fd351bf440efb54c3ac7bc2c1a84 + name: Transfer Belt Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.11] + key: printer.transfer.belt.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Transfer Belt Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 3bc8a2cbb96b4b8185240e9ffeb79a83 + name: Fuser Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.12] + key: printer.fuser.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Fuser Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" diff --git a/zabbix_template_xerox_enterprise.json b/zabbix_template_xerox_enterprise.json new file mode 100644 index 0000000..f2ab955 --- /dev/null +++ b/zabbix_template_xerox_enterprise.json @@ -0,0 +1,1414 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "c2e2302205ce4d249e7edfe6db933ee9", + "template": "Xerox Enterprise - Color", + "name": "Xerox Enterprise - Color", + "description": "Xerox EC8036, AltaLink C8xxx enterprise color printers", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "d03e698d55fc45d191884bbdf7810be1", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Model", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "4e7860eb0b2047ac919bd4a097982eca", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "d6aff78eb5c84fccb4db51612fb72b23", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Serial Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "7adc5e990d914b6386a631a24d78e86d", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System Location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "df2c66eb2cab4842908c61a853a8fa42", + "name": "Black Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.toner.black.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Black Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "5711ef102f0d425aa56dea64fb513fc5", + "name": "Black Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "5cc49eed0ed54341b1b3219becd3defb", + "name": "Black Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Black Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "6e5ae3d685a44b80ae8cc46a5317dd89", + "name": "Black Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Black Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "black" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "f29c9298c8de4b00b1ad9afff3a26b29", + "expression": "last(/Xerox Enterprise - Color/printer.toner.black)<20 and length(last(/Xerox Enterprise - Color/printer.toner.black.part))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "6d9174594b6a45158cbedda71528f045", + "expression": "last(/Xerox Enterprise - Color/printer.toner.black)<10 and length(last(/Xerox Enterprise - Color/printer.toner.black.part))>0", + "name": "Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "8a5caec5e00a4bbb922d6d5ecec81b84", + "name": "Cyan Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.2]", + "key": "printer.toner.cyan.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Cyan Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "f1f57074096546e38f06f3a72b49eac1", + "name": "Cyan Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.2]", + "key": "printer.toner.cyan.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "5c7fa001b3824adaae4bb329c9d457a3", + "name": "Cyan Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.2]", + "key": "printer.toner.cyan.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Cyan Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "5d5521b20f7446358bcc983548393146", + "name": "Cyan Toner Level", + "type": "CALCULATED", + "key": "printer.toner.cyan", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0)", + "description": "Cyan Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "cyan" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "9cceff0affe946d2bb479494b5a53856", + "expression": "last(/Xerox Enterprise - Color/printer.toner.cyan)<20 and length(last(/Xerox Enterprise - Color/printer.toner.cyan.part))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "d3e2fd3d21384222bbdbeaf7f3a4ddfb", + "expression": "last(/Xerox Enterprise - Color/printer.toner.cyan)<10 and length(last(/Xerox Enterprise - Color/printer.toner.cyan.part))>0", + "name": "Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "d5f3c36c00ea46a98db8d55d94ea4877", + "name": "Magenta Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.3]", + "key": "printer.toner.magenta.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Magenta Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "cfb2aa9afdac4888a5b308a36fe691f2", + "name": "Magenta Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.3]", + "key": "printer.toner.magenta.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "fe63cabb3aab41a890680844bc154b8d", + "name": "Magenta Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.3]", + "key": "printer.toner.magenta.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Magenta Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "48f16d55b5b94699b7c130e754780a06", + "name": "Magenta Toner Level", + "type": "CALCULATED", + "key": "printer.toner.magenta", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0)", + "description": "Magenta Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "magenta" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "86631cefe7c340da8f3d43fbd48675f7", + "expression": "last(/Xerox Enterprise - Color/printer.toner.magenta)<20 and length(last(/Xerox Enterprise - Color/printer.toner.magenta.part))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "24d3aa508eec4b33a19151ffbace424c", + "expression": "last(/Xerox Enterprise - Color/printer.toner.magenta)<10 and length(last(/Xerox Enterprise - Color/printer.toner.magenta.part))>0", + "name": "Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "5c9f0b5d390f4fbe9fa6eed25484bc91", + "name": "Yellow Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.4]", + "key": "printer.toner.yellow.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Yellow Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "a59e1595e3b148dc911c33780d96955a", + "name": "Yellow Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.4]", + "key": "printer.toner.yellow.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "5e73fae1f51e435884faab2f3bc67918", + "name": "Yellow Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.4]", + "key": "printer.toner.yellow.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Yellow Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "54baecbcfbb347619038285724e22c25", + "name": "Yellow Toner Level", + "type": "CALCULATED", + "key": "printer.toner.yellow", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0)", + "description": "Yellow Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + }, + { + "tag": "color", + "value": "yellow" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "4f7e80ea7a3b469f83a27b1940ea64a3", + "expression": "last(/Xerox Enterprise - Color/printer.toner.yellow)<20 and length(last(/Xerox Enterprise - Color/printer.toner.yellow.part))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "c2a3e67d116a4f71b4285b6a0179d57c", + "expression": "last(/Xerox Enterprise - Color/printer.toner.yellow)<10 and length(last(/Xerox Enterprise - Color/printer.toner.yellow.part))>0", + "name": "Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "8c4813f0619a4c89a5c97c11bed56ffd", + "name": "Drum Cartridge R1 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.5]", + "key": "printer.drum.r1.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum Cartridge R1 Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "548923c9cd58485194efca4680bde2da", + "name": "Drum Cartridge R1 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.5]", + "key": "printer.drum.r1", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Cartridge R1 Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "b147995cef044decaa97b143eb039d6a", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r1)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r1.part))>0", + "name": "Drum Cartridge R1 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "53c3b15d79394f758e1d8b836d796dea", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r1)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r1.part))>0", + "name": "Drum Cartridge R1 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "45ff64acfd41458a8a12f0992f710c23", + "name": "Drum Cartridge R2 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.6]", + "key": "printer.drum.r2.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum Cartridge R2 Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "c9039db77e4c4132968c21abe8112b72", + "name": "Drum Cartridge R2 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.6]", + "key": "printer.drum.r2", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Cartridge R2 Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "2ed60d3a355443dca8be5d7fce0ed5f2", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r2)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r2.part))>0", + "name": "Drum Cartridge R2 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "6d2ee2c9445340f1b93c12266cb9e10e", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r2)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r2.part))>0", + "name": "Drum Cartridge R2 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "4875f060efad49e7881975478a3f6ed9", + "name": "Drum Cartridge R3 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.7]", + "key": "printer.drum.r3.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum Cartridge R3 Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "d21017456aad4c92aca5546af3a7b0f8", + "name": "Drum Cartridge R3 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.7]", + "key": "printer.drum.r3", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Cartridge R3 Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "a7855fb69aea4988b9dc3dfde7ea3524", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r3)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r3.part))>0", + "name": "Drum Cartridge R3 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "32b7fe7831d140e3946f47e74e8c88dc", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r3)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r3.part))>0", + "name": "Drum Cartridge R3 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "53a1563fc0f6455fa1d71513c1587c60", + "name": "Drum Cartridge R4 Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.8]", + "key": "printer.drum.r4.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum Cartridge R4 Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "3a70d28a36df4f068993add946713716", + "name": "Drum Cartridge R4 Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.8]", + "key": "printer.drum.r4", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Cartridge R4 Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "52794d11f96644c08b2e14d628375650", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r4)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r4.part))>0", + "name": "Drum Cartridge R4 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "ab90cd28b6f6423d914e9455f5927167", + "expression": "last(/Xerox Enterprise - Color/printer.drum.r4)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r4.part))>0", + "name": "Drum Cartridge R4 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "e2c246f9da8544eba92924b3706ff944", + "name": "Fuser Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.9]", + "key": "printer.fuser.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Fuser Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "3b5628120c194bfda5c55572c13db316", + "name": "Fuser Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.9]", + "key": "printer.fuser", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Fuser Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "d79ee4c1ef014b7c81a3f4b9d4a4f2a1", + "expression": "last(/Xerox Enterprise - Color/printer.fuser)<20 and length(last(/Xerox Enterprise - Color/printer.fuser.part))>0", + "name": "Fuser Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "a268fed950074c46a574b4eb86c208d7", + "expression": "last(/Xerox Enterprise - Color/printer.fuser)<10 and length(last(/Xerox Enterprise - Color/printer.fuser.part))>0", + "name": "Fuser Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "ee5eeacfd5024775ad40b302811ba2f2", + "name": "Waste Container Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.10]", + "key": "printer.waste.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Waste Container Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "90417fd5f0a740b499c8d27943973736", + "name": "Waste Container Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.10]", + "key": "printer.waste", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Waste Container Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "69cebca1efb3446c8c383465991a80af", + "expression": "last(/Xerox Enterprise - Color/printer.waste)>80 and length(last(/Xerox Enterprise - Color/printer.waste.part))>0", + "name": "Waste Container Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "0a88c88dd7f3424e948647264e83b6ed", + "expression": "last(/Xerox Enterprise - Color/printer.waste)>90 and length(last(/Xerox Enterprise - Color/printer.waste.part))>0", + "name": "Waste Container Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "232ac58feeea45299b525cca72effa4a", + "name": "Transfer Belt Cleaner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.11]", + "key": "printer.transfer.belt.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Transfer Belt Cleaner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "3836d9fa2d674f97a3405162a88f2c25", + "name": "Transfer Belt Cleaner Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.11]", + "key": "printer.transfer.belt", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Transfer Belt Cleaner Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "7354e1f37e894f05be032edf493e3721", + "expression": "last(/Xerox Enterprise - Color/printer.transfer.belt)<20 and length(last(/Xerox Enterprise - Color/printer.transfer.belt.part))>0", + "name": "Transfer Belt Cleaner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "b30fc1c454bc460e9c70e9ac83af48d3", + "expression": "last(/Xerox Enterprise - Color/printer.transfer.belt)<10 and length(last(/Xerox Enterprise - Color/printer.transfer.belt.part))>0", + "name": "Transfer Belt Cleaner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "a3619eef02a74c49aecf1b955fe27f27", + "name": "Second Bias Transfer Roll Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.12]", + "key": "printer.transfer.roller.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Second Bias Transfer Roll Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "49f8bd6f255049adb329327fbec53e6a", + "name": "Second Bias Transfer Roll Level", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.12]", + "key": "printer.transfer.roller", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Second Bias Transfer Roll Level", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ], + "units": "%", + "triggers": [ + { + "uuid": "0a369a1a8b464ef29337d37b25eda6f7", + "expression": "last(/Xerox Enterprise - Color/printer.transfer.roller)<20 and length(last(/Xerox Enterprise - Color/printer.transfer.roller.part))>0", + "name": "Second Bias Transfer Roll Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "54af07ea4601435c90b2478881944397", + "expression": "last(/Xerox Enterprise - Color/printer.transfer.roller)<10 and length(last(/Xerox Enterprise - Color/printer.transfer.roller.part))>0", + "name": "Second Bias Transfer Roll Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_template_xerox_enterprise.yaml b/zabbix_template_xerox_enterprise.yaml new file mode 100644 index 0000000..b58dcec --- /dev/null +++ b/zabbix_template_xerox_enterprise.yaml @@ -0,0 +1,893 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: c2e2302205ce4d249e7edfe6db933ee9 + template: Xerox Enterprise - Color + name: Xerox Enterprise - Color + description: Xerox EC8036, AltaLink C8xxx enterprise color printers + groups: + - name: Printers + items: + - uuid: d03e698d55fc45d191884bbdf7810be1 + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 4e7860eb0b2047ac919bd4a097982eca + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: d6aff78eb5c84fccb4db51612fb72b23 + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 7adc5e990d914b6386a631a24d78e86d + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: df2c66eb2cab4842908c61a853a8fa42 + name: Black Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.toner.black.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Black Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 5711ef102f0d425aa56dea64fb513fc5 + name: Black Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 5cc49eed0ed54341b1b3219becd3defb + name: Black Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Black Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 6e5ae3d685a44b80ae8cc46a5317dd89 + name: Black Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Black Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: black + units: '%' + triggers: + - uuid: f29c9298c8de4b00b1ad9afff3a26b29 + expression: last(/Xerox Enterprise - Color/printer.toner.black)<20 and length(last(/Xerox Enterprise - Color/printer.toner.black.part))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 6d9174594b6a45158cbedda71528f045 + expression: last(/Xerox Enterprise - Color/printer.toner.black)<10 and length(last(/Xerox Enterprise - Color/printer.toner.black.part))>0 + name: 'Black Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 8a5caec5e00a4bbb922d6d5ecec81b84 + name: Cyan Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.2] + key: printer.toner.cyan.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Cyan Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: f1f57074096546e38f06f3a72b49eac1 + name: Cyan Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.2] + key: printer.toner.cyan.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 5c7fa001b3824adaae4bb329c9d457a3 + name: Cyan Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.2] + key: printer.toner.cyan.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Cyan Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 5d5521b20f7446358bcc983548393146 + name: Cyan Toner Level + type: CALCULATED + key: printer.toner.cyan + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.cyan.current)/last(//printer.toner.cyan.max))*100,0) + description: Cyan Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: cyan + units: '%' + triggers: + - uuid: 9cceff0affe946d2bb479494b5a53856 + expression: last(/Xerox Enterprise - Color/printer.toner.cyan)<20 and length(last(/Xerox Enterprise - Color/printer.toner.cyan.part))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: d3e2fd3d21384222bbdbeaf7f3a4ddfb + expression: last(/Xerox Enterprise - Color/printer.toner.cyan)<10 and length(last(/Xerox Enterprise - Color/printer.toner.cyan.part))>0 + name: 'Cyan Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: d5f3c36c00ea46a98db8d55d94ea4877 + name: Magenta Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.3] + key: printer.toner.magenta.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Magenta Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: cfb2aa9afdac4888a5b308a36fe691f2 + name: Magenta Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.3] + key: printer.toner.magenta.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: fe63cabb3aab41a890680844bc154b8d + name: Magenta Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.3] + key: printer.toner.magenta.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Magenta Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 48f16d55b5b94699b7c130e754780a06 + name: Magenta Toner Level + type: CALCULATED + key: printer.toner.magenta + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.magenta.current)/last(//printer.toner.magenta.max))*100,0) + description: Magenta Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: magenta + units: '%' + triggers: + - uuid: 86631cefe7c340da8f3d43fbd48675f7 + expression: last(/Xerox Enterprise - Color/printer.toner.magenta)<20 and length(last(/Xerox Enterprise - Color/printer.toner.magenta.part))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 24d3aa508eec4b33a19151ffbace424c + expression: last(/Xerox Enterprise - Color/printer.toner.magenta)<10 and length(last(/Xerox Enterprise - Color/printer.toner.magenta.part))>0 + name: 'Magenta Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 5c9f0b5d390f4fbe9fa6eed25484bc91 + name: Yellow Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.4] + key: printer.toner.yellow.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Yellow Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: a59e1595e3b148dc911c33780d96955a + name: Yellow Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.4] + key: printer.toner.yellow.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 5e73fae1f51e435884faab2f3bc67918 + name: Yellow Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.4] + key: printer.toner.yellow.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Yellow Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 54baecbcfbb347619038285724e22c25 + name: Yellow Toner Level + type: CALCULATED + key: printer.toner.yellow + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.yellow.current)/last(//printer.toner.yellow.max))*100,0) + description: Yellow Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + - tag: color + value: yellow + units: '%' + triggers: + - uuid: 4f7e80ea7a3b469f83a27b1940ea64a3 + expression: last(/Xerox Enterprise - Color/printer.toner.yellow)<20 and length(last(/Xerox Enterprise - Color/printer.toner.yellow.part))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: c2a3e67d116a4f71b4285b6a0179d57c + expression: last(/Xerox Enterprise - Color/printer.toner.yellow)<10 and length(last(/Xerox Enterprise - Color/printer.toner.yellow.part))>0 + name: 'Yellow Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 8c4813f0619a4c89a5c97c11bed56ffd + name: Drum Cartridge R1 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.5] + key: printer.drum.r1.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum Cartridge R1 Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 548923c9cd58485194efca4680bde2da + name: Drum Cartridge R1 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.5] + key: printer.drum.r1 + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Cartridge R1 Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: b147995cef044decaa97b143eb039d6a + expression: last(/Xerox Enterprise - Color/printer.drum.r1)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r1.part))>0 + name: 'Drum Cartridge R1 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 53c3b15d79394f758e1d8b836d796dea + expression: last(/Xerox Enterprise - Color/printer.drum.r1)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r1.part))>0 + name: 'Drum Cartridge R1 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 45ff64acfd41458a8a12f0992f710c23 + name: Drum Cartridge R2 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.6] + key: printer.drum.r2.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum Cartridge R2 Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: c9039db77e4c4132968c21abe8112b72 + name: Drum Cartridge R2 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.6] + key: printer.drum.r2 + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Cartridge R2 Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 2ed60d3a355443dca8be5d7fce0ed5f2 + expression: last(/Xerox Enterprise - Color/printer.drum.r2)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r2.part))>0 + name: 'Drum Cartridge R2 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 6d2ee2c9445340f1b93c12266cb9e10e + expression: last(/Xerox Enterprise - Color/printer.drum.r2)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r2.part))>0 + name: 'Drum Cartridge R2 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 4875f060efad49e7881975478a3f6ed9 + name: Drum Cartridge R3 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.7] + key: printer.drum.r3.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum Cartridge R3 Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: d21017456aad4c92aca5546af3a7b0f8 + name: Drum Cartridge R3 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.7] + key: printer.drum.r3 + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Cartridge R3 Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: a7855fb69aea4988b9dc3dfde7ea3524 + expression: last(/Xerox Enterprise - Color/printer.drum.r3)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r3.part))>0 + name: 'Drum Cartridge R3 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 32b7fe7831d140e3946f47e74e8c88dc + expression: last(/Xerox Enterprise - Color/printer.drum.r3)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r3.part))>0 + name: 'Drum Cartridge R3 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 53a1563fc0f6455fa1d71513c1587c60 + name: Drum Cartridge R4 Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.8] + key: printer.drum.r4.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum Cartridge R4 Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 3a70d28a36df4f068993add946713716 + name: Drum Cartridge R4 Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.8] + key: printer.drum.r4 + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Cartridge R4 Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 52794d11f96644c08b2e14d628375650 + expression: last(/Xerox Enterprise - Color/printer.drum.r4)<20 and length(last(/Xerox Enterprise - Color/printer.drum.r4.part))>0 + name: 'Drum Cartridge R4 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: ab90cd28b6f6423d914e9455f5927167 + expression: last(/Xerox Enterprise - Color/printer.drum.r4)<10 and length(last(/Xerox Enterprise - Color/printer.drum.r4.part))>0 + name: 'Drum Cartridge R4 Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: e2c246f9da8544eba92924b3706ff944 + name: Fuser Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.9] + key: printer.fuser.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Fuser Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 3b5628120c194bfda5c55572c13db316 + name: Fuser Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.9] + key: printer.fuser + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Fuser Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: d79ee4c1ef014b7c81a3f4b9d4a4f2a1 + expression: last(/Xerox Enterprise - Color/printer.fuser)<20 and length(last(/Xerox Enterprise - Color/printer.fuser.part))>0 + name: 'Fuser Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: a268fed950074c46a574b4eb86c208d7 + expression: last(/Xerox Enterprise - Color/printer.fuser)<10 and length(last(/Xerox Enterprise - Color/printer.fuser.part))>0 + name: 'Fuser Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: ee5eeacfd5024775ad40b302811ba2f2 + name: Waste Container Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.10] + key: printer.waste.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Waste Container Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 90417fd5f0a740b499c8d27943973736 + name: Waste Container Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.10] + key: printer.waste + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Waste Container Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 69cebca1efb3446c8c383465991a80af + expression: last(/Xerox Enterprise - Color/printer.waste)>80 and length(last(/Xerox Enterprise - Color/printer.waste.part))>0 + name: 'Waste Container Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 0a88c88dd7f3424e948647264e83b6ed + expression: last(/Xerox Enterprise - Color/printer.waste)>90 and length(last(/Xerox Enterprise - Color/printer.waste.part))>0 + name: 'Waste Container Level is high on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 232ac58feeea45299b525cca72effa4a + name: Transfer Belt Cleaner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.11] + key: printer.transfer.belt.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Transfer Belt Cleaner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 3836d9fa2d674f97a3405162a88f2c25 + name: Transfer Belt Cleaner Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.11] + key: printer.transfer.belt + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Transfer Belt Cleaner Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 7354e1f37e894f05be032edf493e3721 + expression: last(/Xerox Enterprise - Color/printer.transfer.belt)<20 and length(last(/Xerox Enterprise - Color/printer.transfer.belt.part))>0 + name: 'Transfer Belt Cleaner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: b30fc1c454bc460e9c70e9ac83af48d3 + expression: last(/Xerox Enterprise - Color/printer.transfer.belt)<10 and length(last(/Xerox Enterprise - Color/printer.transfer.belt.part))>0 + name: 'Transfer Belt Cleaner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: a3619eef02a74c49aecf1b955fe27f27 + name: Second Bias Transfer Roll Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.12] + key: printer.transfer.roller.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Second Bias Transfer Roll Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 49f8bd6f255049adb329327fbec53e6a + name: Second Bias Transfer Roll Level + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.12] + key: printer.transfer.roller + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Second Bias Transfer Roll Level + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + units: '%' + triggers: + - uuid: 0a369a1a8b464ef29337d37b25eda6f7 + expression: last(/Xerox Enterprise - Color/printer.transfer.roller)<20 and length(last(/Xerox Enterprise - Color/printer.transfer.roller.part))>0 + name: 'Second Bias Transfer Roll Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 54af07ea4601435c90b2478881944397 + expression: last(/Xerox Enterprise - Color/printer.transfer.roller)<10 and length(last(/Xerox Enterprise - Color/printer.transfer.roller.part))>0 + name: 'Second Bias Transfer Roll Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability diff --git a/zabbix_template_xerox_mono.json b/zabbix_template_xerox_mono.json new file mode 100644 index 0000000..995d12e --- /dev/null +++ b/zabbix_template_xerox_mono.json @@ -0,0 +1,484 @@ +{ + "zabbix_export": { + "version": "7.4", + "template_groups": [ + { + "uuid": "3cd4e8d0b828464e8f4b3becf13a9dbd", + "name": "Printers" + } + ], + "templates": [ + { + "uuid": "4202e75f163c4232bb172916de8afa2d", + "template": "Xerox VersaLink - Monochrome", + "name": "Xerox VersaLink - Monochrome", + "description": "Xerox VersaLink B&W multifunction printers", + "groups": [ + { + "name": "Printers" + } + ], + "items": [ + { + "uuid": "45364a48593a41e89b13ec0392f4f582", + "name": "Printer Model", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.25.3.2.1.3.1]", + "key": "printer.model", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Model", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "983382594f0a43c895d7951f7161a2b6", + "name": "Printer Hostname", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.5.0]", + "key": "printer.hostname", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Hostname", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "aefae29a7396430e8bb1e743f62d733d", + "name": "Printer Serial Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.5.1.1.17.1]", + "key": "printer.serial", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Printer Serial Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "ba0b6019551241d883f7982c461a674b", + "name": "System Location", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.1.6.0]", + "key": "printer.location", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "System Location", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + ] + } + ] + }, + { + "uuid": "5d450a90003a4586b7e6c25cd5229a31", + "name": "Toner Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.1]", + "key": "printer.toner.black.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Toner Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "6c2f31435baf4f32bd38d451ce07011a", + "name": "Toner Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.1]", + "key": "printer.toner.black.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Toner Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "1b9c7a9bba0b47b7acf20bb3bf0d95fa", + "name": "Toner Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.1]", + "key": "printer.toner.black.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Toner Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "816299e412684db39226c258978c4980", + "name": "Toner Level", + "type": "CALCULATED", + "key": "printer.toner.black", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0)", + "description": "Toner Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "9434fe5b914f438b84541e3d379e25d9", + "expression": "last(/Xerox VersaLink - Monochrome/printer.toner.black)<20 and length(last(/Xerox VersaLink - Monochrome/printer.toner.black.part))>0", + "name": "Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "132e12902ef74bd2bb6664842b009e8f", + "expression": "last(/Xerox VersaLink - Monochrome/printer.toner.black)<10 and length(last(/Xerox VersaLink - Monochrome/printer.toner.black.part))>0", + "name": "Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "d461fd1c161e4f7a89a30cf272b5eb29", + "name": "Drum Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.6]", + "key": "printer.drum.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Drum Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "0a4d3dc0852744b7a6bc52d1471cb89c", + "name": "Drum Current", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.9.1.6]", + "key": "printer.drum.current", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Current", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "727bd2d798bd4659ae2d9ce8dd06c82c", + "name": "Drum Max", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.8.1.6]", + "key": "printer.drum.max", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "description": "Drum Max", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "raw" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + ] + } + ] + }, + { + "uuid": "6f3a650b617249629098c046a0016825", + "name": "Drum Level", + "type": "CALCULATED", + "key": "printer.drum", + "delay": "1h", + "history": "90d", + "trends": "365d", + "value_type": "FLOAT", + "params": "round((last(//printer.drum.current)/last(//printer.drum.max))*100,0)", + "description": "Drum Level", + "tags": [ + { + "tag": "component", + "value": "supplies" + }, + { + "tag": "type", + "value": "level" + } + ], + "units": "%", + "triggers": [ + { + "uuid": "5e95825e6d61431bbcf023b906905947", + "expression": "last(/Xerox VersaLink - Monochrome/printer.drum)<20 and length(last(/Xerox VersaLink - Monochrome/printer.drum.part))>0", + "name": "Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "WARNING", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + }, + { + "uuid": "c60c7f50ea824ee48d58a0ffcfd9a602", + "expression": "last(/Xerox VersaLink - Monochrome/printer.drum)<10 and length(last(/Xerox VersaLink - Monochrome/printer.drum.part))>0", + "name": "Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)", + "priority": "HIGH", + "tags": [ + { + "tag": "scope", + "value": "availability" + } + ] + } + ] + }, + { + "uuid": "77ed4ed118ab4694b8dac4a4d66ea6f8", + "name": "Transfer Roller Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.10]", + "key": "printer.transfer.roller.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Transfer Roller Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + }, + { + "uuid": "39ea5ea68c644db79aa6d72cb5af74b6", + "name": "Fuser Part Number", + "type": "SNMP_AGENT", + "snmp_oid": "get[1.3.6.1.2.1.43.11.1.1.6.1.12]", + "key": "printer.fuser.part", + "delay": "1h", + "history": "90d", + "trends": "0d", + "value_type": "TEXT", + "description": "Fuser Part Number", + "tags": [ + { + "tag": "component", + "value": "printer" + }, + { + "tag": "type", + "value": "info" + } + ], + "preprocessing": [ + { + "type": "JAVASCRIPT", + "parameters": [ + "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/zabbix_template_xerox_mono.yaml b/zabbix_template_xerox_mono.yaml new file mode 100644 index 0000000..2c716a8 --- /dev/null +++ b/zabbix_template_xerox_mono.yaml @@ -0,0 +1,307 @@ +zabbix_export: + version: '7.4' + template_groups: + - uuid: 3cd4e8d0b828464e8f4b3becf13a9dbd + name: Printers + templates: + - uuid: 4202e75f163c4232bb172916de8afa2d + template: Xerox VersaLink - Monochrome + name: Xerox VersaLink - Monochrome + description: Xerox VersaLink B&W multifunction printers + groups: + - name: Printers + items: + - uuid: 45364a48593a41e89b13ec0392f4f582 + name: Printer Model + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.25.3.2.1.3.1] + key: printer.model + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Model + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 983382594f0a43c895d7951f7161a2b6 + name: Printer Hostname + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.5.0] + key: printer.hostname + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Hostname + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: aefae29a7396430e8bb1e743f62d733d + name: Printer Serial Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.5.1.1.17.1] + key: printer.serial + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Printer Serial Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: ba0b6019551241d883f7982c461a674b + name: System Location + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.1.6.0] + key: printer.location + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: System Location + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle hex-encoded SNMP strings\n// Try multiple approaches to convert hex to ASCII\n\n// First, check if it looks like hex (with spaces, newlines, or other separators)\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n // Extract all hex pairs (2 characters)\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n // Only keep printable ASCII (0x20-0x7E)\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n return result;\n }\n }\n}\n\n// Fallback: Remove non-printable characters\nreturn value.replace(/[^\\x20-\\x7E]/g, '');" + - uuid: 5d450a90003a4586b7e6c25cd5229a31 + name: Toner Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.1] + key: printer.toner.black.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Toner Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 6c2f31435baf4f32bd38d451ce07011a + name: Toner Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.1] + key: printer.toner.black.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Toner Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 1b9c7a9bba0b47b7acf20bb3bf0d95fa + name: Toner Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.1] + key: printer.toner.black.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Toner Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 816299e412684db39226c258978c4980 + name: Toner Level + type: CALCULATED + key: printer.toner.black + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.toner.black.current)/last(//printer.toner.black.max))*100,0) + description: Toner Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: 9434fe5b914f438b84541e3d379e25d9 + expression: last(/Xerox VersaLink - Monochrome/printer.toner.black)<20 and length(last(/Xerox VersaLink - Monochrome/printer.toner.black.part))>0 + name: 'Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: 132e12902ef74bd2bb6664842b009e8f + expression: last(/Xerox VersaLink - Monochrome/printer.toner.black)<10 and length(last(/Xerox VersaLink - Monochrome/printer.toner.black.part))>0 + name: 'Toner Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: d461fd1c161e4f7a89a30cf272b5eb29 + name: Drum Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.6] + key: printer.drum.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Drum Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 0a4d3dc0852744b7a6bc52d1471cb89c + name: Drum Current + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.9.1.6] + key: printer.drum.current + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Current + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 727bd2d798bd4659ae2d9ce8dd06c82c + name: Drum Max + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.8.1.6] + key: printer.drum.max + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + description: Drum Max + tags: + - tag: component + value: printer + - tag: type + value: raw + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Handle SNMP unknown values (-3, -2, etc.)\n// Per RFC 3805: -1 = other, -2 = unknown, -3 = unknown\n// Convert to 0 to indicate empty/problem state\nvar numValue = parseInt(value);\nif (numValue < 0) {\n return '0';\n}\nreturn value;" + - uuid: 6f3a650b617249629098c046a0016825 + name: Drum Level + type: CALCULATED + key: printer.drum + delay: 1h + history: 90d + trends: 365d + value_type: FLOAT + params: round((last(//printer.drum.current)/last(//printer.drum.max))*100,0) + description: Drum Level + tags: + - tag: component + value: supplies + - tag: type + value: level + units: '%' + triggers: + - uuid: 5e95825e6d61431bbcf023b906905947 + expression: last(/Xerox VersaLink - Monochrome/printer.drum)<20 and length(last(/Xerox VersaLink - Monochrome/printer.drum.part))>0 + name: 'Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: WARNING + tags: + - tag: scope + value: availability + - uuid: c60c7f50ea824ee48d58a0ffcfd9a602 + expression: last(/Xerox VersaLink - Monochrome/printer.drum)<10 and length(last(/Xerox VersaLink - Monochrome/printer.drum.part))>0 + name: 'Drum Level is low on {{HOST.NAME}}. Current level: {{ITEM.LASTVALUE}}. Replacement part: {{ITEM.LASTVALUE2}} (See compatibility notes for potential alternatives)' + priority: HIGH + tags: + - tag: scope + value: availability + - uuid: 77ed4ed118ab4694b8dac4a4d66ea6f8 + name: Transfer Roller Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.10] + key: printer.transfer.roller.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Transfer Roller Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;" + - uuid: 39ea5ea68c644db79aa6d72cb5af74b6 + name: Fuser Part Number + type: SNMP_AGENT + snmp_oid: get[1.3.6.1.2.1.43.11.1.1.6.1.12] + key: printer.fuser.part + delay: 1h + history: 90d + trends: 0d + value_type: TEXT + description: Fuser Part Number + tags: + - tag: component + value: printer + - tag: type + value: info + preprocessing: + - type: JAVASCRIPT + parameters: + - "// Clean up part number by removing serial numbers and firmware\n// Handles formats like:\n// \"Toner Cartridge;SNACC7952D80730000\" -> \"Toner Cartridge\"\n// \"Black Cartridge HP 58A (CF258A);FW:V4.23.3\" -> \"Black Cartridge HP 58A (CF258A)\"\n// \"Drum Cartridge, PN 101R00554;SN2600A90008100000\" -> \"Drum Cartridge, PN 101R00554\"\n\n// First, apply hex conversion if needed\nvar hexPattern = /^[0-9A-Fa-f\\s]+$/;\nif (hexPattern.test(value) && value.length > 4) {\n var hexBytes = value.match(/[0-9A-Fa-f]{2}/g);\n if (hexBytes && hexBytes.length > 0) {\n var result = '';\n for (var i = 0; i < hexBytes.length; i++) {\n var code = parseInt(hexBytes[i], 16);\n if (code >= 32 && code <= 126) {\n result += String.fromCharCode(code);\n }\n }\n if (result.length > 0) {\n value = result;\n }\n }\n}\n\n// Remove serial numbers (;SN followed by anything)\nvalue = value.replace(/;SN[^;]*/g, '');\n\n// Remove firmware info (;FW: or ;FW\ + \ followed by anything)\nvalue = value.replace(/;FW[^;]*/g, '');\n\n// Remove any other semicolon-separated metadata\n// (but keep the main description before first semicolon)\nvar parts = value.split(';');\nvalue = parts[0];\n\n// Trim whitespace\nvalue = value.trim();\n\n// For Xerox printers reporting just \"Toner Cartridge\" without PN,\n// try to add known part numbers (must match model-specific logic)\n// This is handled by triggers showing compatibility notes instead\n\nreturn value;"