Template Creation Hack? (Is this possible)

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
jburysom
Posts: 3
Joined: Thu Apr 11, 2024 10:32 am

Template Creation Hack? (Is this possible)

Post by jburysom »

Hello there,

Let me predicate this with I am not familiar cacti templates. I need to add Liebert/Emerson MPH-NCV27NXXF30 PDUs to Cacti and I cannot find any existing templates after searching the "Scripts and Templates" forum.

Is it possible to use existing templates for another device and just change out the OIDs? I'm currently using multiple templates which I have taken from the forum to graph data for my APC AP7811B PDUs. The templates I used are listed below - 4 data templates, 1 host/device template and 1 graph template.

cacti_data_template_apc_780x790x_pdu_load.xml
cacti_data_template_apc_780x790x_pdu_low_load_threshold.xml
cacti_data_template_apc_780x790x_pdu_near_overload_threshold.xml
cacti_data_template_apc_780x790x_pdu_overload_threshold.xml
cacti_graph_template_apc_780x790x_pdu_information.xml
cacti_host_template_apc_780x790x_pdu.xml

For example, if I copy the cacti_data_template_apc_780x790x_pdu_load.xml to cacti_data_template_liebert_mph_pdu_load.xml and change the OID to Liebert's value and change the <name>APC 780x/790x PDU Load</name> to be Liebert specific will this work? The templates have many hashes throughout, are these unique? If these are duplicated will they conflict with the original templates I am using? Although 3 of the data templates have the same hashes...

Any thoughts or suggestions would be greatly appreciated. I have included the template below to view. I have set the lines to change in <bold> below.

Thanks!

=-=-=-=-=

