We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FYI, ApcupsdCollector is also working locally if there is an apcaccess binary on your system:
--- /usr/local/share/diamond/collectors/apcupsd/apcupsd.py2 2019-06-04 17:16:21.211027758 +0200 +++ /usr/local/share/diamond/collectors/apcupsd/apcupsd.py 2019-06-04 17:16:57.163027758 +0200 @@ -18,6 +18,7 @@ from struct import pack import re import time +import subprocess class ApcupsdCollector(diamond.collector.Collector): @@ -51,19 +52,22 @@ def getData(self): # Get the data via TCP stream - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - s.connect((self.config['hostname'], int(self.config['port']))) + #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + #s.connect((self.config['hostname'], int(self.config['port']))) # Packet is pad byte, size byte, and command - s.send(pack('xb6s', 6, 'status')) + #s.send(pack('xb6s', 6, 'status')) # Ditch the header - s.recv(1024) - time.sleep(.25) - data = s.recv(4096) + #s.recv(1024) + #time.sleep(.25) + #data = s.recv(4096) # We're done. Close the socket - s.close() + #s.close() + + out_bytes = subprocess.check_output(['apcaccess']) + data = out_bytes.decode('utf-8') return data def collect(self): @@ -72,7 +76,7 @@ data = self.getData() - data = data.split('\n\x00') + data = data.split('\n') for d in data: matches = re.search("([A-Z]+)\s+:\s+(.*)$", d) if matches:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
FYI, ApcupsdCollector is also working locally if there is an apcaccess binary on your system:
The text was updated successfully, but these errors were encountered: