aboutsummaryrefslogtreecommitdiff
path: root/thumper.py
diff options
context:
space:
mode:
authorD Delmar Davis <don@suspectdevices.com>2023-08-16 18:12:36 -0700
committerD Delmar Davis <don@suspectdevices.com>2023-08-16 18:12:36 -0700
commite2fd9741ea89362f61312ecd90d996a8622e061e (patch)
tree86b98e08dc377581f0ae419f39c40a56d09f84db /thumper.py
parente5b9f69ed9cd176b6c0cf73ce3ac8cf63303e4e1 (diff)
Notes
Diffstat (limited to 'thumper.py')
-rwxr-xr-xthumper.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/thumper.py b/thumper.py
index 7dd9af5..5bece66 100755
--- a/thumper.py
+++ b/thumper.py
@@ -1,25 +1,48 @@
#!/usr/bin/python
+#------------------------------------------------------------------- thumper.py
+# Check the backyard temperature sensors
+#
+# (C) D Delmar Davis 2023
+#
+# Note: POC lots of hard coded foo here....
+# it takes about a minute and 20 seconds to come back so..
+# bunnyfoofoo's crontab should look like this
+# */2 * * * * /usr/local/bin/thumper.py
import socket
import subprocess
+#---------------------------------------------------------------- isExporting()
+# Check to see if node exporter is running on thumper.
+#
def isExporting():
try:
# connect to the host -- tells us if the host is actually
# reachable
sock = socket.create_connection(("thumper", 9100),timeout=3)
if sock is not None:
- print('dew\'s dat wabbit')
+ print('Found da wabbit')
sock.close
return True
- except OSError as e:
+ except OSError:
pass
return False
+
+#---------------------------------------------------------------- kickThumper()
+# Make sure the poe port is on an powercycle that port
+#
def kickThumper():
- ret = subprocess.call(["ssh", "root@henri-le-renne", "swctrl poe set auto id 6"]);
- ret = subprocess.call(["ssh", "root@henri-le-renne", "swctrl poe restart id 6"]);
+ ret = subprocess.call(["ssh",
+ "root@henri-le-renne",
+ "swctrl poe set auto id 6"]);
+ ret = subprocess.call(["ssh",
+ "root@henri-le-renne",
+ "swctrl poe restart id 6"]);
+#------------------------------------------------------------------- __main__()
+# Check to see if thumper is exporting and if not reset.
+#
if __name__ == '__main__':
if (not isExporting()) :
print("Thumpers not talking. Going to kick it")