Fixing Smokeping’s “Opening secrets file /etc/smokeping/smokeping_secrets: Permission denied” warning

I recently decided to start playing with smokeping, in particular a master/slave setup.

I started by keeping it simple, two Ubuntu 14.04 virtual machines on the same network. I decided to use Ubuntu because it already has smokeping packages and more importantly I had the ISO image handy.

I started by reading the documentation on the Smokeping home page and dove in.  Setting up the master went smoothly.   OK, technically there was nothing to do but install the smokeping package, but hey, baby steps.

Next came setting up the slave.

I installed smokeping on the second virtual machine that was to act as the slave.  I updated the slave’s default/smokeping file and created the secret file on the slave. I then updated the target entries on the master to expect the slave.

When I started the smokeping on the slave I was quickly presented with the following errors:

WARNING: Opening secrets file /etc/smokeping/smokeping_secrets: Permission denied

ERROR: we did not get config from the master. Maybe we are not configured as a slave for any of the targets on the master ?

I must have wasted two hours on this.   I kept looking at the configuration files on the slave for problems, after all it was reporting the error.

I ended up running tcpdump on the slave to see exactly what the master and slave were saying to each other.
Here is what I saw:


POST /smokeping/smokeping.cgi HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
User-Agent: smokeping-slave/1.0
Content-Length: 366
Content-Type: multipart/form-data; boundary=xYzZY

Content-Disposition: form-data; name=”slave”
Content-Disposition: form-data; name=”key”

Content-Disposition: form-data; name=”protocol”

Content-Disposition: form-data; name=”data”

Content-Disposition: form-data; name=”config_time”

HTTP/1.1 200 OK
Date: Tue, 14 Apr 2015 17:38:07 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain

WARNING: Opening secrets file /etc/smokeping/smokeping_secrets: Permission denied


So, it wasn’t the slave that could not open file, it was apache on the master!  Why couldn’t the error message say that?!

A quick chgrp www-data /etc/smokeping/smokeping_secrets fixed the problem right away.

Now the slave reports “Sent data to Server and got new config in response.” when it starts.  Yea!

Configuring a Static IP in OpenIndiana

This post from the Things I need to remember… blog describes how to configure a static on in OpenIndiana.

1. Disable the auto-magic network daemon

#svcadm disable physical:nwam

2. Define in /etc/hosts, if not already, an entry for this host.
For example: hostname hostname.local localhost loghost

3. Enable the default physical service with svcadm and configure the interface:
#svcadm enable physical:default

4. Configure interface with ipadm
# ipadm create-addr -T static -a local= bge0/v4static

4.1 If you do not know what the interface name is bge0 in this case type in #kstat -c net | grep net and look for hme0, bge0, e1000g0 or soemthing that resembles the driver in use.

5.add gateway
#route -p add default or
#sudo nano /etc/defaultrouter enter in your gateway

6. set dnsserver
#sudo nano /etc/resolv.conf enter in the DNS server IP/s

7. set the workgroup
#sudo smbadm join -w workgroupname

8. Restart

Note: If you cannot ping run this command and try again.
#sudo cp /etc/nsswitch.dns /etc/nsswitch.conf


Original post: