Setting up RRDReST on CentOS 8 or AlmaLinux 9

There are some differences on setting up RRDReST on CentOS 8, Almalinux 9 vs CentOS 7

If you are setting this up to use with LibreNMS and Grafana, check out the rest of the this article. https://www.incredigeek.com/home/setting-up-grafana-on-librenms/

Installing RRDReST

All the docker commands have been swapped out for podman.

  1. Install Docker
  2. Create a compose file
  3. Run compose file to create container

Install docker

Podman is default on CentOS 8 and later and is, for the most part, a drop in replacement for Docker.

sudo yum install -y podman podman-compose
sudo systemctl enable podman

Create a Podman / Docker network to use. We’ll use this to assign a static IP address to the container. We’ll call the network rrdnet, and we’ll use the 10.89.2.0/24 range.

sudo podman network create --subnet=10.89.2.0/24 rrdnet

Create podman-compose file

Create a docker compose file

vi podman-compose.yml

Add the following

version: "3.5"
services:
  rrdrest:
    image: michaelwadman/rrdrest:latest
    container_name: rrdrest
    restart: always
    volumes:
      - "/opt/librenms/rrd:/opt/librenms/rrd:Z"
    environment:
      - TZ=America/Denver
    networks:
      rrdnet:
        ipv4_address: 10.89.2.2
        ipam:
          driver: default
          config:
            - subnet: 10.89.2.0/24
networks:
  rrdnet:
    external: true

Change the TZ to your time zone. If you have issues with the graphs, most likely something is off with the time zone between this container and Grafana/LibreNMS server

Note that the :Z is needed for SELinux to allow RRDReST to access the sub folders. AKA. the rrd files.

The container should have a 10.89.2.2 IP address. You can take all the networking sections out, and the container will receive DHCP. The problem is that the IP can change, breaking our graphs in Grafana.

Run RRDReST Container

Save the file. Then start and setup the container with

sudo podman-compose up -d

You will need your docker container IP address to setup the connection in Grafana. If you used the above docker-compose config, then it should be 10.89.2.2.

sudo docker exec -it rrdrest ip addr | grep eth0

Configure RRDRest to start on system boot with systemd

The “restart: always” option does not appear to work on systems with podman. We can create a systemd service instead.

Use the following command to automatically create a systemd file.

sudo podman generate systemd rrdrest

Copy the contents to a new file in /etc/systemd/system/

/etc/systemd/system/rrdrest.service

If you end up deleting the rrdrest container, you’ll need to update the systemd file again. You may need also need to run “systemctl daemon-reload”

Enable the new service with

systemctl enable rrdrest

Congratulations. RRDReST is now setup and running.

You can verify it’s running by checking with Podman / Docker.

sudo podman ps

You can also ping it

ping 10.89.2.2

Change Static IP on AirFiber over SSH

Log into device

SSH into AirFiber

ssh ubnt@192.168.1.20

Modify config file

Open up the “/tmp/system.cfg” configuration file

vi /tmp/system.cfg

Find the line that has the ip address and modify the address.
Note that you’ll need to hit i to enter text if you are using vi

...
netconf.3.hwaddr.status=disabled
netconf.3.ip=192.168.1.10   <-- Change IP here
netconf.3.mtu=1500 
...

Save file by hitting the esc key then type :x and then hit Enter

Save changes and reboot

Now run the following command to write the changes to the device. Once it comes back up it should have the new IP address from the config file.

cfgmtd -f /tmp/system.cfg -w && reboot

UniFi Cameras – configure static IP or DHCP from command line

The UniFi cameras are different then the AirMax line in how the configuration works. There is a “/tmp/system.cfg” file, but it does not contain most of the configuration option. In the default directory there are some files which appear to handle the device configuration.

The network configuration file is “ubnt_networkd.conf”

Edit the file by opening it up in vi or a different text editor.

Static IP config

{
     "cfgver": 2,
     "dhcp": {
         "fallbackIP": "192.168.1.20",
         "fallbackNetmask": "255.255.255.0",
         "status": 0  <-- 0=Static 1=DHCP
     },
     "dns": {
         "ns1": {
             "ip": "8.8.8.8",
             "status": 1
         },
         "ns2": {
             "ip": "4.2.2.2",
             "status": 1
         }
     },
     "routes": {
         "gateway": "192.168.5.1"
     },
     "statik": {
         "ip": "192.168.5.11",
         "netmask": "255.255.255.0"
     }
}

If you want to set the static address, you should be able to edit the settings in this config and leave DHCP status disabled.

DHCP config

To set the Camera to use DHCP, under dhcp change “”status”: 0″ to “”status”: 1″

{
     "cfgver": 2,
     "dhcp": {
         "fallbackIP": "192.168.1.20",
         "fallbackNetmask": "255.255.255.0",
         "status": 1
     },
     "dns": {
         "ns1": {
             "ip": "8.8.8.8",
             "status": 1
         },
         "ns2": {
             "ip": "4.2.2.2",
             "status": 1
         }
     },
     "routes": {
         "gateway": "192.168.5.1"
     },
     "statik": {
         "ip": "192.168.5.11",
         "netmask": "255.255.255.0"
     }
}

