eslam-gomaa / kptop

A Python tool that offers beautiful CLI monitoring based on Prometheus metrics, with Kubernetes integration through PodPortForward
https://eslam-gomaa.github.io/kptop/
GNU General Public License v3.0
277 stars 11 forks source link

Getting application errors when executing kptop command #28

Closed Mounikaaakurathi closed 1 year ago

Mounikaaakurathi commented 1 year ago

I have installed kptop and added env variable for KPTOP_PROMETHEUS_SERVER with prometheus endpoint on AKs cluster, and getting below errors can u please help out here.

File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kptop_tool.py", line 6, in run() File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kptop_tool.py", line 3, in run from kubePtop.cli import Cli File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\cli.py", line 184, in cli = Cli() File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\cli.py", line 77, in init pod_metrics.topPodTable(namespace=ns,sort_by_mem_usage=self.sort_by_mem_usage) File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\pod_metrics.py", line 1052, in topPodTable pods_json = self.topPod(namespace=namespace, sort_by_mem_usage=sort_by_mem_usage) File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\pod_metrics.py", line 967, in topPod memory_limit = self.run_query(memory_limit_query) File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\session.py", line 120, in run_query return json.loads(req.text) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\json\init.py", line 346, in loads return _default_decoder.decode(s) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


PS C:\Users\Mounika.Akurathi> kptop --verify-prometheus

Verifying Prometheus connection: Connected { "connected": true, "status_code": 200, run() File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kptop_tool.py", line 3, in run verify_node_exporter = self.verifyNodeExporter() File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\session.py", line 148, in verifyNodeExporter File "C:\Users\Mounika.Akurathi\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\kubePtop\session.py", line 120, in run_query return json.loads(req.text) return _default_decoder.decode(s) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

eslam-gomaa commented 1 year ago

Hi @Mounikaaakurathi , Let me test the tool on Windows and get back to you

Mounikaaakurathi commented 1 year ago

Hi @eslam-gomaa Thanks!!

eslam-gomaa commented 1 year ago

Hi @Mounikaaakurathi, kindly try the new release

pip3 install kptop==0.0.6 --upgrade

In case it didn't work, I see you're using "Python.3.10" the problem seems to be that the "json" built-in library is not compatible. hence I believe it should work if you use lower Python version (I've tested it on Python3.6 & Python 3.7)

Mounikaaakurathi commented 1 year ago

Sure @eslam-gomaa , will try and get back t u Thank You!!