Name | kmonitor JSON |
Version |
0.2.12
JSON |
| download |
home_page | None |
Summary | kmonitor is a simple utility wrapper around kubernetes package |
upload_time | 2025-01-29 10:04:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# K8s Monitor
## Description
Simple wrapper around `kubernetes` package to monitor the status of a k8s deployment.
## Installation
```bash
pip install kmonitor --upgrade
```
## Usage
```python
import numpy as np
from kmonitor import KubeMonitor, safe_jsonify
if __name__ == '__main__':
km = KubeMonitor()
pods = km.list_pods()
if pods is not None:
for pod in pods:
print(f"Pod: {pod.metadata.name} in namespace {pod.metadata.namespace} is in phase {pod.status.phase}")
else:
print("Failed to get pods")
namespaces = km.list_namespaces()
if namespaces is not None:
for ns in namespaces:
print(f"Namespace: {ns.metadata.name}")
else:
print("Failed to get namespaces")
nr_pods = len(pods)
idx = np.random.randint(0, nr_pods)
example_pod_name = "basic-test" # pods[idx].metadata.name
print("Checking pod status for pod {}".format(example_pod_name))
status = km.check_pod_by_name(example_pod_name)
print(safe_jsonify(status, indent=2))
example_pod_names = ["nvidia", "calico-node", "emqx"]
print("Checking pod status for pods {}".format(example_pod_names))
status = km.check_pods_by_names(example_pod_names)
print(safe_jsonify(status, indent=2))
```
## Citation
If you use this code in your research, please consider citing it with the following BibTeX entry:
```bibtex
@misc{KMonitor,
author = {Andrei Damian},
title = {kmonitor - a simple K8s monitor framework},
year = {2023-2024},
publisher = {GitHub},
journal = {https://github.com/aidamian/k8s_monitor.git}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "kmonitor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Andrei Ionut Damian <andrei.damian@me.com>",
"download_url": "https://files.pythonhosted.org/packages/1a/6f/d7358895c3692da5cf8a1e2d4d42f7ee9f4d12e7c46de904add9eeeda067/kmonitor-0.2.12.tar.gz",
"platform": null,
"description": "# K8s Monitor \n\n## Description\n\nSimple wrapper around `kubernetes` package to monitor the status of a k8s deployment.\n\n## Installation\n\n```bash\npip install kmonitor --upgrade\n```\n\n## Usage\n\n```python\nimport numpy as np\nfrom kmonitor import KubeMonitor, safe_jsonify\n\n\nif __name__ == '__main__':\n km = KubeMonitor()\n pods = km.list_pods()\n if pods is not None:\n for pod in pods:\n print(f\"Pod: {pod.metadata.name} in namespace {pod.metadata.namespace} is in phase {pod.status.phase}\")\n else:\n print(\"Failed to get pods\")\n\n namespaces = km.list_namespaces()\n if namespaces is not None:\n for ns in namespaces:\n print(f\"Namespace: {ns.metadata.name}\")\n else:\n print(\"Failed to get namespaces\")\n \n nr_pods = len(pods)\n idx = np.random.randint(0, nr_pods)\n example_pod_name = \"basic-test\" # pods[idx].metadata.name\n print(\"Checking pod status for pod {}\".format(example_pod_name))\n status = km.check_pod_by_name(example_pod_name)\n print(safe_jsonify(status, indent=2))\n\n example_pod_names = [\"nvidia\", \"calico-node\", \"emqx\"]\n print(\"Checking pod status for pods {}\".format(example_pod_names))\n status = km.check_pods_by_names(example_pod_names)\n print(safe_jsonify(status, indent=2))\n```\n\n## Citation\n\nIf you use this code in your research, please consider citing it with the following BibTeX entry:\n\n```bibtex\n@misc{KMonitor,\n author = {Andrei Damian},\n title = {kmonitor - a simple K8s monitor framework},\n year = {2023-2024},\n publisher = {GitHub},\n journal = {https://github.com/aidamian/k8s_monitor.git}\n}\n```",
"bugtrack_url": null,
"license": null,
"summary": "kmonitor is a simple utility wrapper around kubernetes package",
"version": "0.2.12",
"project_urls": {
"Bug Tracker": "https://github.com/aidamian/k8s_monitor/issues",
"Homepage": "https://github.com/aidamian/k8s_monitor"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "68d88839edb2ad80065a1e950a0907a23cd28790179f499d54cc150769ca3299",
"md5": "db2dfb585d9da900902a37c6722d208d",
"sha256": "7d34271a41e3dfa626f4d91d5d8814e8201552c7ddb89d02e690e42006e4dcfc"
},
"downloads": -1,
"filename": "kmonitor-0.2.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db2dfb585d9da900902a37c6722d208d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13464,
"upload_time": "2025-01-29T10:04:55",
"upload_time_iso_8601": "2025-01-29T10:04:55.191446Z",
"url": "https://files.pythonhosted.org/packages/68/d8/8839edb2ad80065a1e950a0907a23cd28790179f499d54cc150769ca3299/kmonitor-0.2.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1a6fd7358895c3692da5cf8a1e2d4d42f7ee9f4d12e7c46de904add9eeeda067",
"md5": "ab074b64725a7c6636d08cc59c29e232",
"sha256": "12d94fb1228c8a9e0ffe08a27e4c9f070bd483044631c25d6fe29dd5b52f2eda"
},
"downloads": -1,
"filename": "kmonitor-0.2.12.tar.gz",
"has_sig": false,
"md5_digest": "ab074b64725a7c6636d08cc59c29e232",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 13423,
"upload_time": "2025-01-29T10:04:56",
"upload_time_iso_8601": "2025-01-29T10:04:56.460640Z",
"url": "https://files.pythonhosted.org/packages/1a/6f/d7358895c3692da5cf8a1e2d4d42f7ee9f4d12e7c46de904add9eeeda067/kmonitor-0.2.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-29 10:04:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aidamian",
"github_project": "k8s_monitor",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "kmonitor"
}