[Support] for atribe's repo Docker images


Recommended Posts

has anyone got an idea of how to get Ntopng plugin to work with Atribe's grafana docker?  I have a separate offense box I'd like to pull in to this dashboard but I need to install it from the cli?  otherwise, grafana says i need a hosted instance, and i do not want any of the data leaving my network.  straight from the router to my unraid docker instance to visualize the data. 

Link to comment
  • 4 weeks later...

I am following this guide: https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/?st=jb3abuwu&sh=f67352a1


When trying to install telegraf I get the follow error:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name="telegraf" --net="host" --privileged="true" -e TZ="America/Los_Angeles" -e HOST_OS="unRAID" -e "HOST_PROC"="/rootfs/proc" -e "HOST_SYS"="/rootfs/sys" -e "HOST_ETC"="/rootfs/etc" -e "HOST_MOUNT_PREFIX"="/rootfs" -v "/var/run/utmp":"/var/run/utmp":ro -v "/var/run/docker.sock":"/var/run/docker.sock":ro -v "/":"/rootfs":ro -v "/sys":"/rootfs/sys":ro -v "/etc":"/rootfs/etc":ro -v "/proc":"/rootfs/proc":ro -v "/mnt/user/appdata/telegraf/telegraf.conf":"/etc/telegraf/telegraf.conf":rw telegraf:alpine
af56cf1712bcfa2f97afaec76db2bbb8b48c7b7dfd5882805d4d383ed5e62729
/usr/bin/docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "process_linux.go:368: container init caused "rootfs_linux.go:57: mounting \"/mnt/user/appdata/telegraf/telegraf.conf\" to rootfs \"/var/lib/docker/btrfs/subvolumes/f09b61c484be21f89dbe115d22d277060395df3e9b4f9ffc0ac87631831c4ded\" at \"/var/lib/docker/btrfs/subvolumes/f09b61c484be21f89dbe115d22d277060395df3e9b4f9ffc0ac87631831c4ded/etc/telegraf/telegraf.conf\" caused \"not a directory\"""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
The command failed.


--

Note: The guide says to remove the HOST_MOUNT_PREFIX container. I get the same error either way.

--
 

- The directory /mnt/user/appdata/telegraf/telegraf.conf/ does exist.
- There is no directory at /var/lib/docker/btrfs/subvolumes/f09b61c484be21f89dbe115d22d277060395df3e9b4f9ffc0ac87631831c4ded/etc/telegraf/ , there is file named, telegraf.conf, at the path.
 

Not sure why that is not becoming a directory.

Link to comment
  • 1 month later...

I figured out a few things for telegraf:

 

Sensors (CPU temperature etc):

 

The docker image doesn't come with lm_sensors - you need to add it:


ssh into unRAID and do the following:

docker exec -ti telegraf /bin/sh

apk update

apk add lm_sensors

Edit your telegraf.conf and remove the # in front of [[inputs.sensors]]

 

Restart your telegraf docker.

 

Disk Serial Numbers:

 

I set up Influx/Grafana/Telegraf by following PanzerschreckGER's guide here:  https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/

An issue with this set up is you cannot monitor drives by Serial number, only sdx (these designations change on reboot requiring reconfiguration of Grafana) or mdx (this precludes monitoring Parity or cache drives).  I owe big thanks to danielnelson on the telegraf GIT who helped me figure out getting the HDD serial info working with diskio in telegraf

 

Diskio HDDs by Serial

 

Add the following path to the telegraf docker:

 

https://imgur.com/a/3qZXE

 

Then in telegraf.conf under:

[[inputs.diskio]]

put

device_tags = ["ID_SERIAL"]

 

Restart your telegraf docker

 

HDD Temps by Serial:

 

Change the extra parameters in hddtemp docker:

 

From:

 

Extra Parameters: -e HDDTEMP_ARGS="-q -d -F /dev/sd*"

 

To:

 

Extra Parameters: -e HDDTEMP_ARGS="-q -d -F /dev/disk/by-id/*"

 

Restart your hddtemp docker