% cat cacti_data_template_apc_780x790x_pdu_load.xml
<cacti>
<hash_0101026434886800d23492ad6b4e25463bbdf1>
<name>APC 780x/790x PDU Load</name>
<ds>
<t_name></t_name>
<name>|host_description| - Load</name>
<data_source_path></data_source_path>
<data_input_id>hash_0301023eb92bb845b9660a7445cf9740726522</data_input_id>
<t_data_source_profile_id></t_data_source_profile_id>
<data_source_profile_id>hash_20010266d35da8f75c912ede3dbe901fedcae0</data_source_profile_id>
<t_rrd_step></t_rrd_step>
<rrd_step>60</rrd_step>
<t_active></t_active>
<active>on</active>
</ds>
<items>
<hash_0801026a22e182218eebeb0640de98c329059a>
<t_data_source_name></t_data_source_name>
<data_source_name>apc_blah_load</data_source_name>
<t_rrd_minimum></t_rrd_minimum>
<rrd_minimum>0</rrd_minimum>
<t_rrd_maximum></t_rrd_maximum>
<rrd_maximum>U</rrd_maximum>
<t_data_source_type_id></t_data_source_type_id>
<data_source_type_id>1</data_source_type_id>
<t_rrd_heartbeat></t_rrd_heartbeat>
<rrd_heartbeat>120</rrd_heartbeat>
<t_data_input_field_id></t_data_input_field_id>
<data_input_field_id>0</data_input_field_id>
</hash_0801026a22e182218eebeb0640de98c329059a>
</items>
<data>
<item_000>
<data_input_field_id>hash_07010292f5906c8dc0f964b41f4253df582c38</data_input_field_id>
<t_value></t_value>
<value></value>
</item_000>
<item_001>
<data_input_field_id>hash_07010232285d5bf16e56c478f5e83f32cda9ef</data_input_field_id>
<t_value></t_value>
<value></value>
</item_001>
<item_002>
<data_input_field_id>hash_070102ad14ac90641aed388139f6ba86a2e48b</data_input_field_id>
<t_value></t_value>
<value></value>
</item_002>
<item_003>
<data_input_field_id>hash_0701029c55a74bd571b4f00a96fd4b793278c6</data_input_field_id>
<t_value></t_value>
<value></value>
</item_003>
<item_004>
<data_input_field_id>hash_070102012ccb1d3687d3edb29c002ea66e72da</data_input_field_id>
<t_value></t_value>
<value></value>
</item_004>
<item_005>
<data_input_field_id>hash_0701024276a5ec6e3fe33995129041b1909762</data_input_field_id>
<t_value></t_value>
<value>.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1</value>
</item_005>
<item_006>
<data_input_field_id>hash_070102fc64b99742ec417cc424dbf8c7692d36</data_input_field_id>
<t_value></t_value>
<value></value>
</item_006>
<item_007>
<data_input_field_id>hash_07010220832ce12f099c8e54140793a091af90</data_input_field_id>
<t_value></t_value>
<value></value>
</item_007>
<item_008>
<data_input_field_id>hash_070102c60c9aac1e1b3555ea0620b8bbfd82cb</data_input_field_id>
<t_value></t_value>
<value></value>
</item_008>
<item_009>
<data_input_field_id>hash_070102feda162701240101bc74148415ef415a</data_input_field_id>
<t_value></t_value>
<value></value>
</item_009>
</data>
</hash_0101026434886800d23492ad6b4e25463bbdf1>
<hash_0301023eb92bb845b9660a7445cf9740726522>
<name>Get SNMP Data</name>
<type_id>2</type_id>
<input_string></input_string>
<fields>
<hash_07010292f5906c8dc0f964b41f4253df582c38>
<name>SNMP IP Address</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>hostname</type_code>
<input_output>in</input_output>
<data_name>management_ip</data_name>
</hash_07010292f5906c8dc0f964b41f4253df582c38>
<hash_07010232285d5bf16e56c478f5e83f32cda9ef>
<name>SNMP Community</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_community</type_code>
<input_output>in</input_output>
<data_name>snmp_community</data_name>
</hash_07010232285d5bf16e56c478f5e83f32cda9ef>
<hash_070102ad14ac90641aed388139f6ba86a2e48b>
<name>SNMP Username</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls>on</allow_nulls>
<type_code>snmp_username</type_code>
<input_output>in</input_output>
<data_name>snmp_username</data_name>
</hash_070102ad14ac90641aed388139f6ba86a2e48b>
<hash_0701029c55a74bd571b4f00a96fd4b793278c6>
<name>SNMP Password</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls>on</allow_nulls>
<type_code>snmp_password</type_code>
<input_output>in</input_output>
<data_name>snmp_password</data_name>
</hash_0701029c55a74bd571b4f00a96fd4b793278c6>
<hash_070102012ccb1d3687d3edb29c002ea66e72da>
<name>SNMP Version (1, 2, or 3)</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls>on</allow_nulls>
<type_code>snmp_version</type_code>
<input_output>in</input_output>
<data_name>snmp_version</data_name>
</hash_070102012ccb1d3687d3edb29c002ea66e72da>
<hash_0701024276a5ec6e3fe33995129041b1909762>
<name>OID</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_oid</type_code>
<input_output>in</input_output>
<data_name>oid</data_name>
</hash_0701024276a5ec6e3fe33995129041b1909762>
<hash_070102fc64b99742ec417cc424dbf8c7692d36>
<name>SNMP Port</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_port</type_code>
<input_output>in</input_output>
<data_name>snmp_port</data_name>
</hash_070102fc64b99742ec417cc424dbf8c7692d36>
<hash_07010220832ce12f099c8e54140793a091af90>
<name>SNMP Authenticaion Protocol (v3)</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_auth_protocol</type_code>
<input_output>in</input_output>
<data_name>snmp_auth_protocol</data_name>
</hash_07010220832ce12f099c8e54140793a091af90>
<hash_070102c60c9aac1e1b3555ea0620b8bbfd82cb>
<name>SNMP Privacy Passphrase (v3)</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_priv_passphrase</type_code>
<input_output>in</input_output>
<data_name>snmp_priv_passphrase</data_name>
</hash_070102c60c9aac1e1b3555ea0620b8bbfd82cb>
<hash_070102feda162701240101bc74148415ef415a>
<name>SNMP Privacy Protocol (v3)</name>
<update_rra></update_rra>
<regexp_match></regexp_match>
<allow_nulls></allow_nulls>
<type_code>snmp_priv_protocol</type_code>
<input_output>in</input_output>
<data_name>snmp_priv_protocol</data_name>
</hash_070102feda162701240101bc74148415ef415a>
</fields>
</hash_0301023eb92bb845b9660a7445cf9740726522>
<hash_20010266d35da8f75c912ede3dbe901fedcae0>
<name>1 Minute Collection</name>
<step>60</step>
<heartbeat>600</heartbeat>
<x_files_factor>0.5</x_files_factor>
<default>on</default>
<cf_items>1|2|3|4</cf_items>
<items>
<item_000>
<name>Daily (1 Minute Average)</name>
<steps>1</steps>
<rows>2900</rows>
<timespan>86400</timespan>
</item_000>
<item_001>
<name>Weekly (15 Minute Average)</name>
<steps>15</steps>
<rows>1400</rows>
<timespan>604800</timespan>
</item_001>
<item_002>
<name>Monthly (1 Hour Average)</name>
<steps>60</steps>
<rows>1465</rows>
<timespan>2618784</timespan>
</item_002>
<item_003>
<name>Yearly (4 Hour Average)</name>
<steps>240</steps>
<rows>4380</rows>
<timespan>31536000</timespan>
</item_003>
</items>
</hash_20010266d35da8f75c912ede3dbe901fedcae0>
</cacti>%
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: Template Creation Hack? (Is this possible)

Post by macan »

You can copy and modify xml but it is only part of thing what you have to do.

Have a look at our documentation, section howto.
https://docs.cacti.net/
There is described, how to create templates and data queries and data input method.
You need to create similar templates like existing. You can copy templates but you have to change few things.
Let the Cacti grow!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest