Closed ghost closed 9 years ago
Or even better change the locale for the runtime:
LC_ALL=C apt-get upgrade -s
http://unix.stackexchange.com/questions/87745/what-does-lc-all-c-do
Hi, sorry for the delayed reply, was on vacation. Thank you for the feedback on the sensor, I will implement the proposed changes in the next version. To get the sensor running correctly for now, please open the file apt.py and change the line:
ret = os.popen("apt-get -s dist-upgrade | grep 'newly inst'")
to
if locale == "en_GB.UTF-8" or "'en_US.UTF-8'": ret = os.popen("apt-get -s dist-upgrade | grep 'newly inst'") elif locale == "de_DE.UTF-8": ret = os.popen("apt-get -s dist-upgrade | grep 'neu inst'") else: raise Exception
This fix will go to the development branch soon. I'm planning to do this by checking the locale rather than changing it.
Hi Konstantin,
i hope you had a good time!
Thank you for the implementation of a solution. This solution sure works for us because we are using german and english systems. But i think you should considering using "LC_ALL=C" so it will work for every localised system.
We are planning to add a new sensor for softwareraidchecks (mdadm) to a fork and send you a pull request in the next day. Hope you can have a look on it.
Hey, I'll give your proposal a try although I will have to get this tested first. If this works, you can expect a new development release within the next week. :) Also looking forward to your Pull request.
Proposed change is available in this branch. Could you check if this works for your, if ok I'm going to merge this to development.
Hi Konstantin,
we tested the changes (apt sensor and mdadm) from the dev_apt_sensor-branch and it works like a charm.
Thank you!
Nice, I'm glad it's working now. So I'll close this issue for now.
Hello,
thank you for providing the PythonMiniProbe! Its really helpfull for us to monitor linux-systems with PRTG. Keep up the great work!
We want to use the "apt"-sensor on systems with the default language "german" but this wont work. The reason is, that the sensor "apt" uses "apt-get -s dist-upgrade | grep 'newly inst'" to determine the line with all information about available updates - in other language "newly installed" is simply translated to the setted language.
Maybe - as easy way for the beginning - you should just use "locale" to check the current setted language and throw an error? Or just search for the line "* upgraded, * newly installed, * to remove and * not upgraded." - whent this line is not in the output the sensor should fail.
At the moment the sensor shows no error - for a security relevant sensor not the best output when not working ;-)
What do you think?