Hardware information

Interesting article can be found here.

In summary, following commands will give you interesting details:

inxi -Fxz
lshw -short
lshw -C cpu
lspci -v -s 00:02.0
dmidecode -t memory
lshw -short -C memory

Upgrade MySQL from 5.1 to 5.5 on CentOS 6.x

Check installed version of mysql

rpm -qa | grep mysql

Enable the remi repository by modifying the enabled flag in the repo file:

vi /etc/yum.repos.d/remi.repo

After that, perform upgrade and verify new version. (several methods included below…)

yum -y update mysql*
rpm -qa | grep mysql
mysql --version
mysql -u root -p


Using PhpMyAdmin to administer a remote server

Imagine the following set-up:

Local machine with Debian 9/10, or Ubuntu, or Linux Mint.

Local machine with MySQL server (which would be MariaDB in this case) and with PhpMyAdmin. One can access http://localhost/phpmyadmin.

In order to access a remote server, we need to do the following:

sudo vi /etc/phpmyadmin/config.inc.php

Add following lines at the end:

$i++;
$cfg['Servers'][$i]['host'] = '10.10.10.11';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'rootpassword';
$cfg['Servers'][$i]['auth_type'] = 'config';

In case you want to provide a default language, add following after the blowfish section:

$cfg['Lang'] = 'en';

(I didn’t see any useful improvement in putting this, just mention it for those that want their server to behave independently of their locale setting.)

On the remote server, you will need to allow the root user to connect and to open the firewall port on 3306. Please modify the network segment from which remote access is allowed and the rootpassword in below script to suit your configuration.

Script for CentOS 6.x

iptables -A INPUT -i eth0 -p tcp -s 192.168.0.0/24 --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT

mysql -u root -p
mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'rootpassword';

In case you want to connect to a remote server with MySQL< 5.5, you will have to do an upgrade to version 5.5. Otherwise, the latest phpMyAdmin won’t connect. See separate post.

C++ rant

Please consider the following standard C++ program.

#include <iostream>
using namespace std;
main(){
  cout << "Hello, World!";
  return 0;
}

What is wrong with this?

  1.  include statement: we are including a header or a piece of source code, why isn’t it called iostream.h?
  2. using namespace std: if standard, it could be omitted and considered standard because it has not been mentioned.
  3. main function: why there are no parameters in it
  4. return statement: do we assume the function has been defined as int….

Ideal version, in my opinion…. but opinions are subjective

#include <iostream.h>

int main(int argc, char *argv[], char *env[]){
  cout << "Hello, World!";
  return 0;
}

 

Observium installation on Debian 9 – adding devices fails

Installing fresh Observium (18.9.9420) (community version) on Debian 9 does not end up with a working installation.  (See Observium documentation)

Only one device is added, that cannot be viewed afterwards.

Possible solution: modify the database structure after installation and before adding your devices.

Start checking if the devices_id field has an auto-increment value set and is the primary key.

One can do so by issuing following commands:

mysql>show columns from devices from observium;

or alternatively:

mysql>show create table devices;

If the auto-increment value is missing, please add it:

mysql> use observium;

mysql> alter table devices change column device_id device_id int(11) not null auto_increment;

Easy fix, but takes some time to find out.

Some background information from the logs:

##### Software versions #####

o OS Linux 4.9.0-8-amd64 [amd64] (Debian 9.6)
o Apache 2.4.25
o PHP 7.0.33-0+deb9u1 (OPcache: DISABLED)
o Python 2.7.13
o MySQL 10.1.37-MariaDB-0+deb9u1 (extension: mysqli 5.0.12-dev)
o SNMP NET-SNMP 5.7.3
o RRDtool 1.6.0
o Fping 3.15 (IPv4 and IPv6)

##### Memory Limit #####

o PHP Unlimited

##### MySQL mode #####

o MySQL NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

##### Charset info #####

o PHP UTF-8
o MySQL utf8

##### Timezones info #####

o Date Wednesday, 15-May-19 13:35:30 CAT
o PHP +02:00
o MySQL +02:00

After making the change, please check the auto_increment value is there.

show columns from devices from observium;

Hotspot detection

How to set-up hotspot.

Firefox URL: http://detectportal.firefox.com/success.txt

Google Chrome URL: connectivitycheck.gstatic.com/generate_204

Edge URL:

Internet Explorer URL:

Opera URL:

Chomium URL: chrome.google.com

Dolphin URL:

Observium disk full

If your graphs are showing with ‘graph error’ and your disk is almost full, please follow the instructions below.

Add extra disk to your VM or to your machine and type following commands with root privileges.

# display disk name
fdisk -l

# create partition
fdisk /dev/sdb

# type n enter enter enter enter w enter
# means new partition, default values accept, and write out changes

# extend physical volume group
vgs
vgextend observium-vg /dev/sdb1

# extend size in volume group and resize file system
lvextend -L +19G /dev/mapper/observium--vg-root
resize2fs /dev/mapper/observium--vg-root

# check everything is ok
df -k

# now regenerate graphs that were missing
cd /opt/observium
php discovery.php -h all
php poller.php -h all

Above assumes you are adding a second disk of 20 GB. sdb and +19G might need to change if your configuration is different.