Compare commits

..

16 Commits

Author SHA1 Message Date
ce84450c64 Merge pull request 'work' (#4) from work into main
Reviewed-on: #4
2025-08-18 19:03:17 +00:00
0241f9f36c fixing order of operations
All checks were successful
/ Plan (push) Successful in 4m24s
/ Plan (pull_request) Successful in 28s
/ Deploy (pull_request) Successful in 28s
2025-08-18 13:57:56 -05:00
0cca15af60 updating to trixie and flattening image
Some checks failed
/ Plan (push) Failing after 44s
2025-08-18 13:56:15 -05:00
eaf3e68fa0 Merge pull request 'fixing sleep error' (#3) from work into main
Reviewed-on: #3
2025-03-19 01:23:47 -05:00
aab45796ae fixing sleep error
All checks were successful
/ Plan (push) Successful in 5m16s
/ Plan (pull_request) Successful in 6m37s
/ Deploy (pull_request) Successful in 27s
2025-03-19 01:21:05 -05:00
a81b56eaf7 Merge pull request 'Reorder Dockerfile to reduce build size' (#2) from work into main
Reviewed-on: #2
2025-01-07 11:37:37 -06:00
2faccdade3 Reorder Dockerfile to reduce build size
All checks were successful
/ Plan (push) Successful in 2m34s
/ Plan (pull_request) Successful in 9s
/ Deploy (pull_request) Successful in 36s
2025-01-07 11:37:11 -06:00
f1777d2d19 Merge pull request 'work' (#1) from work into main
Reviewed-on: #1
2024-11-26 12:59:21 -06:00
80e4c31b0a ping changes
All checks were successful
/ Plan (push) Successful in 48s
/ Plan (pull_request) Successful in 10s
/ Deploy (pull_request) Successful in 12s
2024-11-26 12:56:03 -06:00
619a56ebc1 more debugging
All checks were successful
/ Plan (push) Successful in 45s
2024-11-26 12:54:17 -06:00
42b91cbf72 install ping in container
All checks were successful
/ Plan (push) Successful in 3m21s
2024-11-26 12:43:45 -06:00
93e091f1d2 ping add
All checks were successful
/ Plan (push) Successful in 56s
2024-11-26 12:41:37 -06:00
92e0ab385a debugging
All checks were successful
/ Plan (push) Successful in 1m0s
2024-11-26 12:37:16 -06:00
d61365ec99 additional debugging
All checks were successful
/ Plan (push) Successful in 50s
2024-11-26 12:35:16 -06:00
5aabd3e7b1 fix shebang
All checks were successful
/ Plan (push) Successful in 1m5s
2024-11-26 12:31:33 -06:00
11455452d1 force run
All checks were successful
/ Plan (push) Successful in 1m5s
2024-11-26 12:28:20 -06:00
3 changed files with 23 additions and 17 deletions

View File

@@ -1,11 +1,9 @@
FROM debian:bullseye-slim
FROM debian:trixie-slim
#
RUN apt update && apt install python3 python3-pip -y
COPY logpingresult.py /usr/local/bin/
COPY requirements.txt /
COPY init.sh /
RUN chmod +x /init.sh
RUN apt update && apt install python3 python3-pip iputils-ping -y && pip3 install -r /requirements.txt --break-system-packages && apt clean
COPY logpingresult.py /usr/local/bin/
RUN chmod +x /usr/local/bin/logpingresult.py
RUN pip3 install -r /requirements.txt
RUN apt clean
CMD ["/init.sh"]

View File

@@ -7,4 +7,5 @@ services:
- INFLUX_USER=${INFLUX_USER}
- INFLUX_PASSWORD=${INFLUX_PASSWORD}
- INFLUX_URI=${INFLUX_URI}
- PING_HOSTS="8.8.8.8,10.0.2.1,24.220.0.10,10.2.0.1,192.168.1.25"
- PING_HOSTS="8.8.8.8,10.0.2.1,24.220.0.10,10.2.0.1,192.168.1.25"
#

View File

@@ -1,4 +1,4 @@
#/usr/bin/python3
#!/usr/bin/python3
import os
import subprocess as sp
import requests
@@ -19,13 +19,20 @@ infdbpass = os.environ["INFLUX_PASSWORD"]
influxuri = os.environ["INFLUX_URI"]
pingaddresses = os.environ["PING_HOSTS"].split(",")
while(True):
for ip in pingaddresses:
response = sp.getstatusoutput(f"ping -c 1 {ip}")
if(response[0]!=0):
time=2000
else:
myresp = response[1].split("\n")[1].split(' ')[6].split('=')[1]
result = addinfluxrecord(ip,myresp)
print(result)
time.sleep(5)
if len(pingaddresses) > 0:
print(pingaddresses)
for ip in pingaddresses:
print(ip)
response = sp.getstatusoutput(f"ping -c 1 {ip}")
print(response)
if(response[0]!=0):
myresp=2000
else:
myresp = response[1].split("\n")[1].split(' ')[6].split('=')[1]
result = addinfluxrecord(ip,myresp)
print(result)
time.sleep(5)
else:
print("No Hosts Defined")
exit