fields_host_edit method on config_form

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

Post Reply
Rno
Cacti Pro User
Posts: 704
Joined: Wed Dec 07, 2011 9:19 am

fields_host_edit method on config_form

Post by Rno »

Hello guys,
On a extension of the config_form of all device, I have a drop_sql method (that part works).
This field in the DB is populated automatically when my discovery process find a equipment. It's almost like automation, but using only CDP and SNMP call to gather all the info of the device, and I get the serial number and the device type.

But sometime, old switch, the OID dosen't exist or can't be read. So I'd like to offer the possibility to the user to fill the fields_host_edit with his own value; when he edit a device.

Is their a possibility to do that ?

here my fields_host_edit add on (partial code):

Code: Select all

			$fields_host_edit3['extenddb_header'] = array(
				'friendly_name' => __('Extend DB'),
				'method' => 'spacer',
				'collapsible' => 'true'
			);
			$fields_host_edit3['serial_no'] = array(
				'method' => 'drop_sql',
				'friendly_name' => 'Serial No',
				'description' => 'Enter the serial number.',
				'max_length' => 50,
				'value' => '|arg1:serial_no|',
				'sql' => 'SELECT id, serial_no AS name FROM plugin_extenddb_host_serial_no WHERE host_id="|arg1:id|"',
				'default' => '',
			);
			$fields_host_edit3['model'] = array(
				'friendly_name' => 'Model',
				'description' => 'This is the model of equipement.',
				'method' => 'drop_sql',
				'max_length' => 50,
				'value' => '|arg1:model|',
				'sql' => 'SELECT id, model AS name FROM plugin_extenddb_host_model WHERE host_id="|arg1:id|"',
				'default' => '',
			);

Test
Almalinux
php 8.2.14
mariadb 10.6.16
Cacti 1.2.27
Spine 1.2.27
RRD 1.7.2
thold 1.8
monitor 2.5
syslog 3.2
flowview: 3.3
weathermap 1.0 Beta
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: fields_host_edit method on config_form

Post by TheWitness »

Sounds like a feature request.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests