RPi cannot autostart Glances with --export influxdb

170 views
Skip to first unread message

Stuart Harrison

unread,
Sep 21, 2020, 12:28:40 PM9/21/20
to Glances Users
Hi

I am having real trouble getting Glances to auto run with the --export influxdb command.

I have followed the instructions here:

However I am getting this error:

● glances.service - Glances
   Loaded: loaded (/etc/systemd/system/glances.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Mon 2020-09-21 17:17:41 BST; 4s ago
  Process: 1778 ExecStart=/usr/local/bin/glances --quiet --export influxdb (code=exited, status=2)
 Main PID: 1778 (code=exited, status=2)


Here is my glances.service file contents:

[Unit]
Description=Glances
After=network.target influxd.service

[Service]
ExecStart=/usr/local/bin/glances --quiet --export influxdb
Restart=on-failure
RemainAfterExit=yes
RestartSec=30s
TimeoutSec=30s

[Install]
WantedBy=multi-user.target

The log file is finding and reading my glances.conf file:

2020-09-21 15:47:05,894 -- INFO -- Start Glances 3.1.5
2020-09-21 15:47:05,896 -- INFO -- CPython 2.7.16 and psutil 5.7.2 detected
2020-09-21 15:47:05,932 -- INFO -- Search glances.conf file in /home/pi/.config/glances/glances.conf
2020-09-21 15:47:05,936 -- INFO -- Read configuration file '/home/pi/.config/glances/glances.conf'
2020-09-21 15:47:05,980 -- INFO -- Start GlancesStandalone mode

Here is my glances.conf file:

[influxdb]
host=localhost
port=8086
protocol=http
user=myuser
password=mypassword
db=glances
prefix=localhost
# Tags will be added for all measurements
#tags=foo:bar,spam:eggs
# You can also use dynamic values
#tags=system:`uname -a`

If I manually run this command in SSH terminal on the Pi it works OK and data is passed OK to InfluxDB / Grafana. 

glances --quiet --export influxdb

2020-09-21 17:25:12,469 -- INFO -- Start Glances 3.1.5
2020-09-21 17:25:12,470 -- INFO -- CPython 2.7.16 and psutil 5.7.2 detected
2020-09-21 17:25:12,508 -- INFO -- Search glances.conf file in /home/pi/.config/glances/glances.conf
2020-09-21 17:25:12,511 -- INFO -- Read configuration file '/home/pi/.config/glances/glances.conf'
2020-09-21 17:25:12,556 -- INFO -- Start GlancesStandalone mode
2020-09-21 17:25:13,105 -- WARNING -- Sparklines module not found (No module named sparklines)
2020-09-21 17:25:13,768 -- WARNING -- Error loading Docker Python Lib. Docker plugin is disabled (No module named ssl_match_hostname)
2020-09-21 17:25:13,775 -- ERROR -- docker plugin - Can not connect to Docker (global name 'docker' is not defined)
2020-09-21 17:25:13,793 -- WARNING -- Missing Python Lib (No module named pySMART), HDD Smart plugin is disabled
2020-09-21 17:25:14,031 -- INFO -- Stats will be exported to InfluxDB server: http://localhost:8086
2020-09-21 17:25:15,069 -- INFO -- Quiet mode is ON, nothing will be displayed


However I cannot get it to autostart after a reboot. 

If in the glances.service file I change the command to just: glances -w

Then that does work after rebooting the Pi and I can access the Glances web GUI OK. 

So why does it not work when using the command: glances --quiet --export influxdb ?

Please HELP !! 

Stuart Harrison

unread,
Sep 24, 2020, 8:03:11 AM9/24/20
to Glances Users

I think I’ve fixed it. I added the line:

User=pi

in to the glances.service file.

It appears to be loading now after a reboot, fingers crossed it remains that way.

Jan Grinderslev Laursen

unread,
May 12, 2021, 6:29:26 PM5/12/21
to Glances Users
But you already had user=myuser in your file?
I wonder why that was necessary?

Reply all
Reply to author
Forward
0 new messages