Time for action – adding additional fields to the host table

Besides the country information, the plugin is also going to store the site and room information. You're not going to store this information in a new table, but will instead add new columns to the existing host table. Let's look at how you can do this. You're going to use Example 2 for this. As a preparation, you should now disable and uninstall the plugin from Example 1.

  1. Open the setup.php file from Example 2.
  2. Go to the cbEnhancedInfo_setup_table_new function.
  3. Search for the following code:
       /* The additional columns are missing here --->*/
       /* <--- */
  4. Between these two lines, enter the following code:
    api_plugin_db_add_column ('cbEnhancedInfo', 'host', array('name' => 'ebEnhancedInfo_country', ...

Get Cacti 0.8 Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.