sysview-py 0.4.0__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sysview_py-0.4.0 → sysview_py-0.4.2}/PKG-INFO +1 -1
- {sysview_py-0.4.0 → sysview_py-0.4.2}/pyproject.toml +1 -1
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/db.py +7 -5
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/sysview.py +8 -6
- {sysview_py-0.4.0 → sysview_py-0.4.2}/README.md +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/__init__.py +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/flock.py +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/main.py +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/report.py +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/static/simple.css +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/static/sysview.css +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/templates/card_view.html +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/templates/footer.html +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/templates/header.html +0 -0
- {sysview_py-0.4.0 → sysview_py-0.4.2}/src/sysview_py/templates/service.html +0 -0
|
@@ -51,10 +51,11 @@ class SysviewDB:
|
|
|
51
51
|
reports = []
|
|
52
52
|
host_types = self.get_types(hostname)
|
|
53
53
|
for host_type in host_types:
|
|
54
|
-
sql = f"SELECT rowid,raw_report from reports WHERE type = '{host_type}' AND hostname= '{hostname}' ORDER BY rowid DESC LIMIT 1"
|
|
55
|
-
report_id, latest_report = self._cursor.execute(sql).fetchone()
|
|
54
|
+
sql = f"SELECT rowid,raw_report,date from reports WHERE type = '{host_type}' AND hostname= '{hostname}' ORDER BY rowid DESC LIMIT 1"
|
|
55
|
+
report_id, latest_report, report_date = self._cursor.execute(sql).fetchone()
|
|
56
56
|
latest_report = Report(raw_report=latest_report, report_id=report_id)
|
|
57
57
|
latest_report.parse()
|
|
58
|
+
latest_report.date = datetime.datetime.fromtimestamp(report_date)
|
|
58
59
|
reports.append(latest_report)
|
|
59
60
|
return reports
|
|
60
61
|
|
|
@@ -89,7 +90,7 @@ class SysviewDB:
|
|
|
89
90
|
self._connection.commit()
|
|
90
91
|
|
|
91
92
|
def get_last_changed_item(self, item):
|
|
92
|
-
sql = f"SELECT report_id,raw_item FROM items WHERE command = '{item.command}' AND hostname = '{item.host}' AND NOT status = '{item.status}' ORDER BY rowid DESC LIMIT 1"
|
|
93
|
+
sql = f"SELECT report_id,raw_item FROM items WHERE command = '{item.command}' AND hostname = '{item.host}' AND NOT status = '{item.status} AND report_id < {item.report_id}' ORDER BY rowid DESC LIMIT 1"
|
|
93
94
|
last_changed_item = self._cursor.execute(sql).fetchone()
|
|
94
95
|
if last_changed_item is not None:
|
|
95
96
|
report_id = last_changed_item[0]
|
|
@@ -97,10 +98,11 @@ class SysviewDB:
|
|
|
97
98
|
last_changed_item = ReportItem(raw_item, report_id=report_id)
|
|
98
99
|
last_changed_item.parse()
|
|
99
100
|
sql = f"SELECT date FROM reports WHERE rowid = '{last_changed_item.report_id}'"
|
|
100
|
-
report_date = datetime.datetime.
|
|
101
|
-
self._cursor.execute(sql).fetchone()[0]
|
|
101
|
+
report_date = datetime.datetime.fromtimestamp(
|
|
102
|
+
self._cursor.execute(sql).fetchone()[0],
|
|
102
103
|
)
|
|
103
104
|
last_changed_item.date = report_date
|
|
105
|
+
last_changed_item.host = item.host
|
|
104
106
|
return last_changed_item
|
|
105
107
|
|
|
106
108
|
def get_item_history(self, item, max_len=10):
|
|
@@ -58,12 +58,8 @@ class Sysview:
|
|
|
58
58
|
env = Environment(
|
|
59
59
|
loader=PackageLoader("sysview_py"), autoescape=select_autoescape()
|
|
60
60
|
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
64
|
-
html_path = self.html_root / "index.html"
|
|
65
|
-
with open(html_path, "w") as f:
|
|
66
|
-
f.write(html)
|
|
61
|
+
for host in self.hosts:
|
|
62
|
+
host.all_items
|
|
67
63
|
for host in self.hosts:
|
|
68
64
|
html = env.get_template("card_view.html").render(
|
|
69
65
|
items=host.all_items,
|
|
@@ -103,6 +99,12 @@ class Sysview:
|
|
|
103
99
|
html_path = self.html_root / f"services.html"
|
|
104
100
|
with open(html_path, "w") as f:
|
|
105
101
|
f.write(html)
|
|
102
|
+
html = env.get_template("card_view.html").render(
|
|
103
|
+
items=self.hosts, title="Hosts", active="Hosts", path="", auto_refresh=True
|
|
104
|
+
)
|
|
105
|
+
html_path = self.html_root / "index.html"
|
|
106
|
+
with open(html_path, "w") as f:
|
|
107
|
+
f.write(html)
|
|
106
108
|
|
|
107
109
|
def get_latest_reports(self):
|
|
108
110
|
for host in self.hosts:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|