Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
0deb810a
Commit
0deb810a
authored
Jan 30, 2023
by
Lu Xu
👀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
d96b041f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+1
-1
software/ors-amarisoft/promise/check_vswr.py
software/ors-amarisoft/promise/check_vswr.py
+29
-14
No files found.
software/ors-amarisoft/buildout.hash.cfg
View file @
0deb810a
...
...
@@ -124,4 +124,4 @@ md5sum = 44ae5693f62b7a4dbc98f700f68d8600
[vswr-promise]
_update_hash_filename_ = promise/check_vswr.py
md5sum =
b5079f4013c59e2e21081e4fef2898c1
md5sum =
9778f2da6777a11568b4e36f20ae8500
software/ors-amarisoft/promise/check_vswr.py
View file @
0deb810a
...
...
@@ -2,6 +2,7 @@ import errno
import
json
import
logging
import
os
import
time
from
dateutil
import
parser
...
...
@@ -71,7 +72,7 @@ class RunPromise(GenericPromise):
return
lopcomm_stats_log
=
self
.
getConfig
(
'lopcomm-stats-log'
)
data_list
=
get_data_interval
(
lopcomm_stats_log
,
120
)
# notifications = []
# fault_texts = []
# Example of data_list
#('[\n'
...
...
@@ -94,19 +95,33 @@ class RunPromise(GenericPromise):
# ' }\n'
# ' },\n'
# ']')
if
data_list
:
for
data
in
data_list
:
notification
=
data
[
'notification'
]
alarm_notif
=
notification
[
'alarm-notif'
]
fault_texts
=
alarm_notif
[
'fault-text'
]
if
'VSWR'
in
fault_texts
:
self
.
logger
.
error
(
"lopcomm error:"
+
fault_texts
)
else
:
self
.
logger
.
info
(
"OK"
)
else
:
self
.
logger
.
info
(
"No notification, all good"
)
fault_text_list
=
[]
alarm
=
False
for
data
in
data_list
:
notifications
=
data
[
'notification'
]
alarm_notifs
=
notifications
[
'alarm-notif'
]
fault_texts
=
alarm_notifs
[
'fault-text'
]
fault_sources
=
alarm_notifs
[
'fault-source'
]
event_time
=
alarm_notifs
[
'event-time'
]
if
not
fault_text_list
:
fault_text_list
=
[
"None"
,]
for
i
,
fault_text
in
enumerate
(
fault_texts
):
if
'VSWR'
in
fault_text
:
alarm
=
True
if
not
fault_text_list
:
self
.
logger
.
error
(
"No notification available"
)
elif
alarm
:
self
.
logger
.
error
(
fault_source
+
": "
+
fault_text
)
else
:
self
.
logger
.
info
(
"No VSWR alarm detected"
)
now
=
time
.
time
()
event_time_seconds
=
time
.
mktime
(
time
.
strptime
(
event_time
,
"%Y-%m-%dT%H:%M:%SZ"
))
if
now
-
event_time_seconds
>=
300
:
alarm
=
False
time
.
sleep
(
1
)
def
test
(
self
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment