Pi Hacks

DNS Config

Static IP address, configured in /etc/dhcpcd.conf:
add static domain_name_servers=x.x.x.x y.y.y.y to the interface definition

Dynamic address, using openresolv (default on pi)
add to /etc/resolvconf.conf
name_servers=”x.x.x.x y.y.y.y z.z.z.z”

then run sudo resolvconf -u

Enable routing for 192.168.42.10 -add this to rc.local
ip route add 192.168.42.0/24 via 192.168.42.1

On bookworm i had to enter the nameservers manually into resolv.conf after all that


Setting up Cloudwatch monitoring
See https://ownthe.cloud/posts/configure-aws-cloudwatch-plugin/
* Make sure you have valid credentials in /root/.aws/credentials
* Install collectd and the cloudwatch forwarder

sudo apt-get install collectd
wget https://raw.githubusercontent.com/awslabs/collectd-cloudwatch/master/src/setup.py

Edit setup.py to add the below to DISTRIBUTION_TO_INSTALLER, required as Raspian is Debian and uses APT

"Debian GNU": APT_INSTALL_COMMAND,

Then run
chmod +x setup.py && sudo ./setup.py

Select the credentials file mentioned earlier, otherwise accept defaults.
The available metrics are visible in

/opt/collectd-plugins/cloudwatch/config/blocked_metrics

Copy the ones you want into /opt/collectd-plugins/cloudwatch/config/whitelist.conf. The default deployment includes a few.

Start collectd (sudo service collectd start), and few minutes later you should see the data in the Cloudwatch console

To add Temperature monitoring

git clone https://github.com/ethbian/rpi_temperature_plugin4collectd.git
sudo cp rpi_temperature_plugin4collectd/rpi_temperature.py /opt/collectd-plugins

Add the following to /etc/collectd/collectd.conf

LoadPlugin python
<Plugin python>
        ModulePath "/opt/collectd-plugins"
        LogTraces true
        Import "rpi_temperature"
        <Module rpi_temperature>
                Sensor "/sys/class/thermal/thermal_zone0/temp"
                Celsius true
        </Module>
</Plugin>

Add the followiing to /opt/collectd-plugins/cloudwatch/config/whitelist.conf

rpi_temperature--gauge-