Initial commit: SNMP scanner and Zabbix template generator
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 <noreply@anthropic.com>
This commit is contained in:
453
zabbix_template_hp_color.yaml
Normal file
453
zabbix_template_hp_color.yaml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user