mirror of
https://github.com/FAUSheppy/icinga-webhook-gateway
synced 2025-12-06 07:21:38 +01:00
Compare commits
4 Commits
7b5f28651b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 52569c7687 | |||
| d70a37f42c | |||
| 8d6590364f | |||
| dd7a81fd0f |
3
.github/workflows/main.yaml
vendored
3
.github/workflows/main.yaml
vendored
@@ -16,9 +16,6 @@ jobs:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
-
|
||||
name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
@@ -29,7 +29,7 @@ import smarttools
|
||||
app = flask.Flask("Icinga Report In Gateway")
|
||||
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.sqlite'
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('SQLALCHEMY_DATABASE_URI') or 'sqlite:///database.sqlite'
|
||||
app.config['JSON_CONFIG_FILE'] = 'services.json'
|
||||
app.config['JSON_CONFIG_DIR'] = 'config'
|
||||
db = SQLAlchemy(app)
|
||||
@@ -65,12 +65,12 @@ class SMARTStatus(db.Model):
|
||||
|
||||
service = Column(String, primary_key=True)
|
||||
timestamp = Column(Integer, primary_key=True)
|
||||
model_number = Column(String, primary_key=True)
|
||||
power_cycles = Column(Integer)
|
||||
temperature = Column(Integer)
|
||||
available_spare = Column(Integer)
|
||||
unsafe_shutdowns = Column(Integer)
|
||||
critical_warning = Column(Integer)
|
||||
model_number = Column(String)
|
||||
power_cycles = Column(Integer)
|
||||
power_on_hours = Column(Integer)
|
||||
wearleveling_count = Column(Integer)
|
||||
@@ -342,7 +342,7 @@ def default():
|
||||
text, status = record_and_check_smart(verifiedServiceObj,
|
||||
timestamp, smart)
|
||||
|
||||
status = Status(service=service, timestamp=timestamp, status=status,
|
||||
status = Status(service=service, timestamp=timestamp, status=status,
|
||||
info_text=text)
|
||||
db.session.merge(status)
|
||||
db.session.commit()
|
||||
@@ -412,7 +412,7 @@ def record_and_check_smart(service, timestamp, smart):
|
||||
spare_change), "WARNING")
|
||||
|
||||
# unsafe_shutdowns +1 #
|
||||
if(smart_second_last and
|
||||
if(smart_second_last and
|
||||
smart_second_last.unsafe_shutdowns - smart_last.unsafe_shutdowns >= 1):
|
||||
return ("Disk had {} unsafe shutdowns".format(smart_last.unsafe_shutdowns),
|
||||
"WARNING")
|
||||
|
||||
Reference in New Issue
Block a user