LibreNMS syslog.ibd cleanup

Recently I ran into an issue where a librenms install was taking up a crazy amount of disk space. This was tracked down to the syslog.ibd file . Even thought I had set my options to be less than 10 days per this link https://docs.librenms.org/Support/Cleanup-options/ I still was having a huge file.

Here is what I did to fix it. My root partition was too full to start MariaDB. I went into var and cleaned out enough log files to make space to start MariaDB. The following are tee commands I ran on CentOS 7 to fix it.

mysql -u username -p

Once at an MYSQL prompt after logging in I issued the following command to verify I could see my librenms database.

show databases;

The I issued

use dbname;

In may case it was “librenms”. Once connected to the database I ran the following command

DELETE FROM syslog WHERE timestamp < '2021-1-28 08:00:00';

This commands removes all syslog entries from the database before the date and time specified. In my case this was close to 40 GIG.

After I restarted MariaDB, ran .daily.sh and all was good.

PHP 7.3 and 7.4 Woes and solution

So this weekend I have been doing some LibreNMS installs and have been having to change the default CentOS PHP version. If it is Centos7 PHP 7.3 is recommend and if it’s Centos 8 then PHP 7.4 is recommended. I have some pretty good tutorials on installing Librenms that I follow. They all mention the remi repository. However, on a few of these networks the remi repository has been unreachable. So I just can’t cut and paste from the tuorials I use.

So what is a person to do? Lots of mirrors are available at https://rpms.remirepo.net/. All you have to do is some substitution.
http://mirror.team-cymru.com/remi/enterprise/remi-release-7.rpm

Done and Done. Hope this helps. You should be using mirrors anyway when it comes to remi. However, most tutorials reference remi because it’s easy.

Some WordPress tips

If you are wanting to force non SSL to SSL. Add the following to your site’s .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Set proper file permissions Script from https://www.ryadel.com/en/set-file-system-permissions-wordpress-web-site-centos-7-chmod/

#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# execute it with the following command:
# bash set-wordpress-permissions.sh /var/www/<site_folder>
#
OWNER=apache # <-- wordpress owner
GROUP=www # <-- wordpress group
ROOT=$1 # <-- wordpress root directory
 
# reset to safe defaults
find ${ROOT} -exec chown ${OWNER}:${GROUP} {} \;
find ${ROOT} -type d -exec chmod 755 {} \;
find ${ROOT} -type f -exec chmod 644 {} \;
 
# allow wordpress to manage wp-config.php (but prevent world access)
chgrp ${GROUP} ${ROOT}/wp-config.php
chmod 660 ${ROOT}/wp-config.php
 
# allow wordpress to manage wp-content
find ${ROOT}/wp-content -exec chgrp ${GROUP} {} \;
find ${ROOT}/wp-content -type d -exec chmod 775 {} \;
find ${ROOT}/wp-content -type f -exec chmod 664 {} \;

Is your web-site running HTTPS? if not, it should

This content is for Patreon subscribers of the j2 blog. Please consider becoming a Patreon subscriber for as little as $1 a month. This helps to provide higher quality content, more podcasts, and other goodies on this blog.
To view this content, you must be a member of Justin Wilson's Patreon
Already a qualifying Patreon member? Refresh to access this content.

PHPIPAM upgrade 1.3.2 to 1.4 error and fix

Tonight I was upgrading PHPIPAM from version 1.3.2 to version 1.4 and ran into an issue.  After doing a git pull I logged into the web GUI and went to upgrade the database.  I receive the following error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'dbversion' in 'field list'

Since I run Webmin, I logged into Webmin and ran the following command on my database

alter table settings add column dbversion tinyint(1);

Once that was executed I was able to go back into the web GUI and upgrade the database.  I ended up with two theme errors which were easily fixed.