Edited by sureguy
added command for sensors
Link to comment
9 minutes ago, Altair said:

 

I tried that on telegraf 1.4.3 but I'll only get


/bin/sh: 1: apk: not found

Do you know why?
Or what I can do to get apk to run?

 

Thank you!

 

Okay I managed to fix the error.

 

I had to set the repository to telegraf:1.4.3-alpine not telegraf:1.4.3 as it was before

Link to comment
  • 2 weeks later...

Has anyone setup a reverse proxy for Grafana?  I've found a solution in the tutorial on reddit but it doesn't work.

I'll quote it so people don't have to go searching.

 

If anyone is still stuck set the env variable for the root url in the container to:
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana

and then use the following for the nginx.conf:
location /grafana/ {
	proxy_pass http://IP_HERE:3000/;
}

This doesn't work for myself.  Anyone have a solution?

Quote

 

Edited by Earache
removed quote
Link to comment
  • 2 weeks later...

Hi all I need help.

 

I installed grafana but i'm not able to log in to.

 

I tried the default setup.

 

User admin

pass admin

 

It is not working.

 

 

Thx

 

Here is the log file:

t=2018-02-06T05:03:51-0500 lvl=info msg="Starting Grafana" logger=server version=5.0.0-beta1 commit=3e2da1f compiled=2018-02-05T09:28:57-0500

t=2018-02-06T05:03:51-0500 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2018-02-06T05:03:51-0500 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from command line" logger=settings arg="default.paths.provisioning=/etc/grafana/provisioning"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from command line" logger=settings arg="default.log.mode=console"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SERVER_ROOT_URL=http://xenozilla.ddns.net"
t=2018-02-06T05:03:51-0500 lvl=info msg="Config overridden from Environment variable" logger=settings var="GF_SECURITY_ADMIN_PASSWORD=*********"
t=2018-02-06T05:03:51-0500 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2018-02-06T05:03:51-0500 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2018-02-06T05:03:51-0500 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2018-02-06T05:03:51-0500 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2018-02-06T05:03:51-0500 lvl=info msg="Path Provisioning" logger=settings path=/etc/grafana/provisioning
t=2018-02-06T05:03:51-0500 lvl=info msg="App mode production" logger=settings
t=2018-02-06T05:03:51-0500 lvl=info msg="Initializing DB" logger=sqlstore dbtype=sqlite3
t=2018-02-06T05:03:51-0500 lvl=info msg="Starting DB migration" logger=migrator
t=2018-02-06T05:03:51-0500 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
t=2018-02-06T05:03:51-0500 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2018-02-06T05:03:51-0500 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2018-02-06T05:03:51-0500 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2018-02-06T05:03:51-0500 lvl=info msg="Starting plugin search" logger=plugins
t=2018-02-06T05:03:51-0500 lvl=info msg="Initializing Alerting" logger=alerting.engine
t=2018-02-06T05:03:51-0500 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2018-02-06T05:03:51-0500 lvl=info msg="Initializing Stream Manager"
t=2018-02-06T05:03:51-0500 lvl=info msg="Initializing HTTP Server" logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
t=2018-02-06T05:05:03-0500 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=GET path=/ status=302 remote_addr=192.168.1.127 time_ms=0 size=29 referer=http://192.168.1.105/Dashboard
t=2018-02-06T05:05:18-0500 lvl=eror msg="Invalid username or password" logger=context userId=0 orgId=0 uname= error="Invalid Username or Password"

t=2018-02-06T05:05:18-0500 lvl=info msg="Request Completed" logger=context userId=0 orgId=0 uname= method=POST path=/login status=401 remote_addr=192.168.1.127 time_ms=38 size=42 referer=http://192.168.1.105:3000/login

 

Capture.PNG

Link to comment
On 2/6/2018 at 5:13 AM, francrouge said:

Hi all I need help.

 

I installed grafana but i'm not able to log in to.

 

I tried the default setup.

 

User admin

pass admin

 

It is not working.

 

 

I'm having the same issue with Grafana 5.0 Beta 1, it's a fresh install doesn't seem like GF_SECURITY_ADMIN_PASSWORD variable is setting the admin pass.

Link to comment
On 1/14/2018 at 5:41 AM, sureguy said:

Sensors (CPU temperature etc):

 

The docker image doesn't come with lm_sensors - you need to add it:


ssh into unRAID and do the following:


docker exec -ti telegraf /bin/sh

apk update

apk add lm_sensors

Edit your telegraf.conf and remove the # in front of [[inputs.sensors]]

 

Restart your telegraf docker.

 

 

15

Just a small note that if there is a docker update you will have to perform the above steps again.  At least I did after the last docker update.

Link to comment
  • 1 month later...

Is there a way to create a blank database.  I am trying to set this up with Home-Assistant but it requires the database to be setup already and I can't figure out how to do this in InfluxDB Docker.

 

I tried the following in terminal but it didn't create a database.

 

$ docker run --rm -e INFLUXDB_DB=home_assistant influxdb /init-influxdb.sh
Link to comment
40 minutes ago, mgranger said:

Is there a way to create a blank database.  I am trying to set this up with Home-Assistant but it requires the database to be setup already and I can't figure out how to do this in InfluxDB Docker.

 

I tried the following in terminal but it didn't create a database.

 


$ docker run --rm -e INFLUXDB_DB=home_assistant influxdb /init-influxdb.sh

Once the container is started you can get into the docker containers command line and then follow the instructions in the docs: https://docs.influxdata.com/influxdb/v1.2/introduction/getting_started/#creating-a-database

Link to comment
19 minutes ago, atribe said:

Once the container is started you can get into the docker containers command line and then follow the instructions in the docs: https://docs.influxdata.com/influxdb/v1.2/introduction/getting_started/#creating-a-database

 

Sorry i am still learning but how do you command line into a docker?

 

Edit: Nevermind I figured it out.

Edited by mgranger
Link to comment

Well so I made the database using the command line but when i try to find the database in my appdata/influxdb folder it is not there; but it is there when i use SHOW DATABASE from the command line.   

 

Edit: Nevermind I also figured this out.  My home-assistant had to point to my IP address rather than localhost.   Then it was created in my appdata/influxdb 

Edited by mgranger
Link to comment

Hello all. 

First of all, thanks for this docker, it works great! I've now got this sweet monitor running on a screen in my serverroom.

 

Thanks to panzerschrek for the instructions! link; https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/

 

 

So .. I was googling a bit, and thought about monitoring my dd-wrt router at home, considering I'm on a metered mobile connection at the moment and would like to know about my traffic when things are behaving slow and latency spikes. 

I found this project; https://github.com/trevorndodds/dd-wrt-grafana

Seems to check all the boxes for what I would like to monitor. 

I've done all the steps, making sure the crontasks are running as they should, doublechecked all my .sh scripts etc. So the router is behaving as it should. 

Now to the issue.. 

If I understand it correctly it needs a graphite datasource to dump data to ? (as for the Unraid monitoring I'm already using, Telegraf pushes data to influxdb and grafana is presenting it right?)

Problem is that i cannot create a graphite datasource, I just get a http 404 error:

image.png.9dc735b2768a2c550504dc02984bb3f5.png

 

Any ideas ? 

Last step is importing a json which creates the dashboard, but it will not work without a datasource (obviously :)) 

 

 

 

Link to comment
  • 2 weeks later...

I also got started using this based on the Reddit thread https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/

 

This is really great, and the FAQ on that thread is super helpful.  I've got some nice graphs going including disk and system temperatures, cpu and network activity, etc.

 

Try to guess when I did my parity check.

5acaf969f12c3_ScreenShot2018-04-08at10_25_20PM.thumb.png.62a5be43b916bd71eeb7e6ea184e646e.png

 

Now I want to log the load on my UPS to get an idea of power consumption over time of my server rack.  There's probably an efficient way to do this, but I'm just not sure what to do.

 

As an example, here's what 'apcaccess' puts out:

root@Tower:~# apcaccess 
APC      : 001,032,0751
DATE     : 2018-04-08 21:19:38 -0700  
HOSTNAME : Tower
VERSION  : 3.14.14 (31 May 2016) slackware
UPSNAME  : Tower
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2018-04-08 21:10:06 -0700  
MODEL    : CP1500PFCLCD
STATUS   : ONLINE 
LINEV    : 120.0 Volts
LOADPCT  : 8.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 94.0 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 10 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 120.0 Volts
DWAKE    : -1 Seconds
LOTRANS  : 88.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 Seconds
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 000000000000
NOMINV   : 120 Volts
NOMPOWER : 900 Watts
END APC  : 2018-04-08 21:19:39 -0700  

Here is what's shown in the UPS Settings plugin:

5acaf4cd38348_ScreenShot2018-04-08at10_05_09PM.thumb.png.0e01dd9f700a5369c3436cf5148d501f.png

 

Interestingly this displays the load in Watts, but none of the data I can get out of any of the UPS tools display the current load.  I can only assume that I'd need to calculate the actual load in Watts from LOAD = LOADPCT * NOMPOWER * ( LINEV / NOMINV )

 

So what's the best way to get this data into telegraf?

 

The two things I can think of are:

1. have something inside the telegraf docker call the 'apcaccess' command and parse the result

2. have something inside the telegraf docker parse the data from some existing log file (if it exists)

 

To do #1 (run command to get data) I think I'd need to grant more access to telegraf, which I'm not sure I should do.  It already has read access to '/' mounted at '/rootfs' but it can't execute commands on the root file system.

root@Tower:~# docker exec -ti telegraf /bin/sh
/ # /rootfs/sbin/apcaccess 
/bin/sh: /rootfs/sbin/apcaccess: not found
/ # ls /rootfs/sbin/apc*
/rootfs/sbin/apcaccess  /rootfs/sbin/apctest    /rootfs/sbin/apcupsd

So it can see it, but not execute it.

 

To do #2 (log from a file) I think I'd need to turn on logging for apcupsd.  I looked into this, and it can be done.

1. open /etc/apcupsd/apcupsd.conf in an editor
2. change STATTIME to '1' (or any number other than zero, this is the logging time interval in seconds)
3. change LOGSTATS to 'on'
4. make the output "status" log file exist with `touch /var/log/apcupsd.status`
5. restart apcupsd with `/etc/rc.d/rc.apcupsd restart`

 

The nice thing is that /var/log/apcupsd.status gets recycled on every log write, meaning it is only as long as one dataset, rather than turning into an ever-expanding logfile. The only problem is that after I do this, my syslog gets spammed with UPS data.  I'm not sure how to prevent that.

 

I was going to look into how to use [[inputs.logparser]] in telegraf to grab data from that log file, but I turned the logging back off due to the syslog issue.

 

So I'm not sure what the right way to do this is.  Any ideas?

Edited by cowboytronic
Link to comment
  • 2 weeks later...

Hi folks, I'm trying to pull my Plex data into my Grafana dashboard (via InfluxDB). I found this script which looks promising (https://github.com/barrycarey/Plex-Data-Collector-For-InfluxDB), however I can't figure out if there is a way to use it. I tried installing it in MyScripts only to realize that unRAID doesn't have Python3 built in. I then tried to use this dockerized version, but I can't figure out how to make it work as the docker container can't seem to find the script (though I've mapped it as the error messages suggest). Any ideas how I can accomplish this, or other ideas about pulling Plex data into Grafana? Many thanks!

Link to comment
Hi folks, I'm trying to pull my Plex data into my Grafana dashboard (via InfluxDB). I found this script which looks promising (https://github.com/barrycarey/Plex-Data-Collector-For-InfluxDB), however I can't figure out if there is a way to use it. I tried installing it in MyScripts only to realize that unRAID doesn't have Python3 built in. I then tried to use this dockerized version, but I can't figure out how to make it work as the docker container can't seem to find the script (though I've mapped it as the error messages suggest). Any ideas how I can accomplish this, or other ideas about pulling Plex data into Grafana? Many thanks!