After the settings are applied the camera will use use DHCP regardless of the statik ip settings.

Save changes

Use the following command to write the changes to persistent storage

ubnt_cmd_persist.sh

And reboot the camera.

reboot

Camera should pull a DHCP address when it boots up

Set static ip address in Ubuntu 19.04

The network configuration settings for the server edition of Ubuntu are now stored in the following location. Create the file if it does not exist.

sudo vi /etc/netplan/01-network-manager-all.yaml

Add or edit the config file to the following. Change eno1 to your interface name and the address and gateway to the appropriate IP’s

For more information, see netplan(5).
 network:
   version: 2
   renderer: networkd
   ethernets:
     eno1:
      dhcp4: no
      addresses: [192.168.200.24/24]
      gateway: 192.168.200.1
      nameservers:
        addresses: [8.8.8.8,8.8.4.4]

Now apply the changes with the following command.

sudo netplan apply

How to Set a Static IP Address on a Raspberry Pi

The examples given here are for modifying the wlan0 interface.  Replace wlan0 with the interface you are configuring. i.e. (eth0,wlan1)

Method 1

This was the typical way to add a static IP address to a Pi, if you have issues with this, then try Method 2.

sudo vi /etc/network/interfaces

In the file it is pretty easy to see which lines control which interface, find the lines that control wlan0 (or the interface your configuring) and change/add to look like below.

iface wlan0 inet static
address 192.168.42.109
netmask 255.255.255.0
gateway 192.168.42.1

Save the file, reboot, and the Pi should come up with the new static IP.

Method 2

It looks like on the newer versions of Raspbian, the above method does not work anymore, so now you have to edit the following file

sudo vi /etc/dhcpcd.conf

and add the following lines.

interface wlan0
static ip_address=192.168.42.109/24
static routers=192.168.42.1
static domain_name_servers=192.168.42.1

If you just need to assign a static IP address, to the device, because it is going to be setup as a hotspot or something, you can get away with the following.

interface wlan0
static ip_address=192.168.42.1/24

If you run into issues with it not assigning the address, check the /etc/network/interfaces file and make sure that the line that starts with “iface wlan0” says manual at the end and not static.  If it says “iface wlan0 inet static”, change it to “iface wlan0 inet manual”

How to set a Static ip Address in OS X from Command Line

You can set a static ip address in OS X with the following command. Replace en0 with the appropriate interface.

sudo ipconfig set en0 INFORM 192.168.10.12

The default ethernet interface on a Mac is usually en0. You can run ifconfig to view all the interfaces available on the machine.

The ip address will last until you reboot.

How to set a static ip address on CentOS, Fedora, or Red Hat Linux

Open up the following file with your favorite text editor. Change eth0 to the interface you need, like “wlan0” or “eth1”.

 vi /etc/sysconfig/network-scripts/ifcfg-eth0

The file should look something like the following.

DEVICE=eth0
HWADDR=0A:2G:F3:56:66:4B
TYPE=Ethernet
UUID=aeh9421c-6a62-712c-886d-347813g8d1dh
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=dhcp

To set the static IP address change “BOOTPROTO=dhcp” to “BOOTPROTO=static” and add the following to the end of the file. If you want/need the interface to come up when the computer boots up then be sure to change “ONBOOT=no” to “ONBOOT=yes”.

BROADCAST=192.168.1.255
DNS1=8.8.8.8
GATEWAY=192.168.1.1
IPADDR=192.168.1.110
NETMASK=255.255.255.0

Also, on some newer versions of CentOS you may need to add NM_DISABLED=no

So your file should now look like this.

DEVICE=eth0
HWADDR=0A:2G:F3:56:66:4B
TYPE=Ethernet
UUID=aeh9421c-6a62-712c-886d-347813g8d1dh
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
BROADCAST=192.168.1.255
DNS1=8.8.8.8
GATEWAY=192.168.1.1
IPADDR=192.168.1.110
NETMASK=255.255.255.0

Save the file and restart networking.

service network restart

Finally, check you IP address with ifconfig.

root@localhost ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 0A:2G:F3:56:66:4B  
          inet addr:192.168.1.110  Bcast:192.168.1.255  Mask:255.255.255.0

How to set a Static IP Address in Ubuntu and Debian

The first thing we need to do, is open our interfaces file.  Execute the following from a terminal.

sudo vi /etc/network/interfaces

or

sudo nano /etc/network/interfaces

Then add or copy and paste the following.

auto eth0
iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

Close the file. Now we need to change the DNS settings

sudo vi /etc/resolv.conf

or

sudo nano /etc/resolv.conf

Edit the nameserver line to something like the following.

nameserver 8.8.8.8

Close the file and then restart the networking stuff.

sudo /etc/init.d/networking restart