zabbix / community-templates

Zabbix Community Templates repository
https://share.zabbix.com
MIT License
1.34k stars 1.8k forks source link

Universal Printer Template is not importable in 6.4 #262

Open w3ich3rt opened 1 year ago

w3ich3rt commented 1 year ago

The universal printer template was not importable in my zabbix 6.4 installation. There were some "unexpected tags" in it.

I cleaned the file.

For the changes I made, please refer to this patchfile.

template_universal_printer.patch

w3ich3rt commented 1 year ago
--- template_universal_printer.xml  2023-06-29 07:58:59.000000000 +0200
+++ template_universal_printer_new.xml  2023-06-29 07:56:44.000000000 +0200
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <zabbix_export>
-    <version>6.2</version>
-    <date>2023-02-10T11:37:33Z</date>
+    <version>6.4</version>
     <template_groups>
         <template_group>
             <uuid>7df96b18c230490a9a0a9e2307226338</uuid>
@@ -14,9 +13,7 @@
             <template>Universal Printer</template>
             <name>Universal Printer</name>
             <description>This template is valid for all printer manufacturers and all devices that are attached to the [RFC1759](https://tools.ietf.org/html/rfc1759.html) and [RFC3805](https://tools.ietf.org/html/rfc3805) (Printer-MIB).
-
 The serial number, trays, toner and output trays are discovered (LLD) and monitored. The counter and filling levels are displayed in graphs.
-
 created by Nico Wieczorek</description>
             <templates>
                 <template>
@@ -39,7 +36,6 @@ created by Nico Wieczorek</description>
                     <trends>0</trends>
                     <value_type>CHAR</value_type>
                     <inventory_link>TYPE</inventory_link>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -58,7 +54,6 @@ created by Nico Wieczorek</description>
                     <valuemap>
                         <name>Printer error state</name>
                     </valuemap>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -85,7 +80,6 @@ created by Nico Wieczorek</description>
                     <valuemap>
                         <name>Printer status</name>
                     </valuemap>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -103,7 +97,6 @@ created by Nico Wieczorek</description>
                     <trends>0</trends>
                     <value_type>CHAR</value_type>
                     <inventory_link>MACADDRESS_A</inventory_link>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -120,7 +113,6 @@ created by Nico Wieczorek</description>
                     <history>1w</history>
                     <trends>0</trends>
                     <value_type>CHAR</value_type>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -138,7 +130,6 @@ created by Nico Wieczorek</description>
                     <trends>0</trends>
                     <value_type>CHAR</value_type>
                     <inventory_link>SERIALNO_A</inventory_link>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -156,7 +147,6 @@ created by Nico Wieczorek</description>
                     <valuemap>
                         <name>Printer status</name>
                     </valuemap>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -174,7 +164,6 @@ created by Nico Wieczorek</description>
                     <valuemap>
                         <name>Printer status</name>
                     </valuemap>
-                    <request_method>POST</request_method>
                     <tags>
                         <tag>
                             <tag>Application</tag>
@@ -202,7 +191,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -220,7 +208,6 @@ created by Nico Wieczorek</description>
                             <valuemap>
                                 <name>Printer cover state</name>
                             </valuemap>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -237,7 +224,6 @@ created by Nico Wieczorek</description>
                             </trigger_prototypes>
                         </item_prototype>
                     </item_prototypes>
-                    <request_method>POST</request_method>
                 </discovery_rule>
                 <discovery_rule>
                     <uuid>8d3f00d5f89f4c6ead061c783b045247</uuid>
@@ -256,7 +242,6 @@ created by Nico Wieczorek</description>
                             <value_type>FLOAT</value_type>
                             <units>%</units>
                             <params>100*last(//prtInputCurrentLevel[{#SNMPVALUE}])/last(//prtInputMaxCapacity[{#SNMPVALUE}])</params>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -272,7 +257,6 @@ created by Nico Wieczorek</description>
                             <key>prtInputCurrentLevel[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -290,7 +274,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -307,7 +290,6 @@ created by Nico Wieczorek</description>
                             <delay>1h</delay>
                             <history>1w</history>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -325,7 +307,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -343,7 +324,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -361,7 +341,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -376,7 +355,6 @@ created by Nico Wieczorek</description>
                             <snmp_oid>.1.3.6.1.2.1.43.8.2.1.11.{#SNMPINDEX}</snmp_oid>
                             <key>prtInputStatus[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -403,7 +381,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -412,7 +389,6 @@ created by Nico Wieczorek</description>
                             </tags>
                         </item_prototype>
                     </item_prototypes>
-                    <request_method>POST</request_method>
                 </discovery_rule>
                 <discovery_rule>
                     <uuid>630c6e804df8493798fafaec39a68bfe</uuid>
@@ -432,7 +408,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -448,7 +423,6 @@ created by Nico Wieczorek</description>
                             <delay>10m</delay>
                             <units>%</units>
                             <params>100*last(//prtMarkerSuppliesLevel[{#SNMPVALUE}])/last(//prtMarkerSuppliesMaxCapacity[{#SNMPVALUE}])</params>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -474,7 +448,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>CHAR</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -490,7 +463,6 @@ created by Nico Wieczorek</description>
                             <key>prtMarkerSuppliesLevel[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -507,7 +479,6 @@ created by Nico Wieczorek</description>
                             <delay>1h</delay>
                             <history>1w</history>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -559,7 +530,6 @@ created by Nico Wieczorek</description>
                             </graph_items>
                         </graph_prototype>
                     </graph_prototypes>
-                    <request_method>POST</request_method>
                 </discovery_rule>
                 <discovery_rule>
                     <uuid>5ba075d463c44c2b969baa794234886d</uuid>
@@ -579,7 +549,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>CHAR</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -594,7 +563,6 @@ created by Nico Wieczorek</description>
                             <snmp_oid>.1.3.6.1.2.1.43.13.4.1.11.{#SNMPINDEX}</snmp_oid>
                             <key>prtMediaPathStatus[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -612,7 +580,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -621,7 +588,6 @@ created by Nico Wieczorek</description>
                             </tags>
                         </item_prototype>
                     </item_prototypes>
-                    <request_method>POST</request_method>
                 </discovery_rule>
                 <discovery_rule>
                     <uuid>7d83fa65a1614470be655a92b4681d4e</uuid>
@@ -641,7 +607,6 @@ created by Nico Wieczorek</description>
                             <history>1w</history>
                             <trends>0</trends>
                             <value_type>TEXT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -658,7 +623,6 @@ created by Nico Wieczorek</description>
                             <delay>1h</delay>
                             <history>1w</history>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -674,7 +638,6 @@ created by Nico Wieczorek</description>
                             <key>prtOutputRemainingCapacity[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
                             <value_type>FLOAT</value_type>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -689,7 +652,6 @@ created by Nico Wieczorek</description>
                             <snmp_oid>.1.3.6.1.2.1.43.9.2.1.6.{#SNMPINDEX}</snmp_oid>
                             <key>prtOutputStatus[{#SNMPVALUE}]</key>
                             <delay>10m</delay>
-                            <request_method>POST</request_method>
                             <tags>
                                 <tag>
                                     <tag>Application</tag>
@@ -707,7 +669,6 @@ created by Nico Wieczorek</description>
                             </trigger_prototypes>
                         </item_prototype>
                     </item_prototypes>
-                    <request_method>POST</request_method>
                 </discovery_rule>
             </discovery_rules>
             <tags>
feiticeir0 commented 1 year ago

Thank you. For those that will apply the diff using Linux, you need to convert the line endings for both files from DOS to UNIX dos2unix template_universal_printer.patch dos2unix template_universal_printer.xml

And finally you can apply the patch without rejects

patch template_universal_printer.xml template_universal_printer.patch

And finally works.