-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
284 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
ntpmon (3.0.6-1) focal; urgency=medium | ||
|
||
* New upstream release. | ||
|
||
-- Paul Gear <[email protected]> Wed, 03 Jan 2024 07:17:49 +1000 | ||
|
||
ntpmon (3.0.5-1) focal; urgency=medium | ||
|
||
* New upstream release. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ Upstream-Author: Paul Gear <[email protected]> | |
Source: https://github.com/paulgear/ntpmon | ||
|
||
Files: * | ||
Copyright: 2015-2023 Paul D. Gear. | ||
Copyright: 2015-2024 Paul D. Gear. | ||
License: AGPL-3.0+ | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright: (c) 2024 Paul D. Gear | ||
# License: AGPLv3 <http://www.gnu.org/licenses/agpl.html> | ||
|
||
import platform | ||
import re | ||
import time | ||
|
||
from typing import Dict | ||
|
||
import psutil | ||
|
||
import process | ||
import version as ntpmon_version | ||
|
||
_static_info = None | ||
|
||
|
||
def get_info(implementation: str, version: str) -> Dict[str, str]: | ||
"""Collect the platform and process info metrics.""" | ||
global _static_info | ||
if _static_info is None: | ||
_static_info = { | ||
"ntpmon_version": ntpmon_version.get_version(), | ||
"platform_machine": platform.machine(), | ||
"platform_release": platform.release(), | ||
"platform_system": platform.system(), | ||
"python_version": platform.python_version(), | ||
} | ||
|
||
this_process = psutil.Process() | ||
memory = this_process.memory_info() | ||
uptime = time.time() - this_process.create_time() | ||
|
||
dynamic_info = { | ||
"implementation_name": implementation, | ||
"implementation_version": extract_version(version), | ||
"ntpmon_rss": memory.rss, | ||
"ntpmon_uptime": uptime, | ||
"ntpmon_vms": memory.vms, | ||
} | ||
|
||
dynamic_info.update(_static_info) | ||
return dynamic_info | ||
|
||
|
||
_version_re = re.compile(r"\b\d\S+") | ||
|
||
|
||
def extract_version(rawversion: str) -> str: | ||
"""Extract the version string from the line. Raise ValueError if no match.""" | ||
return _version_re.search(rawversion).group() | ||
|
||
|
||
if __name__ == "__main__": | ||
i = process.get_implementation() | ||
v = process.execute("version")[0][0] | ||
print(get_info(implementation=i, version=v)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.