Just to follow up, I installed Python3 through NerdPack and have been able to run jobs with it. The issue now is that I can’t figure out how to get Python to access (and write into) the dockerized Influxdb database. Any ideas?
Link to comment
1 hour ago, remati said:

Has anyone else noticed Grafana showing 0 or no uptime now? I updated my Telegraf docker and just noticed it's not reporting uptime anymore.

 

Also having this issue. All other metrics still work, but the query for Uptime returns 0 every time.

Link to comment

Hello,

 

I am having an issue getting Telegraf set up... I keep getting the error below

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='telegraf' --net='host' --privileged=true -e TZ="America/Los_Angeles" -e HOST_OS="unRAID" -e 'HOST_PROC'='/rootfs/proc' -e 'HOST_SYS'='/rootfs/sys' -e 'HOST_ETC'='/rootfs/etc' -e 'HOST_MOUNT_PREFIX'='/rootfs' -v '/var/run/utmp':'/var/run/utmp':'ro' -v '/var/run/docker.sock':'/var/run/docker.sock':'ro' -v '/':'/rootfs':'ro' -v '/sys':'/rootfs/sys':'ro' -v '/etc':'/rootfs/etc':'ro' -v '/proc':'/rootfs/proc':'ro' -v '/mnt/user/appdata/telegraf/telegraf.conf':'/etc/telegraf/telegraf.conf':'rw' 'telegraf:alpine'

8b385be0c36baa6f76a05b91f4aa13c26d128752a171e64f38f7f0486af95dd9
/usr/bin/docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/mnt/user/appdata/telegraf/telegraf.conf\" to rootfs \"/var/lib/docker/btrfs/subvolumes/c288868e8fb95f1a842b12c94b803112ce61a79d0e28ff27b78603a041889c66\" at \"/var/lib/docker/btrfs/subvolumes/c288868e8fb95f1a842b12c94b803112ce61a79d0e28ff27b78603a041889c66/etc/telegraf/telegraf.conf\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

The command failed.

Link to comment
15 hours ago, izm1chael said:

Hello,

 

I am having an issue getting Telegraf set up... I keep getting the error below

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='telegraf' --net='host' --privileged=true -e TZ="America/Los_Angeles" -e HOST_OS="unRAID" -e 'HOST_PROC'='/rootfs/proc' -e 'HOST_SYS'='/rootfs/sys' -e 'HOST_ETC'='/rootfs/etc' -e 'HOST_MOUNT_PREFIX'='/rootfs' -v '/var/run/utmp':'/var/run/utmp':'ro' -v '/var/run/docker.sock':'/var/run/docker.sock':'ro' -v '/':'/rootfs':'ro' -v '/sys':'/rootfs/sys':'ro' -v '/etc':'/rootfs/etc':'ro' -v '/proc':'/rootfs/proc':'ro' -v '/mnt/user/appdata/telegraf/telegraf.conf':'/etc/telegraf/telegraf.conf':'rw' 'telegraf:alpine'

8b385be0c36baa6f76a05b91f4aa13c26d128752a171e64f38f7f0486af95dd9
/usr/bin/docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused "rootfs_linux.go:58: mounting \"/mnt/user/appdata/telegraf/telegraf.conf\" to rootfs \"/var/lib/docker/btrfs/subvolumes/c288868e8fb95f1a842b12c94b803112ce61a79d0e28ff27b78603a041889c66\" at \"/var/lib/docker/btrfs/subvolumes/c288868e8fb95f1a842b12c94b803112ce61a79d0e28ff27b78603a041889c66/etc/telegraf/telegraf.conf\" caused \"not a directory\""": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.

The command failed.

 

You must not have downloaded the telegraf.conf file and placed it at /mnt/user/appdata/telegraf/telegraf.conf. If you didn't do that docker created a folder at that location. Simply delete the folder and follow the instructions at the top of the config page. I've pasted them here for simplicity.

 

This version of telegraf requires you to manually place a config file at /mnt/user/appdata/telegraf/telegraf.conf The container will not start without it.

The default telegraf.conf file can be downloaded at https://github.com/influxdata/telegraf/blob/master/etc/telegraf.conf. If you would prefer not to use a config file you can search for untelegraf in community apps for a version that only uses environment variables.

Link to comment
On 9.4.2018 at 7:17 AM, cowboytronic said:

I also got started using this based on the Reddit thread https://www.reddit.com/r/unRAID/comments/7c2l2w/howto_monitor_unraid_with_grafana_influxdb_and/

 

This is really great, and the FAQ on that thread is super helpful.  I've got some nice graphs going including disk and system temperatures, cpu and network activity, etc.

 

Try to guess when I did my parity check.

5acaf969f12c3_ScreenShot2018-04-08at10_25_20PM.thumb.png.62a5be43b916bd71eeb7e6ea184e646e.png

 

Now I want to log the load on my UPS to get an idea of power consumption over time of my server rack.  There's probably an efficient way to do this, but I'm just not sure what to do.

 

As an example, here's what 'apcaccess' puts out:


root@Tower:~# apcaccess 
APC      : 001,032,0751
DATE     : 2018-04-08 21:19:38 -0700  
HOSTNAME : Tower
VERSION  : 3.14.14 (31 May 2016) slackware
UPSNAME  : Tower
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2018-04-08 21:10:06 -0700  
MODEL    : CP1500PFCLCD
STATUS   : ONLINE 
LINEV    : 120.0 Volts
LOADPCT  : 8.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 94.0 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 10 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 120.0 Volts
DWAKE    : -1 Seconds
LOTRANS  : 88.0 Volts
HITRANS  : 139.0 Volts
ALARMDEL : 30 Seconds
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 000000000000
NOMINV   : 120 Volts
NOMPOWER : 900 Watts
END APC  : 2018-04-08 21:19:39 -0700  

Here is what's shown in the UPS Settings plugin:

5acaf4cd38348_ScreenShot2018-04-08at10_05_09PM.thumb.png.0e01dd9f700a5369c3436cf5148d501f.png

 

Interestingly this displays the load in Watts, but none of the data I can get out of any of the UPS tools display the current load.  I can only assume that I'd need to calculate the actual load in Watts from LOAD = LOADPCT * NOMPOWER * ( LINEV / NOMINV )

 

So what's the best way to get this data into telegraf?

 

The two things I can think of are:

1. have something inside the telegraf docker call the 'apcaccess' command and parse the result

2. have something inside the telegraf docker parse the data from some existing log file (if it exists)

 

To do #1 (run command to get data) I think I'd need to grant more access to telegraf, which I'm not sure I should do.  It already has read access to '/' mounted at '/rootfs' but it can't execute commands on the root file system.


root@Tower:~# docker exec -ti telegraf /bin/sh
/ # /rootfs/sbin/apcaccess 
/bin/sh: /rootfs/sbin/apcaccess: not found
/ # ls /rootfs/sbin/apc*
/rootfs/sbin/apcaccess  /rootfs/sbin/apctest    /rootfs/sbin/apcupsd

So it can see it, but not execute it.

 

To do #2 (log from a file) I think I'd need to turn on logging for apcupsd.  I looked into this, and it can be done.

1. open /etc/apcupsd/apcupsd.conf in an editor
2. change STATTIME to '1' (or any number other than zero, this is the logging time interval in seconds)
3. change LOGSTATS to 'on'
4. make the output "status" log file exist with `touch /var/log/apcupsd.status`
5. restart apcupsd with `/etc/rc.d/rc.apcupsd restart`

 

The nice thing is that /var/log/apcupsd.status gets recycled on every log write, meaning it is only as long as one dataset, rather than turning into an ever-expanding logfile. The only problem is that after I do this, my syslog gets spammed with UPS data.  I'm not sure how to prevent that.

 

I was going to look into how to use [[inputs.logparser]] in telegraf to grab data from that log file, but I turned the logging back off due to the syslog issue.

 

So I'm not sure what the right way to do this is.  Any ideas?

 

Have you figured this out yet?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.