Issue running solaris_exporter
srdennis03 opened this issue · 4 comments
Hi,
I have run into a similar issue as seen previously by others with traceback errors when running solaris_exporter.py.
The errors seen are: -
admin@XXXXXX:/solaris_exporter$ python2 solaris_exporter.py/solaris_exporter$
couldn't set locale correctly
Traceback (most recent call last):
File "solaris_exporter.py", line 1040, in
REGISTRY.register(c)
File "/export/home/admin/.local/lib/python2.7/site-packages/prometheus_client/registry.py", line 26, in register
names = self._get_names(collector)
File "/export/home/admin/.local/lib/python2.7/site-packages/prometheus_client/registry.py", line 66, in _get_names
for metric in desc_func():
File "solaris_exporter.py", line 441, in collect
swap = psutil.swap_memory()
File "/export/home/admin/.local/lib/python2.7/site-packages/psutil/init.py", line 2000, in swap_memory
return _psplatform.swap_memory()
File "/export/home/admin/.local/lib/python2.7/site-packages/psutil/_pssunos.py", line 160, in swap_memory
free += int(int(f) * 512)
ValueError: invalid literal for int() with base 10: 'yes'
admin@XXXXXX:
In terms of the system I am trying to run this on, the following shows the environment and the installation process for the various components installed: -
admin@XXXXXX:$ cat /etc/release$ uname -a
Oracle Solaris 11.4 SPARC
Copyright (c) 1983, 2021, Oracle and/or its affiliates.
Assembled 15 December 2021
admin@XXXXXX:
SunOS XXXXXX 5.11 11.4.41.107.2 sun4v sparc sun4v non-virtualized
admin@XXXXXX:~$
admin@XXXXXX:$ export https_proxy=http://www-proxy.us.oracle.com:80$ python2 -m pip install prometheus_client
admin@XXXXXX:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
couldn't set locale correctly
Collecting prometheus_client
Downloading prometheus_client-0.12.0-py2.py3-none-any.whl (57 kB)
|################################| 57 kB 993 kB/s
Installing collected packages: prometheus-client
Successfully installed prometheus-client-0.12.0
admin@XXXXXX:~$ sudo pkg install pkg:/developer/gcc
Password:
Failed to set locale: unsupported locale setting. Falling back to C.
pkg: Unable to set locale 'en_GB.UTF-8'; locale package may be broken or
not installed. Reverting to C locale.
Packages to install: 19
Mediators to change: 2
Services to change: 1
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 19/19 1974/1974 677.7/677.7 35.4M/s
PHASE ITEMS
Installing new actions 2553/2553
Updating package state database Done
Updating package cache 0/0
Updating image state Done
Creating fast lookup database Done
Updating package cache 1/1
admin@XXXXXX:$ which gcc$ sudo ln -s /usr/bin/gcc /usr/bin/cc
/usr/bin/gcc
admin@XXXXXX:
Password:
admin@XXXXXX:$ export CFLAGS=-m32$ python2 -m pip install psutil==5.7.0
admin@XXXXXX:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
couldn't set locale correctly
Collecting psutil==5.7.0
Downloading psutil-5.7.0.tar.gz (449 kB)
|################################| 449 kB 6.4 MB/s
Using legacy 'setup.py install' for psutil, since package 'wheel' is not installed.
Installing collected packages: psutil
Running setup.py install for psutil ... done
Successfully installed psutil-5.7.0
admin@XXXXXX:~$
Can you help and let me know what I've done wrong ?
Steve Dennis
Hello,
This issue is driven by some changes is OS.
Max Solaris version on my hosts is 11.4.4, it works with Solaris_exporter v2021Mar01.
But this issue is the second, so I will install new test LDOM with 11.4.41 and try to improve code.
I hope that the fault is not in psutil library which I use, but which author has no time or HW to code for Solaris.
I investigated.
The old version of psutil fails due to changes in command output:
New variant:
# swap -l
swapfile dev swaplo blocks free encrypted
/dev/zvol/dsk/bercutroot/swap 248,4 0 8388608 8388608 yes
Old variant:
$ swap -l
swapfile dev swaplo blocks free
/dev/zvol/dsk/swapdump/swap 259,1 16 136314864 136314864
The latest version of psutil library 5.9.0 is adapted to this behavior, but the latest version of psutil not supports Python 2.7.
That is why I copied psutil code to local function psutil_local_swap_memory and adapted it.
Also I added support for Python3.7.
Please test new version v2022Feb05, I placed it into separate branch forPython3.
Just tested the python2.7 version - all working well
i will move on to test the python3.7 version
Tested and working on SPARC Solaris 11.4 (11.4.36.101) using python 3.7.10
Many thanks