Cacti 0.8 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – importing a template

  1. Start you web browser and go to http://forums.cacti.net/about9861.html. This is the topic on the forum containing all the links which we will be using later within this section. If the download links do not work, check back to this page and look for the new download links.
  2. Download the XML file named cacti087b_host_template_webserver_-_apache.xml from the first post and save it to your desktop.
  3. Logon to your Cacti server.
  4. Go to your Cacti installation and navigate to the scripts directory. On CentOS the command is:
    cd /var/www/html/cacti/scripts
    
  5. Download the third file to that directory:
    wget http://forums.cacti.net/download/file.php?id=9907
    
  6. Rename the downloaded file to ws_apachestats.pl.gz:
    mv download.php\?id\=9907 ws_apachestats.pl.gz
    
  7. Unzip the file:
    gunzip ws_apachestats.pl.gz
    
  8. Now logon to your Cacti installation.
  9. Go to Import/Export | Import Templates.
    Time for action – importing a template
  10. Select the XML file from your desktop and click on the Import button. You will see some status information as well as the templates, data input methods, and other items that have been imported to your Cacti system.
    Time for action – importing a template

What just happened?

As in the preceding example, a template may not always consist of XML files, but may also have an associated script that needs to be added to the Cacti installation. The template you just imported contained such a script. You have downloaded, renamed, and extracted it into the scripts directory. This directory contains all the scripts being used within data input methods.

You then imported the XML file for the host template WebServer - Apache. The XML file contained all of the definitions for the necessary graph templates and input methods needed for Cacti to graph the data.

The imported host template can now be used and assigned to the devices. As with all external files, make sure you read and follow the corresponding readme files or installation instructions.

If you have done everything correctly, you should see the following graph after a few polling cycles:

What just happened?

Exporting templates

Exporting a template allows users to share their hard work in creating these templates with the Cacti community. The export mechanism only exports the graph, host, or data template definitions, but not the scripts that are necessary for some of the data input methods. SNMP-based templates do not need scripts so these are exported complete.