Time for action – adding a single device to Cacti
Logon to your Cacti system.
Change to the Cacti CLI directory:
cd /var/www/html/cacti/cli
Execute the following command:
php add_device.php
You will see a list of all available options. Here you can see a short summary of these:
Let's assume that you are using a global SNMP community which you have defined in the General section on the Cacti settings page. Then you can add a device using the following syntax:
php add_device.php --ip="192.168.178.53" --description="myCLIDevice" --template=1
This will add a
"Generic SNMP-enabled host"
to Cacti as seen in the following image:
What just happened?
You just added a new device using the Cacti CLI. You can now build an import script for adding a list of devices into Cacti.
Importing a list of devices into Cacti
Let's now look at the import script. The following code is parsing a special import file containing the device description, IP, SNMP version, community, and host template:
$import_file = ...