October 3, 20187 yr I'd like to implement this script to push NUT stats into influxdb. Seems like it should be fairly straight-forward... I have User Scripts plugin. Is it possible to run this script using that tool? https://github.com/lf-/influx_nut/blob/master/influx_nut.py
October 3, 20187 yr I'd bet it should work, although I think Unraid is missing the python interpreter, because I saw it in "Nerd Tools" plugin. If you don't have the Nerd Tools plugin already, I would download that plugin and from there install Python - afterwards try your script again.
October 5, 20187 yr Author On 10/3/2018 at 4:04 PM, Jcloud said: I'd bet it should work, although I think Unraid is missing the python interpreter, because I saw it in "Nerd Tools" plugin. If you don't have the Nerd Tools plugin already, I would download that plugin and from there install Python - afterwards try your script again. Yep. Forgot to mention I have Nerd Tools and have Python3 and Python installed. Tried running it but ran into a number of command errors. Looks like its not able to run even though python is installed... Script location: /tmp/user.scripts/tmpScripts/influx_nut/script Note that closing this window will abort the execution of this script /tmp/user.scripts/tmpScripts/influx_nut/script: line 2: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 3: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 4: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 5: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 6: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 7: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 8: from: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 10: import: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 13: __doc__: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 15: DEFAULT_CONFIG: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 17: interval:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 19: nut_host:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 21: nut_port:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 23: nut_ups:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 33: nut_vars:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 36: influx_host:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 39: influx_db:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 42: influx_tags:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 47: influx_creds:: command not found /tmp/user.scripts/tmpScripts/influx_nut/script: line 48: syntax error near unexpected token `}' /tmp/user.scripts/tmpScripts/influx_nut/script: line 48: `}' None of the co
October 5, 20187 yr You may need to install those python modules that are listed in the import statements. Some may be included in the default python install but some may not. import socket import collections import time import json import os import sys from typing import Tuple, Mapping, Iterable import requests You can also try adding your path to python in the top line. Default for most installs is #!/usr/bin/python. I'm not sure what it is for unraid. Also try running your script as "python /tmp/user.scripts/tmpScripts/influx_nut/script" instead of just calling the script directly. Edited October 5, 20187 yr by RAINMAN
October 5, 20187 yr Author 2 hours ago, RAINMAN said: You may need to install those python modules that are listed in the import statements. Some may be included in the default python install but some may not. import socket import collections import time import json import os import sys from typing import Tuple, Mapping, Iterable import requests You can also try adding your path to python in the top line. Default for most installs is #!/usr/bin/python. I'm not sure what it is for unraid. Also try running your script as "python /tmp/user.scripts/tmpScripts/influx_nut/script" instead of just calling the script directly. Thanks I added the path to python in the top line and it ran. However, there is a syntax error on line 64. def __init__(self, measurement, fields, tags: dict = {}, ^ SyntaxError: invalid syntax I'm looking into this now in case anyone else is interested. @RAINMAN - if you happen to know how to fix this please let me know
Archived
This topic is now archived and is closed to further replies.