Skip to content

Instantly share code, notes, and snippets.

@keeth
Last active Sep 17, 2019
Embed
What would you like to do?
Non-interactive install of Cacti 1.1.23 + Spine 1.1.23 on Ubuntu Server LTS 16.04 EC2 (via Cloud Init / Terraform)
#cloud-config
write_files:
-
content: |
[mysqld]
max_heap_table_size=64M
tmp_table_size=64M
join_buffer_size=64M
innodb_doublewrite=OFF
innodb_buffer_pool_size=242M
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
path: /etc/mysql/mysql.conf.d/mysqld.cacti.cnf
-
content: |
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /opt/cacti
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Location />
require all granted
</Location>
</VirtualHost>
path: /etc/apache2/sites-available/cacti.conf
-
content: |
DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass cactiuser
DB_Port 3306
path: /etc/spine.conf
runcmd:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq
- echo debconf mysql-server/root_password password root | sudo debconf-set-selections
echo debconf mysql-server/root_password_again password root | sudo debconf-set-selections
- DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server apache2 php php7.0-mysql libapache2-mod-php php-xml php-ldap php-mbstring php-gd php-snmp php-gmp rrdtool snmp snmpd librrds-perl
- wget http://www.cacti.net/downloads/cacti-1.1.23.tar.gz
- tar xvzf cacti-1.1.23.tar.gz
- mv cacti-1.1.23 /opt/cacti
- rm cacti-1.1.23.tar.gz
- mysqladmin --user=root --password=root create cacti
- mysql --user=root --password=root cacti < /opt/cacti/cacti.sql
- mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root --password=root mysql
- echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser'" | mysql -u root --password=root mysql
- echo "GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost IDENTIFIED BY 'cactiuser';" | mysql -u root --password=root mysql
- touch /opt/cacti/log/cacti.log
- chown -R www-data:www-data /opt/cacti/resource/snmp_queries
- chown -R www-data:www-data /opt/cacti/resource/script_server
- chown -R www-data:www-data /opt/cacti/resource/script_queries
- chown -R www-data:www-data /opt/cacti/scripts
- chown -R www-data:www-data /opt/cacti/rra/ /opt/cacti/log/
- chown -R www-data:www-data /opt/cacti/cache/mibcache
- chown -R www-data:www-data /opt/cacti/cache/realtime
- chown -R www-data:www-data /opt/cacti/cache/spikekill
- chown -R www-data:www-data /opt/cacti/cache/boost
- sed -i "s,'/cacti/','/'," /opt/cacti/include/config.php
- rm /etc/apache2/sites-enabled/*
- a2ensite cacti.conf
- service apache2 restart
- echo '*/5 * * * * www-data php /opt/cacti/poller.php > /dev/null 2>&1' >> /etc/crontab
- DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libssl-dev libc6-dev libmysqlclient-dev make libsnmp-dev libtool-bin help2man
- wget http://www.cacti.net/downloads/spine/cacti-spine-1.1.23.tar.gz
- tar xzvf cacti-spine-1.1.23.tar.gz
- cd cacti-spine-1.1.23 && ./configure && make install && cd ..
- rm cacti-spine-1.1.23.tar.gz
- cd /opt/cacti/plugins && git clone -b develop https://github.com/Cacti/plugin_thold thold
* Cacti is installed to root URL '/' not '/cacti'
* PHP 7 and MySQL 5.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment