<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Femur</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Femur"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Femur"/>
	<updated>2026-05-07T05:39:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Cacti:_traffic_analysis_and_monitoring_network&amp;diff=18111</id>
		<title>Cacti: traffic analysis and monitoring network</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Cacti:_traffic_analysis_and_monitoring_network&amp;diff=18111"/>
		<updated>2020-10-18T16:07:50Z</updated>

		<summary type="html">&lt;p&gt;Femur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cacti is a complete network monitoring and data analyzing solution using RRDTool&#039;s data storage and graphing functionality. It is the most widely used monitoring tool by ISPs to see graphically the network.&lt;br /&gt;
&lt;br /&gt;
== Dedicated host pre configuration ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cacti have very special and fixed requirements&#039;&#039;&#039; from the host, so for production systems must be installed on a dedicated host machine.&lt;br /&gt;
&lt;br /&gt;
{{Note|here we use &amp;quot;venenux.net&amp;quot; as domain.. please change to your domain.. if you are installing locally just change to &amp;quot;localdomain&amp;quot; and that&amp;lt;nowiki&amp;gt;&#039;&amp;lt;/nowiki&amp;gt;s all}}&lt;br /&gt;
&lt;br /&gt;
=== Hostname setup ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
hostname monitor&lt;br /&gt;
&lt;br /&gt;
echo &#039;hostname=&amp;quot;monitor&amp;quot;&#039; &amp;gt; /etc/conf.d/hostname &lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;monitor&amp;quot; &amp;gt; /etc/hostname&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/hosts &amp;lt;&amp;lt; EOF&lt;br /&gt;
127.0.0.1 monitor.venenux.net monitor localhost.localdomain localhost&lt;br /&gt;
151.101.128.249 dl-cdn.alpinelinux.org&lt;br /&gt;
::1 localhost localhost.localdomain&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added as plus the ip address of cdn Alpine Linux to avoid more packets from a DNS server.&lt;br /&gt;
&lt;br /&gt;
=== Repositories and packages ===&lt;br /&gt;
&lt;br /&gt;
Unfortunately some commands are more complex, we must take in consideration that common commands are just busybox minimalist versions, so we must change it to normal ones, first be sure there are a bash real package also some others, if not, Catci will fail randomly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add bash attr dialog binutils findutils readline lsof less nano curl&lt;br /&gt;
&lt;br /&gt;
export PAGER=less&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
http://uk.alpinelinux.org/alpine/edge/main&lt;br /&gt;
http://uk.alpinelinux.org/alpine/edge/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add utmps&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take in consideration that if one package are retrieved from edge.. must be only that package! not all the packages, so first install all the dependencies and related ones from normal repository and later only the required extra from edge! so for that you must visit https://pkgs.alpinelinux.org/packages and search all the requirements of the involved package from edge.. like &amp;lt;code&amp;gt;utmps&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Cacti before install and configure must need pre setup of many others packages.&lt;br /&gt;
&lt;br /&gt;
* A web server like &#039;&#039;lighttpd&#039;&#039;&lt;br /&gt;
* The &#039;&#039;PHP&#039;&#039; scripting support&lt;br /&gt;
* A database engine like &#039;&#039;mariadb&#039;&#039;&lt;br /&gt;
* To retreive data the &#039;&#039;net-snmp&#039;&#039; tools&lt;br /&gt;
* To graphics the data the &#039;&#039;rrdtool&#039;&#039; package&lt;br /&gt;
&lt;br /&gt;
{{Warning|These complex configurations &#039;&#039;&#039;will be necessary&#039;&#039;&#039;, as Cacti is demanding in its requirements once installed to right functionality.}}&lt;br /&gt;
&lt;br /&gt;
=== The web server: Lighttpd installation and configuration ===&lt;br /&gt;
&lt;br /&gt;
Cacti runs as a web program, so we need the web server configured, due apache2 are so famous we only will document the lighttpd, because for more used options there&#039;s already so much info:&lt;br /&gt;
&lt;br /&gt;
* setup port, cache engine, event handler of the lighttpd, with the htdocs place&lt;br /&gt;
* setup status page of the web server&lt;br /&gt;
* setup alias mod for aliasing, cgi handler, and make the directory places with right permissions&lt;br /&gt;
* setup start script of the webserver and start the webserver to test&lt;br /&gt;
* added network back-end handler, file descriptor setup and improve time retrieving of file cache&lt;br /&gt;
* setup https and generate self signed certificate&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add lighttpd gamin&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs&lt;br /&gt;
sed -i -r &#039;s#\#.*server.port.*=.*#server.port          = 80#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*server.stat-cache-engine.*=.*# server.stat-cache-engine = &amp;quot;fam&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*server.event-handler = &amp;quot;linux-sysepoll&amp;quot;.*#server.event-handler = &amp;quot;linux-sysepoll&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs/serverinfo&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_status.*,.*#    &amp;quot;mod_status&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*status.status-url.*=.*#status.status-url  = &amp;quot;/serverinfo/server-status&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*status.config-url.*=.*#status.config-url  = &amp;quot;/serverinfo/server-config&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/lib/lighttpd&lt;br /&gt;
chown -R lighttpd:lighttpd /var/www/localhost/&lt;br /&gt;
chown -R lighttpd:lighttpd /var/lib/lighttpd&lt;br /&gt;
chown -R lighttpd:lighttpd /var/log/lighttpd&lt;br /&gt;
&lt;br /&gt;
rc-update add lighttpd default&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;noatime&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings&amp;quot;\nserver.use-noatime = &amp;quot;enable&amp;quot;\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;network-backend&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings&amp;quot;\nserver.network-backend = &amp;quot;linux-sendfile&amp;quot;\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;max-fds&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings\nserver.max-fds = 2048\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|Next steps are &#039;&#039;&#039;recommended&#039;&#039;&#039; but optional, it able to use only https to all the traffic between the host monitor of cacti and the rest of monitoring devices! Cacti should only be accessed over TLS (https) otherwise will exposes passwords and user data. This steps will generate a self signed cert file that will require to accept custom exception on the web browser but all the traffic will be over TLS/SSL as of https.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add openssl&lt;br /&gt;
&lt;br /&gt;
mkdir -p /etc/ssl/certs/&lt;br /&gt;
&lt;br /&gt;
openssl req -x509 -days 1460 -nodes -newkey rsa:4096 \&lt;br /&gt;
   -subj &amp;quot;/C=VE/ST=Bolivar/L=Upata/O=VenenuX/OU=Systemas:hozYmartillo/CN=localhost&amp;quot; \&lt;br /&gt;
   -keyout /etc/ssl/certs/localhost.pem -out /etc/ssl/certs/localhost.pem&lt;br /&gt;
&lt;br /&gt;
chmod 755 /etc/ssl/certs/localhost.pem&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_ssl.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += (&amp;quot;mod_openssl&amp;quot;)&lt;br /&gt;
\$SERVER[&amp;quot;socket&amp;quot;] == &amp;quot;0.0.0.0:443&amp;quot; {&lt;br /&gt;
    ssl.engine  = &amp;quot;enable&amp;quot;&lt;br /&gt;
    ssl.pemfile = &amp;quot;/etc/ssl/certs/localhost.pem&amp;quot;&lt;br /&gt;
    ssl.cipher-list = &amp;quot;ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM&amp;quot;&lt;br /&gt;
    ssl.honor-cipher-order = &amp;quot;enable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
\$HTTP[&amp;quot;scheme&amp;quot;] == &amp;quot;http&amp;quot; {&lt;br /&gt;
    \$HTTP[&amp;quot;host&amp;quot;] =~ &amp;quot;.*&amp;quot; {&lt;br /&gt;
        url.redirect = (&amp;quot;.*&amp;quot; =&amp;gt; &amp;quot;https://%0\$0&amp;quot;)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_redirect.*,.*#    &amp;quot;mod_redirect&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
itawxrc=&amp;quot;&amp;quot;;itawxrc=$(grep &#039;include &amp;quot;mod_ssl.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$itawxrc&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || \&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mime-types.conf&amp;quot;.*#include &amp;quot;mime-types.conf&amp;quot;\ninclude &amp;quot;mod_ssl.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#ssl.pemfile.*=.*#ssl.pemfile   = &amp;quot;/etc/ssl/certs/localhost.pem&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The PHP: installation and configurations ===&lt;br /&gt;
&lt;br /&gt;
Next requirement are the PHP scripting Lang, because Cacti are build with PHP, and has support for LDAP also.&lt;br /&gt;
&lt;br /&gt;
{{Note|Cacti supports PHP5 and PHP7, in next section we will only cover PHP7 because are the only available at recent Alpine versions, but if you use any older Alpine host for testing, you can use this command to detect what to install &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;export phpmax=$(debver=$(cat /etc/alpine-release|cut -d &#039;.&#039; -f1);[ $debver -ge 6 ] &amp;amp;&amp;amp; echo  7|| echo 5)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, the shel var &amp;lt;code&amp;gt;phpmax&amp;lt;/code&amp;gt; indicates based on Alpine version if 5 or 7 php will be used in command lines as: &amp;lt;code&amp;gt;apk add php$phpmax&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
The commit that mess all are https://git.alpinelinux.org/aports/commit/community/cacti/cacti.php-fpm.conf?id=4272e802a1be191657becb739e6a248c1d0411a7 where a specific pool for php-fpm are made for cacti.. this its a mess due are not documented.. so we must avoid and ignored that due are undocumented and property configured the general pool:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
apk add php7-fpm php7-bcmath php7-bz2 php7-ctype php7-curl php7-dom \&lt;br /&gt;
 php7-enchant php7-exif php7-gd php7-gettext php7-gmp php7-iconv \&lt;br /&gt;
 php7-imap php7-intl php7-json php7-mbstring php7-opcache php7-openssl \&lt;br /&gt;
 php7-phar php7-posix php7-pspell php7-recode php7-session php7-simplexml \&lt;br /&gt;
 php7-sockets php7-sysvmsg php7-sysvsem php7-sysvshm php7-tidy php7-tokenizer \&lt;br /&gt;
 php7-xml php7-xmlreader php7-xmlrpc php7-xmlwriter php7-xsl php7-zip php7-sqlite3 \&lt;br /&gt;
 php7-gd php7-gmp php7-ldap php7-openssl php7-pdo_mysql php7-posix php7-sockets php7-xml&lt;br /&gt;
&lt;br /&gt;
apk add php7-pdo php7-pdo_mysql php7-mysqli php7-pdo_sqlite php7-sqlite3 \&lt;br /&gt;
 php7-odbc php7-pdo_odbc php7-dba&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following configurations are for high or huge loads on a 2G RAM server, for more information about configuring PHP on Alpine Linux see [[Production LAMP system: Lighttpd + PHP + MySQL]] wiki page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i -r &#039;s|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*safe_mode =.*#safe_mode = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*expose_php =.*#expose_php = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#memory_limit =.*#memory_limit = 512M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#upload_max_filesize =.*#upload_max_filesize = 56M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#post_max_size =.*#post_max_size = 128M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^file_uploads =.*#file_uploads = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_file_uploads =.*#max_file_uploads = 12#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^allow_url_fopen = .*#allow_url_fopen = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.default_charset =.*#default_charset = &amp;quot;UTF-8&amp;quot;#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.max_execution_time =.*#max_execution_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_input_time =.*#max_input_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*date.timezone =.*#date.timezone = America/Panama#g&#039; /etc/php*/php.ini&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|.*events.mechanism =.*|events.mechanism = epoll|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*emergency_restart_threshold =.*|emergency_restart_threshold = 12|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*emergency_restart_interval =.*|emergency_restart_interval = 1m|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*process_control_timeout =.*|process_control_timeout = 8s|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_requests =.*|pm.max_requests = 10000|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_children =.*|pm.max_children = 12|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.start_servers =.*|pm.start_servers = 4|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.min_spare_servers =.*|pm.min_spare_servers = 4|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_spare_servers =.*|pm.max_spare_servers = 8|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.process_idle_timeout =.*|pm.process_idle_timeout = 8s|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm =.*|pm = ondemand|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/run/php-fpm7/&lt;br /&gt;
&lt;br /&gt;
chown lighttpd:root /var/run/php-fpm7&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^pid =.*|pid = /run/php-fpm7/php7-fpm.pid|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s#^user =.*#user = lighttpd#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^group =.*#group = lighttpd#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner =.*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group =.*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode =.*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add php-fpm7 default&lt;br /&gt;
&lt;br /&gt;
service php-fpm7 restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After have php ready, lest integrate into the current preinstalled web server, we already choose lighttpd so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = (&lt;br /&gt;
    &amp;quot;.php&amp;quot; =&amp;gt; (&lt;br /&gt;
      &amp;quot;localhost&amp;quot; =&amp;gt; (&lt;br /&gt;
        &amp;quot;socket&amp;quot;                =&amp;gt; &amp;quot;/var/run/php-fpm7/php7-fpm.sock&amp;quot;,&lt;br /&gt;
        &amp;quot;broken-scriptfilename&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
      ))&lt;br /&gt;
)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /var/run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test PHP are working correctly, browse the web server with &amp;lt;code&amp;gt;http://ipaddress/info.php&amp;lt;/code&amp;gt; of course change &amp;quot;ipaddrs&amp;quot; with the ip of the web server.&lt;br /&gt;
&lt;br /&gt;
=== The Database: MariaDB installation and configuration ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|Cacti also can run with PostgreSQL, inclusivelly are a better choice for high production and huge data systems, but we documented here mysql only due postgresql need more complex tunning parameters}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Also can install &#039;&#039;&#039;adminer to manage the database&#039;&#039;&#039; using web browsing, see [[Production LAMP system: Lighttpd + PHP + MySQL#adminer:_Web_Frontend_administration|Adminer in production LAMP systems]] that can manage any kind of database graphically}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add mysql mysql-client tzdata&lt;br /&gt;
&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-highload.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
max_heap_table_size = 32M&lt;br /&gt;
tmp_table_size      = 32M&lt;br /&gt;
join_buffer_size    = 62M&lt;br /&gt;
innodb_file_format  = Barracuda&lt;br /&gt;
innodb_large_prefix = 1&lt;br /&gt;
innodb_buffer_pool_size = 512M&lt;br /&gt;
innodb_flush_log_at_timeout = 3&lt;br /&gt;
innodb_read_io_threads  = 32&lt;br /&gt;
innodb_buffer_pool_instances = 1&lt;br /&gt;
innodb_io_capacity     = 5000&lt;br /&gt;
innodb_io_capacity_max = 10000&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&lt;br /&gt;
rc-update add mariadb default&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After those commands runs the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; script and answer as follows:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; must be provided due we already set previously. correct respond are &amp;lt;code&amp;gt;OK, successfully used password, moving on...&amp;lt;/code&amp;gt;&lt;br /&gt;
#  &#039;&#039;&#039;Switch to unix_socket authentication [Y/n]&#039;&#039;&#039; this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &amp;lt;code&amp;gt;... skipping.&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Change the root password? [Y/n]&#039;&#039;&#039; Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just change it!&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Disallow root login remotely? [Y/n]&#039;&#039;&#039; For sure answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Remove test database and access to it? [Y/n]&#039;&#039;&#039; Should be removed, so answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Reload privilege tables now? [Y/n]&#039;&#039;&#039; Aanswer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tools: net-snmp and rrdtool ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|do no set &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;agentAddress tcp:161,tcp6:[::1]:161&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, seems by default the package added the udp 161 protocol, so if you made it, will only listen and show info using ipv6 only}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add net-snmp net-snmp-tools rrdtool&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/snmp/snmpd.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.1&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.25.1&lt;br /&gt;
rocommunity  public localhost&lt;br /&gt;
rocommunity  public default -V systemonly&lt;br /&gt;
sysLocation    Bolivar Upata Venezuela&lt;br /&gt;
sysContact     infoadmin &amp;lt;info@pacificnetwork.com&amp;gt;&lt;br /&gt;
sysServices    72&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-update add snmpd default&lt;br /&gt;
&lt;br /&gt;
rc-service snmpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this we only neet the commands for cacti, but for more info about the topic see:&lt;br /&gt;
&lt;br /&gt;
* [[Setting_up_traffic_monitoring_using_rrdtool_(and_snmp)]]&lt;br /&gt;
* [[Setting_up_monitoring_using_rrdtool_(and_rrdcollect)]]&lt;br /&gt;
* [[Setting_up_A_Network_Monitoring_and_Inventory_System]]&lt;br /&gt;
&lt;br /&gt;
== Cacti Installation ==&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.12, Cacti still are in edge branch, so we first pre-install the depends packages and later only from edge the cacti alone.&lt;br /&gt;
&lt;br /&gt;
=== Installing Cacti Packages ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|As of Alpine 3.5, Cacti was a only one package &amp;quot;cacti&amp;quot;, since alpine 3.6, cacti package are split in more packages. The commit that mess all are where a specific pool for php-fpm are made for cacti.. this its a mess due are not documented.. so we must avoid and ignored that due are undocumented and property configured the general pool.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add bash busybox coreutils net-snmp-tools perl rrdtool ttf-dejavu php7-snmp&lt;br /&gt;
&lt;br /&gt;
apk add cacti cacti-setup cacti-php7 cacti-lang&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cacti pre Configuration ==&lt;br /&gt;
&lt;br /&gt;
Cacti are run under cacti user, we temporally set all world write permissions to the files and later fix the permissions access.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_cacti.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/cacti/&amp;quot;	    =&amp;gt;    &amp;quot;/usr/share/webapps/cacti/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
\$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/cacti/&amp;quot; {&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_accesslog.*,.*#    &amp;quot;mod_accesslog&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_setenv.*,.*#    &amp;quot;mod_setenv&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkssl=&amp;quot;&amp;quot;;checkssl=$(grep &#039;include &amp;quot;mod_cacti.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkssl&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#include &amp;quot;mod_cgi.conf&amp;quot;\ninclude &amp;quot;mod_cacti.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cacti runs under cacti user, but web server user (apache2, lighttpd) also needs access, so enable group access and as we said, temporally write world permissions:&lt;br /&gt;
&lt;br /&gt;
# grant temporally access to the web server&lt;br /&gt;
# Create the cacti database and populate it&lt;br /&gt;
# Grant Cacti MySQL user access (give it a more secure password):&lt;br /&gt;
# Quit from Mysql command prompt:&lt;br /&gt;
# Import the initial Cacti MySQL database&lt;br /&gt;
# set the user, pass, and db name to the cacti config file&lt;br /&gt;
# grant temporally world permission over log and lib directories of cacti&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
chown -R cacti:lighttpd /usr/share/webapps/cacti/;chown -R cacti:lighttpd /var/lib/cacti/&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;CREATE DATABASE cacti;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT ALL ON cacti.* TO &#039;cactiuser&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;cactipassword&#039;;FLUSH PRIVILEGES;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT GRANT OPTION ON cacti.* TO &#039;cactiuser&#039;@&#039;localhost&#039;;FLUSH PRIVILEGES;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT SELECT ON mysql.time_zone_name TO &#039;cactiuser&#039;@&#039;localhost&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql --user=cactiuser -p cactipassword cacti &amp;lt; /usr/share/webapps/cacti/cacti.sql&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\$database_default.*=.*;#\$database_default  = &#039;cacti&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
sed -i -r &#039;s#\$database_username.*=.*;#\$database_username  = &#039;cactiuser&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
sed -i -r &#039;s#\$database_password.*=.*;#\$database_password  = &#039;cactipassword&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
&lt;br /&gt;
chmod 777 /var/log/cacti&lt;br /&gt;
chmod 666 /var/log/cacti/*.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cacti web setup install ===&lt;br /&gt;
&lt;br /&gt;
Login using:&lt;br /&gt;
 Password= admin user= admin&lt;br /&gt;
Next will be prompted to change password:&lt;br /&gt;
 change password.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the web page click:&lt;br /&gt;
: -&amp;gt; Next&lt;br /&gt;
Then select new install in case is not selected:&lt;br /&gt;
: -&amp;gt; New install, Next&lt;br /&gt;
&lt;br /&gt;
{{Warning|take note since cacti 1.2.8 and still at cacti 1.2.10, installer have several errors for &amp;lt;code&amp;gt;Cacti_Stats.xml.gz&amp;lt;/code&amp;gt; template, so lasted &amp;quot;check&amp;quot; have no description you must uncheck last as pointed here: https://github.com/Cacti/cacti/issues/3313#issuecomment-594114681 This template can be installed later with cli as: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;php -d max_execution_time=90 /usr/share/webapps/cacti/cli/import_package.php&lt;br /&gt;
 --filename=Cacti_Stats.xml.gz&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; under the templates directory of cacti install, but currently it hangs and never install it. Reported at https://github.com/Cacti/cacti/issues/3313#issuecomment-601508135 }}&lt;br /&gt;
&lt;br /&gt;
Then finish&lt;br /&gt;
: -&amp;gt; Finish&lt;br /&gt;
Add to crontab:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cacti post Configuration ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
chmod 775 /var/log/cacti&lt;br /&gt;
chmod 664 /var/log/cacti/*.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pooler and crontab ===&lt;br /&gt;
&lt;br /&gt;
As we said, cacti need a crontab for pool collection of data!, this steps are not necesary since Alpine 3.7 due cacti package already install all necesary files.&lt;br /&gt;
&lt;br /&gt;
{{Note|This steps are only for older cacti packages of Alpine until 3.6, since 3.7 cacti packages already install crontab for oll collection of data}}&lt;br /&gt;
&lt;br /&gt;
 cd /etc/crontabs&lt;br /&gt;
 vi root&lt;br /&gt;
copy to the end of the file:&lt;br /&gt;
 */5 * * * * lighttpd php /var/www/localhost/htdocs/cacti/poller.php &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
In case you are using other web server have to modify the &amp;quot;lighttpd&amp;quot; user.&lt;br /&gt;
 */5 * * * * &amp;quot;web server user&amp;quot; php /var/www/localhost/htdocs/cacti/poller.php &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add your devices and you&#039;re ready to start monitoring!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== cacti plugins ===&lt;br /&gt;
&lt;br /&gt;
If you used lasted cacti must use lasted develop version of each plugins specially if use php7 in webserver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cd /usr/share/webapps/cacti/plugins/&lt;br /&gt;
&lt;br /&gt;
wget https://github.com/Cacti/plugin_mikrotik/archive/master.tar.gz -O cacti-1.2.11-plugin-monitor.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_gexport/archive/master.tar.gz -O cacti-1.2.11-plugin-gexport.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_routerconfigs/archive/master.tar.gz -O cacti-1.2.11-plugin-routerconfigs.tar.g&lt;br /&gt;
wget https://github.com/Cacti/plugin_monitor/archive/master.tar.gz cacti-1.2.11-plugin-reportit.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_reportit/archive/master.tar.gz -O cacti-1.2.11-plugin-reportit.tar.gz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After extract all, change and fix permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cd /usr/share/webapps/cacti/plugins/&lt;br /&gt;
&lt;br /&gt;
chown -R cacti:lighttpd /usr/share/webapps/cacti/&lt;br /&gt;
&lt;br /&gt;
chown -R cacti:lighttpd /var/lib/cacti/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An go to cacti configuration and plugins in the web interface to enable and install all of them.&lt;br /&gt;
&lt;br /&gt;
== Cacti Re installation ==&lt;br /&gt;
&lt;br /&gt;
Lest suppose you mess all and want to reinstall all from zero, lest get started:&lt;br /&gt;
&lt;br /&gt;
=== Erase all cacti related ===&lt;br /&gt;
&lt;br /&gt;
# erase and remove packages installed&lt;br /&gt;
# erase and remove configurations and files&lt;br /&gt;
# erase and remove databases and users from mysql/postgresql (here only mysql as example)&lt;br /&gt;
# reconfigure to do not load the cacti web server configurations&lt;br /&gt;
# restart services due cacti pool was erased and lighttpd must reload config files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk del cacti cacti-setup cacti-php7 cacti-lang&lt;br /&gt;
&lt;br /&gt;
rm -rf /var/log/cacti&lt;br /&gt;
&lt;br /&gt;
rm -rf /usr/share/webapps/cacti&lt;br /&gt;
&lt;br /&gt;
rm -rf /etc/cacti&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;DROP DATABASE cacti;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;DROP USER &#039;cactiuser&#039;@&#039;localhost&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;/include \&amp;quot;mod_cacti.conf\&amp;quot;/d&amp;quot; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all of these steps, repeat all the steps from [[Cacti:_traffic_analysis_and_monitoring_network#Cacti_Installation|Cacti_Installation section]].&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* https://qgqlochekone.blogspot.com/2020/03/cacti-on-alpine-host-install-traffic.html&lt;br /&gt;
* [[Setting_up_traffic_monitoring_using_rrdtool_(and_snmp)]]&lt;br /&gt;
* [[Setting_up_monitoring_using_rrdtool_(and_rrdcollect)]]&lt;br /&gt;
* [[Setting_up_A_Network_Monitoring_and_Inventory_System]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&lt;br /&gt;
* [[Production Lets Encrypt: dehydrated]]&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
* [[Alpine newbie lammers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web_Server]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Femur</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Cacti:_traffic_analysis_and_monitoring_network&amp;diff=18110</id>
		<title>Cacti: traffic analysis and monitoring network</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Cacti:_traffic_analysis_and_monitoring_network&amp;diff=18110"/>
		<updated>2020-10-18T16:03:27Z</updated>

		<summary type="html">&lt;p&gt;Femur: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cacti is a complete network monitoring and data analyzing solution using RRDTool&#039;s data storage and graphing functionality. It is the most widely used monitoring tool by ISPs to see graphically the network.&lt;br /&gt;
&lt;br /&gt;
== Dedicated host pre configuration ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Cacti have very special and fixed requirements&#039;&#039;&#039; from the host, so for production systems must be installed on a dedicated host machine.&lt;br /&gt;
&lt;br /&gt;
{{Note|here we use &amp;quot;venenux.net&amp;quot; as domain.. please change to your domain.. if you are installing locally just change to &amp;quot;localdomain&amp;quot; and that&amp;lt;nowiki&amp;gt;&#039;&amp;lt;/nowiki&amp;gt;s all}}&lt;br /&gt;
&lt;br /&gt;
=== Hostname setup ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
hostname monitor&lt;br /&gt;
&lt;br /&gt;
echo &#039;hostname=&amp;quot;monitor&amp;quot;&#039; &amp;gt; /etc/conf.d/hostname &lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;monitor&amp;quot; &amp;gt; /etc/hostname&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/hosts &amp;lt;&amp;lt; EOF&lt;br /&gt;
127.0.0.1 monitor.venenux.net monitor localhost.localdomain localhost&lt;br /&gt;
151.101.128.249 dl-cdn.alpinelinux.org&lt;br /&gt;
::1 localhost localhost.localdomain&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We added as plus the ip address of cdn Alpine Linux to avoid more packets from a DNS server.&lt;br /&gt;
&lt;br /&gt;
=== Repositories and packages ===&lt;br /&gt;
&lt;br /&gt;
Unfortunately some commands are more complex, we must take in consideration that common commands are just busybox minimalist versions, so we must change it to normal ones, first be sure there are a bash real package also some others, if not, Catci will fail randomly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add bash attr dialog binutils findutils readline lsof less nano curl&lt;br /&gt;
&lt;br /&gt;
export PAGER=less&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
http://uk.alpinelinux.org/alpine/edge/main&lt;br /&gt;
http://uk.alpinelinux.org/alpine/edge/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add utmps&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take in consideration that if one package are retrieved from edge.. must be only that package! not all the packages, so first install all the dependencies and related ones from normal repository and later only the required extra from edge! so for that you must visit https://pkgs.alpinelinux.org/packages and search all the requirements of the involved package from edge.. like &amp;lt;code&amp;gt;utmps&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
Cacti before install and configure must need pre setup of many others packages.&lt;br /&gt;
&lt;br /&gt;
* A web server like &#039;&#039;lighttpd&#039;&#039;&lt;br /&gt;
* The &#039;&#039;PHP&#039;&#039; scripting support&lt;br /&gt;
* A database engine like &#039;&#039;mariadb&#039;&#039;&lt;br /&gt;
* To retreive data the &#039;&#039;net-snmp&#039;&#039; tools&lt;br /&gt;
* To graphics the data the &#039;&#039;rrtool&#039;&#039; package&lt;br /&gt;
&lt;br /&gt;
{{Warning|These complex configurations &#039;&#039;&#039;will be necessary&#039;&#039;&#039;, as Cacti is demanding in its requirements once installed to right functionality.}}&lt;br /&gt;
&lt;br /&gt;
=== The web server: Lighttpd installation and configuration ===&lt;br /&gt;
&lt;br /&gt;
Cacti runs as a web program, so we need the web server configured, due apache2 are so famous we only will document the lighttpd, because for more used options there&#039;s already so much info:&lt;br /&gt;
&lt;br /&gt;
* setup port, cache engine, event handler of the lighttpd, with the htdocs place&lt;br /&gt;
* setup status page of the web server&lt;br /&gt;
* setup alias mod for aliasing, cgi handler, and make the directory places with right permissions&lt;br /&gt;
* setup start script of the webserver and start the webserver to test&lt;br /&gt;
* added network back-end handler, file descriptor setup and improve time retrieving of file cache&lt;br /&gt;
* setup https and generate self signed certificate&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add lighttpd gamin&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs&lt;br /&gt;
sed -i -r &#039;s#\#.*server.port.*=.*#server.port          = 80#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*server.stat-cache-engine.*=.*# server.stat-cache-engine = &amp;quot;fam&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*server.event-handler = &amp;quot;linux-sysepoll&amp;quot;.*#server.event-handler = &amp;quot;linux-sysepoll&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/htdocs/serverinfo&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_status.*,.*#    &amp;quot;mod_status&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*status.status-url.*=.*#status.status-url  = &amp;quot;/serverinfo/server-status&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*status.config-url.*=.*#status.config-url  = &amp;quot;/serverinfo/server-config&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/lib/lighttpd&lt;br /&gt;
chown -R lighttpd:lighttpd /var/www/localhost/&lt;br /&gt;
chown -R lighttpd:lighttpd /var/lib/lighttpd&lt;br /&gt;
chown -R lighttpd:lighttpd /var/log/lighttpd&lt;br /&gt;
&lt;br /&gt;
rc-update add lighttpd default&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;noatime&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings&amp;quot;\nserver.use-noatime = &amp;quot;enable&amp;quot;\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;network-backend&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings&amp;quot;\nserver.network-backend = &amp;quot;linux-sendfile&amp;quot;\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkset=&amp;quot;&amp;quot;;checkset=$(grep &#039;max-fds&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkset&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; \&lt;br /&gt;
echo listo || sed -i -r &#039;s#server settings.*#server settings\nserver.max-fds = 2048\n#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Warning|Next steps are &#039;&#039;&#039;recommended&#039;&#039;&#039; but optional, it able to use only https to all the traffic between the host monitor of cacti and the rest of monitoring devices! Cacti should only be accessed over TLS (https) otherwise will exposes passwords and user data. This steps will generate a self signed cert file that will require to accept custom exception on the web browser but all the traffic will be over TLS/SSL as of https.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add openssl&lt;br /&gt;
&lt;br /&gt;
mkdir -p /etc/ssl/certs/&lt;br /&gt;
&lt;br /&gt;
openssl req -x509 -days 1460 -nodes -newkey rsa:4096 \&lt;br /&gt;
   -subj &amp;quot;/C=VE/ST=Bolivar/L=Upata/O=VenenuX/OU=Systemas:hozYmartillo/CN=localhost&amp;quot; \&lt;br /&gt;
   -keyout /etc/ssl/certs/localhost.pem -out /etc/ssl/certs/localhost.pem&lt;br /&gt;
&lt;br /&gt;
chmod 755 /etc/ssl/certs/localhost.pem&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_ssl.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += (&amp;quot;mod_openssl&amp;quot;)&lt;br /&gt;
\$SERVER[&amp;quot;socket&amp;quot;] == &amp;quot;0.0.0.0:443&amp;quot; {&lt;br /&gt;
    ssl.engine  = &amp;quot;enable&amp;quot;&lt;br /&gt;
    ssl.pemfile = &amp;quot;/etc/ssl/certs/localhost.pem&amp;quot;&lt;br /&gt;
    ssl.cipher-list = &amp;quot;ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM&amp;quot;&lt;br /&gt;
    ssl.honor-cipher-order = &amp;quot;enable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
\$HTTP[&amp;quot;scheme&amp;quot;] == &amp;quot;http&amp;quot; {&lt;br /&gt;
    \$HTTP[&amp;quot;host&amp;quot;] =~ &amp;quot;.*&amp;quot; {&lt;br /&gt;
        url.redirect = (&amp;quot;.*&amp;quot; =&amp;gt; &amp;quot;https://%0\$0&amp;quot;)&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_redirect.*,.*#    &amp;quot;mod_redirect&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
itawxrc=&amp;quot;&amp;quot;;itawxrc=$(grep &#039;include &amp;quot;mod_ssl.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$itawxrc&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || \&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mime-types.conf&amp;quot;.*#include &amp;quot;mime-types.conf&amp;quot;\ninclude &amp;quot;mod_ssl.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#ssl.pemfile.*=.*#ssl.pemfile   = &amp;quot;/etc/ssl/certs/localhost.pem&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The PHP: installation and configurations ===&lt;br /&gt;
&lt;br /&gt;
Next requirement are the PHP scripting Lang, because Cacti are build with PHP, and has support for LDAP also.&lt;br /&gt;
&lt;br /&gt;
{{Note|Cacti supports PHP5 and PHP7, in next section we will only cover PHP7 because are the only available at recent Alpine versions, but if you use any older Alpine host for testing, you can use this command to detect what to install &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;export phpmax=$(debver=$(cat /etc/alpine-release|cut -d &#039;.&#039; -f1);[ $debver -ge 6 ] &amp;amp;&amp;amp; echo  7|| echo 5)&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, the shel var &amp;lt;code&amp;gt;phpmax&amp;lt;/code&amp;gt; indicates based on Alpine version if 5 or 7 php will be used in command lines as: &amp;lt;code&amp;gt;apk add php$phpmax&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
The commit that mess all are https://git.alpinelinux.org/aports/commit/community/cacti/cacti.php-fpm.conf?id=4272e802a1be191657becb739e6a248c1d0411a7 where a specific pool for php-fpm are made for cacti.. this its a mess due are not documented.. so we must avoid and ignored that due are undocumented and property configured the general pool:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
apk add php7-fpm php7-bcmath php7-bz2 php7-ctype php7-curl php7-dom \&lt;br /&gt;
 php7-enchant php7-exif php7-gd php7-gettext php7-gmp php7-iconv \&lt;br /&gt;
 php7-imap php7-intl php7-json php7-mbstring php7-opcache php7-openssl \&lt;br /&gt;
 php7-phar php7-posix php7-pspell php7-recode php7-session php7-simplexml \&lt;br /&gt;
 php7-sockets php7-sysvmsg php7-sysvsem php7-sysvshm php7-tidy php7-tokenizer \&lt;br /&gt;
 php7-xml php7-xmlreader php7-xmlrpc php7-xmlwriter php7-xsl php7-zip php7-sqlite3 \&lt;br /&gt;
 php7-gd php7-gmp php7-ldap php7-openssl php7-pdo_mysql php7-posix php7-sockets php7-xml&lt;br /&gt;
&lt;br /&gt;
apk add php7-pdo php7-pdo_mysql php7-mysqli php7-pdo_sqlite php7-sqlite3 \&lt;br /&gt;
 php7-odbc php7-pdo_odbc php7-dba&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The following configurations are for high or huge loads on a 2G RAM server, for more information about configuring PHP on Alpine Linux see [[Production LAMP system: Lighttpd + PHP + MySQL]] wiki page.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
sed -i -r &#039;s|.*cgi.fix_pathinfo=.*|cgi.fix_pathinfo=1|g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*safe_mode =.*#safe_mode = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*expose_php =.*#expose_php = Off#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#memory_limit =.*#memory_limit = 512M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#upload_max_filesize =.*#upload_max_filesize = 56M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#post_max_size =.*#post_max_size = 128M#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^file_uploads =.*#file_uploads = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_file_uploads =.*#max_file_uploads = 12#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^allow_url_fopen = .*#allow_url_fopen = On#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.default_charset =.*#default_charset = &amp;quot;UTF-8&amp;quot;#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^.max_execution_time =.*#max_execution_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^max_input_time =.*#max_input_time = 90#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#.*date.timezone =.*#date.timezone = America/Panama#g&#039; /etc/php*/php.ini&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|.*events.mechanism =.*|events.mechanism = epoll|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*emergency_restart_threshold =.*|emergency_restart_threshold = 12|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*emergency_restart_interval =.*|emergency_restart_interval = 1m|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s|.*process_control_timeout =.*|process_control_timeout = 8s|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_requests =.*|pm.max_requests = 10000|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_children =.*|pm.max_children = 12|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.start_servers =.*|pm.start_servers = 4|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.min_spare_servers =.*|pm.min_spare_servers = 4|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.max_spare_servers =.*|pm.max_spare_servers = 8|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm.process_idle_timeout =.*|pm.process_idle_timeout = 8s|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*pm =.*|pm = ondemand|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
mkdir -p /var/run/php-fpm7/&lt;br /&gt;
&lt;br /&gt;
chown lighttpd:root /var/run/php-fpm7&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^pid =.*|pid = /run/php-fpm7/php7-fpm.pid|g&#039; /etc/php*/php-fpm.conf&lt;br /&gt;
sed -i -r &#039;s#^user =.*#user = lighttpd#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s#^group =.*#group = lighttpd#g&#039; /etc/php*/php.ini&lt;br /&gt;
sed -i -r &#039;s|^.*listen.owner =.*|listen.owner = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*listen.group =.*|listen.group = lighttpd|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
sed -i -r &#039;s|^.*listen.mode =.*|listen.mode = 0660|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
rc-update add php-fpm7 default&lt;br /&gt;
&lt;br /&gt;
service php-fpm7 restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After have php ready, lest integrate into the current preinstalled web server, we already choose lighttpd so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
mkdir -p /var/www/localhost/cgi-bin&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi.conf&amp;quot;.*#\#   include &amp;quot;mod_fastcgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;.*#   include &amp;quot;mod_fastcgi_fpm.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_fastcgi_fpm.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
server.modules += ( &amp;quot;mod_fastcgi&amp;quot; )&lt;br /&gt;
index-file.names += ( &amp;quot;index.php&amp;quot; )&lt;br /&gt;
fastcgi.server = (&lt;br /&gt;
    &amp;quot;.php&amp;quot; =&amp;gt; (&lt;br /&gt;
      &amp;quot;localhost&amp;quot; =&amp;gt; (&lt;br /&gt;
        &amp;quot;socket&amp;quot;                =&amp;gt; &amp;quot;/var/run/php-fpm7/php7-fpm.sock&amp;quot;,&lt;br /&gt;
        &amp;quot;broken-scriptfilename&amp;quot; =&amp;gt; &amp;quot;enable&amp;quot;&lt;br /&gt;
      ))&lt;br /&gt;
)&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s|^.*listen =.*|listen = /var/run/php-fpm7/php7-fpm.sock|g&#039; /etc/php*/php-fpm.d/www.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;lt;?php echo phpinfo(); ?&amp;gt;&amp;quot; &amp;gt; /var/www/localhost/htdocs/info.php&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test PHP are working correctly, browse the web server with &amp;lt;code&amp;gt;http://ipaddress/info.php&amp;lt;/code&amp;gt; of course change &amp;quot;ipaddrs&amp;quot; with the ip of the web server.&lt;br /&gt;
&lt;br /&gt;
=== The Database: MariaDB installation and configuration ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|Cacti also can run with PostgreSQL, inclusivelly are a better choice for high production and huge data systems, but we documented here mysql only due postgresql need more complex tunning parameters}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Also can install &#039;&#039;&#039;adminer to manage the database&#039;&#039;&#039; using web browsing, see [[Production LAMP system: Lighttpd + PHP + MySQL#adminer:_Web_Frontend_administration|Adminer in production LAMP systems]] that can manage any kind of database graphically}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add mysql mysql-client tzdata&lt;br /&gt;
&lt;br /&gt;
mysql_install_db --user=mysql --datadir=/var/lib/mysql&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb start&lt;br /&gt;
&lt;br /&gt;
mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*max_allowed_packet\s*=.*|max_allowed_packet = 100M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/mysql/my.cnf&lt;br /&gt;
sed -i &amp;quot;s|.*bind-address\s*=.*|bind-address=127.0.0.1|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-charset.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/my.cnf.d/mariadb-server-default-highload.cnf &amp;lt;&amp;lt; EOF&lt;br /&gt;
[mysqld]&lt;br /&gt;
collation_server = utf8mb4_unicode_ci&lt;br /&gt;
character_set_server = utf8mb4&lt;br /&gt;
max_heap_table_size = 32M&lt;br /&gt;
tmp_table_size      = 32M&lt;br /&gt;
join_buffer_size    = 62M&lt;br /&gt;
innodb_file_format  = Barracuda&lt;br /&gt;
innodb_large_prefix = 1&lt;br /&gt;
innodb_buffer_pool_size = 512M&lt;br /&gt;
innodb_flush_log_at_timeout = 3&lt;br /&gt;
innodb_read_io_threads  = 32&lt;br /&gt;
innodb_buffer_pool_instances = 1&lt;br /&gt;
innodb_io_capacity     = 5000&lt;br /&gt;
innodb_io_capacity_max = 10000&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-service mariadb restart&lt;br /&gt;
&lt;br /&gt;
rc-update add mariadb default&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After those commands runs the &amp;lt;code&amp;gt;mysql_secure_installation&amp;lt;/code&amp;gt; script and answer as follows:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Enter current password for root (enter for none):&#039;&#039;&#039; must be provided due we already set previously. correct respond are &amp;lt;code&amp;gt;OK, successfully used password, moving on...&amp;lt;/code&amp;gt;&lt;br /&gt;
#  &#039;&#039;&#039;Switch to unix_socket authentication [Y/n]&#039;&#039;&#039; this are not the case and must be disabled, &#039;&#039;&#039;so answer NO&#039;&#039;&#039;, and response will be &amp;lt;code&amp;gt;... skipping.&amp;lt;/code&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;Change the root password? [Y/n]&#039;&#039;&#039; Just press &amp;quot;n&amp;quot; only if you provided a good password, otherwise just change it!&lt;br /&gt;
# &#039;&#039;&#039;Remove anonymous users? [Y/n]&#039;&#039;&#039; In any case, &#039;&#039;&#039;production system must remove it, so answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Disallow root login remotely? [Y/n]&#039;&#039;&#039; For sure answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Remove test database and access to it? [Y/n]&#039;&#039;&#039; Should be removed, so answer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Reload privilege tables now? [Y/n]&#039;&#039;&#039; Aanswer Y&#039;&#039;&#039; and proper respond mus be  &amp;lt;code&amp;gt;... Success!&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After reponse all the questions.. restart the service with &amp;lt;code&amp;gt;rc-service mariadb restart&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The tools: net-snmp and rrtool ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|do no set &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;agentAddress tcp:161,tcp6:[::1]:161&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, seems by default the package added the udp 161 protocol, so if you made it, will only listen and show info using ipv6 only}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk add net-snmp net-snmp-tools rrtool&lt;br /&gt;
&lt;br /&gt;
cat &amp;gt; /etc/snmp/snmpd.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.1&lt;br /&gt;
view systemonly included .1.3.6.1.2.1.25.1&lt;br /&gt;
rocommunity  public localhost&lt;br /&gt;
rocommunity  public default -V systemonly&lt;br /&gt;
sysLocation    Bolivar Upata Venezuela&lt;br /&gt;
sysContact     infoadmin &amp;lt;info@pacificnetwork.com&amp;gt;&lt;br /&gt;
sysServices    72&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
rc-update add snmpd default&lt;br /&gt;
&lt;br /&gt;
rc-service snmpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this we only neet the commands for cacti, but for more info about the topic see:&lt;br /&gt;
&lt;br /&gt;
* [[Setting_up_traffic_monitoring_using_rrdtool_(and_snmp)]]&lt;br /&gt;
* [[Setting_up_monitoring_using_rrdtool_(and_rrdcollect)]]&lt;br /&gt;
* [[Setting_up_A_Network_Monitoring_and_Inventory_System]]&lt;br /&gt;
&lt;br /&gt;
== Cacti Installation ==&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.12, Cacti still are in edge branch, so we first pre-install the depends packages and later only from edge the cacti alone.&lt;br /&gt;
&lt;br /&gt;
=== Installing Cacti Packages ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|As of Alpine 3.5, Cacti was a only one package &amp;quot;cacti&amp;quot;, since alpine 3.6, cacti package are split in more packages. The commit that mess all are where a specific pool for php-fpm are made for cacti.. this its a mess due are not documented.. so we must avoid and ignored that due are undocumented and property configured the general pool.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/apk/repositories &amp;lt;&amp;lt; EOF&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/main&lt;br /&gt;
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d&#039;.&#039; -f1,2)/community&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
apk update&lt;br /&gt;
&lt;br /&gt;
apk add bash busybox coreutils net-snmp-tools perl rrdtool ttf-dejavu php7-snmp&lt;br /&gt;
&lt;br /&gt;
apk add cacti cacti-setup cacti-php7 cacti-lang&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cacti pre Configuration ==&lt;br /&gt;
&lt;br /&gt;
Cacti are run under cacti user, we temporally set all world write permissions to the files and later fix the permissions access.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cat &amp;gt; /etc/lighttpd/mod_cacti.conf &amp;lt;&amp;lt; EOF&lt;br /&gt;
alias.url += (&lt;br /&gt;
     &amp;quot;/cacti/&amp;quot;	    =&amp;gt;    &amp;quot;/usr/share/webapps/cacti/&amp;quot;&lt;br /&gt;
)&lt;br /&gt;
\$HTTP[&amp;quot;url&amp;quot;] =~ &amp;quot;^/cacti/&amp;quot; {&lt;br /&gt;
    dir-listing.activate = &amp;quot;disable&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_alias.*,.*#    &amp;quot;mod_alias&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_accesslog.*,.*#    &amp;quot;mod_accesslog&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
sed -i -r &#039;s#\#.*mod_setenv.*,.*#    &amp;quot;mod_setenv&amp;quot;,#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#   include &amp;quot;mod_cgi.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
checkssl=&amp;quot;&amp;quot;;checkssl=$(grep &#039;include &amp;quot;mod_cacti.conf&#039; /etc/lighttpd/lighttpd.conf);[[ &amp;quot;$checkssl&amp;quot; != &amp;quot;&amp;quot; ]] &amp;amp;&amp;amp; echo listo || sed -i -r &#039;s#.*include &amp;quot;mod_cgi.conf&amp;quot;.*#include &amp;quot;mod_cgi.conf&amp;quot;\ninclude &amp;quot;mod_cacti.conf&amp;quot;#g&#039; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Cacti runs under cacti user, but web server user (apache2, lighttpd) also needs access, so enable group access and as we said, temporally write world permissions:&lt;br /&gt;
&lt;br /&gt;
# grant temporally access to the web server&lt;br /&gt;
# Create the cacti database and populate it&lt;br /&gt;
# Grant Cacti MySQL user access (give it a more secure password):&lt;br /&gt;
# Quit from Mysql command prompt:&lt;br /&gt;
# Import the initial Cacti MySQL database&lt;br /&gt;
# set the user, pass, and db name to the cacti config file&lt;br /&gt;
# grant temporally world permission over log and lib directories of cacti&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
chown -R cacti:lighttpd /usr/share/webapps/cacti/;chown -R cacti:lighttpd /var/lib/cacti/&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;CREATE DATABASE cacti;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT ALL ON cacti.* TO &#039;cactiuser&#039;@&#039;localhost&#039; IDENTIFIED BY &#039;cactipassword&#039;;FLUSH PRIVILEGES;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT GRANT OPTION ON cacti.* TO &#039;cactiuser&#039;@&#039;localhost&#039;;FLUSH PRIVILEGES;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;GRANT SELECT ON mysql.time_zone_name TO &#039;cactiuser&#039;@&#039;localhost&#039;;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql --user=cactiuser -p cactipassword cacti &amp;lt; /usr/share/webapps/cacti/cacti.sql&lt;br /&gt;
&lt;br /&gt;
sed -i -r &#039;s#\$database_default.*=.*;#\$database_default  = &#039;cacti&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
sed -i -r &#039;s#\$database_username.*=.*;#\$database_username  = &#039;cactiuser&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
sed -i -r &#039;s#\$database_password.*=.*;#\$database_password  = &#039;cactipassword&#039;;#g&#039; /etc/cacti/config.php&lt;br /&gt;
&lt;br /&gt;
chmod 777 /var/log/cacti&lt;br /&gt;
chmod 666 /var/log/cacti/*.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Cacti web setup install ===&lt;br /&gt;
&lt;br /&gt;
Login using:&lt;br /&gt;
 Password= admin user= admin&lt;br /&gt;
Next will be prompted to change password:&lt;br /&gt;
 change password.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the web page click:&lt;br /&gt;
: -&amp;gt; Next&lt;br /&gt;
Then select new install in case is not selected:&lt;br /&gt;
: -&amp;gt; New install, Next&lt;br /&gt;
&lt;br /&gt;
{{Warning|take note since cacti 1.2.8 and still at cacti 1.2.10, installer have several errors for &amp;lt;code&amp;gt;Cacti_Stats.xml.gz&amp;lt;/code&amp;gt; template, so lasted &amp;quot;check&amp;quot; have no description you must uncheck last as pointed here: https://github.com/Cacti/cacti/issues/3313#issuecomment-594114681 This template can be installed later with cli as: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;php -d max_execution_time=90 /usr/share/webapps/cacti/cli/import_package.php&lt;br /&gt;
 --filename=Cacti_Stats.xml.gz&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; under the templates directory of cacti install, but currently it hangs and never install it. Reported at https://github.com/Cacti/cacti/issues/3313#issuecomment-601508135 }}&lt;br /&gt;
&lt;br /&gt;
Then finish&lt;br /&gt;
: -&amp;gt; Finish&lt;br /&gt;
Add to crontab:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Cacti post Configuration ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
chmod 775 /var/log/cacti&lt;br /&gt;
chmod 664 /var/log/cacti/*.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pooler and crontab ===&lt;br /&gt;
&lt;br /&gt;
As we said, cacti need a crontab for pool collection of data!, this steps are not necesary since Alpine 3.7 due cacti package already install all necesary files.&lt;br /&gt;
&lt;br /&gt;
{{Note|This steps are only for older cacti packages of Alpine until 3.6, since 3.7 cacti packages already install crontab for oll collection of data}}&lt;br /&gt;
&lt;br /&gt;
 cd /etc/crontabs&lt;br /&gt;
 vi root&lt;br /&gt;
copy to the end of the file:&lt;br /&gt;
 */5 * * * * lighttpd php /var/www/localhost/htdocs/cacti/poller.php &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
In case you are using other web server have to modify the &amp;quot;lighttpd&amp;quot; user.&lt;br /&gt;
 */5 * * * * &amp;quot;web server user&amp;quot; php /var/www/localhost/htdocs/cacti/poller.php &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add your devices and you&#039;re ready to start monitoring!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== cacti plugins ===&lt;br /&gt;
&lt;br /&gt;
If you used lasted cacti must use lasted develop version of each plugins specially if use php7 in webserver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cd /usr/share/webapps/cacti/plugins/&lt;br /&gt;
&lt;br /&gt;
wget https://github.com/Cacti/plugin_mikrotik/archive/master.tar.gz -O cacti-1.2.11-plugin-monitor.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_gexport/archive/master.tar.gz -O cacti-1.2.11-plugin-gexport.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_routerconfigs/archive/master.tar.gz -O cacti-1.2.11-plugin-routerconfigs.tar.g&lt;br /&gt;
wget https://github.com/Cacti/plugin_monitor/archive/master.tar.gz cacti-1.2.11-plugin-reportit.tar.gz&lt;br /&gt;
wget https://github.com/Cacti/plugin_reportit/archive/master.tar.gz -O cacti-1.2.11-plugin-reportit.tar.gz&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After extract all, change and fix permissions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
cd /usr/share/webapps/cacti/plugins/&lt;br /&gt;
&lt;br /&gt;
chown -R cacti:lighttpd /usr/share/webapps/cacti/&lt;br /&gt;
&lt;br /&gt;
chown -R cacti:lighttpd /var/lib/cacti/&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An go to cacti configuration and plugins in the web interface to enable and install all of them.&lt;br /&gt;
&lt;br /&gt;
== Cacti Re installation ==&lt;br /&gt;
&lt;br /&gt;
Lest suppose you mess all and want to reinstall all from zero, lest get started:&lt;br /&gt;
&lt;br /&gt;
=== Erase all cacti related ===&lt;br /&gt;
&lt;br /&gt;
# erase and remove packages installed&lt;br /&gt;
# erase and remove configurations and files&lt;br /&gt;
# erase and remove databases and users from mysql/postgresql (here only mysql as example)&lt;br /&gt;
# reconfigure to do not load the cacti web server configurations&lt;br /&gt;
# restart services due cacti pool was erased and lighttpd must reload config files&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
apk del cacti cacti-setup cacti-php7 cacti-lang&lt;br /&gt;
&lt;br /&gt;
rm -rf /var/log/cacti&lt;br /&gt;
&lt;br /&gt;
rm -rf /usr/share/webapps/cacti&lt;br /&gt;
&lt;br /&gt;
rm -rf /etc/cacti&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;DROP DATABASE cacti;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mysql -u root -p -e &amp;quot;DROP USER &#039;cactiuser&#039;@&#039;localhost&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;/include \&amp;quot;mod_cacti.conf\&amp;quot;/d&amp;quot; /etc/lighttpd/lighttpd.conf&lt;br /&gt;
&lt;br /&gt;
rc-service php-fpm7 restart&lt;br /&gt;
&lt;br /&gt;
rc-service lighttpd restart&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After all of these steps, repeat all the steps from [[Cacti:_traffic_analysis_and_monitoring_network#Cacti_Installation|Cacti_Installation section]].&lt;br /&gt;
&lt;br /&gt;
= See Also =&lt;br /&gt;
&lt;br /&gt;
* https://qgqlochekone.blogspot.com/2020/03/cacti-on-alpine-host-install-traffic.html&lt;br /&gt;
* [[Setting_up_traffic_monitoring_using_rrdtool_(and_snmp)]]&lt;br /&gt;
* [[Setting_up_monitoring_using_rrdtool_(and_rrdcollect)]]&lt;br /&gt;
* [[Setting_up_A_Network_Monitoring_and_Inventory_System]]&lt;br /&gt;
* [[Production LAMP system: Lighttpd + PHP + MySQL]]&lt;br /&gt;
* [[Production Lets Encrypt: dehydrated]]&lt;br /&gt;
* [[Alpine newbie developer]]&lt;br /&gt;
* [[Alpine newbie lammers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Newbie]]&lt;br /&gt;
[[Category:Server]]&lt;br /&gt;
[[Category:Web_Server]]&lt;br /&gt;
[[Category:PHP]]&lt;br /&gt;
[[Category:Monitoring]]&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
[[Category:Production]]&lt;/div&gt;</summary>
		<author><name>Femur</name></author>
	</entry>
</feed>