Initial Release
This commit is contained in:
commit
3decb801f2
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install Flask
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Copy app code
|
||||||
|
COPY app.py .
|
||||||
|
|
||||||
|
# Expose port
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
# Run the Flask app
|
||||||
|
CMD ["python", "app.py"]
|
||||||
23
app.py
Normal file
23
app.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
from flask import Flask, Response
|
||||||
|
import re
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
HEALTHY_PATTERN = re.compile(r'\[UU\]')
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def check_raid():
|
||||||
|
try:
|
||||||
|
with open('/proc_host/mdstat', 'r') as f:
|
||||||
|
mdstat = f.read()
|
||||||
|
|
||||||
|
if HEALTHY_PATTERN.search(mdstat):
|
||||||
|
return Response("RAID OK", status=200)
|
||||||
|
else:
|
||||||
|
return Response("RAID DEGRADED", status=500)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
return Response(f"Error checking RAID status: {str(e)}", status=500)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app.run(host='0.0.0.0', port=8000)
|
||||||
BIN
raidmonitor.tar
Normal file
BIN
raidmonitor.tar
Normal file
Binary file not shown.
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
flask
|
||||||
Loading…
x
Reference in New Issue
Block a user