Closed nguyenhuukhoi closed 2 years ago
Hi, the problem is probably that the sqlite database for caching values was created by a different user (for example while running the plugin as root). Now the nagios user has no permissions to write to it. You can try removing it (whatever you'll find on your system, one of those):
rm -f /tmp/linuxfabrik-monitoring-plugins-cpu-usage.db
rm -f /tmp/linuxfabrik-plugin-cache.db
rm -f /tmp/cpu-usage.db
Hi, the problem is probably that the sqlite database for caching values was created by a different user (for example while running the plugin as root). Now the nagios user has no permissions to write to it. You can try removing it (whatever you'll find on your system, one of those):
rm -f /tmp/linuxfabrik-monitoring-plugins-cpu-usage.db rm -f /tmp/linuxfabrik-plugin-cache.db rm -f /tmp/cpu-usage.db
Hello. You are right. I followed your guide and it worked. I feel strange why only this plugin have .db files.
Only the plugins that need data for comparisons from the past have db-files.
Thank you much.
This issue respects the following points:
Bug description
When excute : /usr/lib64/nagios/plugins/cpu-usage --count 5 --critical 90 --warning 80 with "nagios" user on Icinga2 server. I can use this plugin with other user.
Steps to reproduce - Plugin call
Steps to reproduce - Plugin Version
cpu-usage: v2022071801 by Linuxfabrik GmbH, Zurich/Switzerland
Steps to reproduce - Data
Query failed: INSERT INTO "perfdata" (cpu_usage,guest,guest_nice,iowait,irq,nice,softirq,steal,system,user) VALUES (:cpu_usage,:guest,:guest_nice,:iowait,:irq,:nice,:softirq,:steal,:system,:user);, Error: attempt to write a readonly database, Data: {'cpu_usage': 0.2, 'guest': 0.0, 'guest_nice': 0.0, 'iowait': 0.0, 'irq': 0.0, 'nice': 0.0, 'softirq': 0.0, 'steal': 0.0, 'system': 0.1, 'user': 0.1}
Python version
Python 3
Environment
Ubuntu 22.04 Linux 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Application
Icinga2 Build information: Compiler: GNU 11.2.0 Build host: runner-hh8q3bz2-project-298-concurrent-0 OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
Python modules
Package Version
antiorm 1.2.1 attrs 21.2.0 Automat 20.2.0 Babel 2.8.0 bcrypt 3.2.0 blinker 1.4 certifi 2020.6.20 chardet 4.0.0 click 8.0.3 cloud-init 22.2 colorama 0.4.4 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 3.4.8 db 0.1.1 dbus-python 1.2.18 distro 1.7.0 distro-info 1.1build1 gpg 1.16.0-unknown httplib2 0.20.2 hyperlink 21.0.0 idna 3.3 importlib-metadata 4.6.4 incremental 21.3.0 jeepney 0.7.1 Jinja2 3.0.3 jsonpatch 1.32 jsonpointer 2.0 jsonschema 3.2.0 keyring 23.5.0 launchpadlib 1.10.16 lazr.restfulclient 0.14.4 lazr.uri 1.0.6 MarkupSafe 2.0.1 more-itertools 8.10.0 netifaces 0.11.0 nftables 0.1 oauthlib 3.2.0 pexpect 4.8.0 pip 22.0.2 ptyprocess 0.7.0 pyasn1 0.4.8 pyasn1-modules 0.2.1 PyGObject 3.42.1 PyHamcrest 2.0.2 PyJWT 2.3.0 pyOpenSSL 21.0.0 pyparsing 2.4.7 pyrsistent 0.18.1 pyserial 3.5 python-apt 2.3.0+ubuntu2.1 python-debian 0.1.43ubuntu1 pytz 2022.1 PyYAML 5.4.1 requests 2.25.1 SecretStorage 3.3.1 service-identity 18.1.0 setuptools 59.6.0 six 1.16.0 sos 4.3 ssh-import-id 5.11 systemd-python 234 Twisted 22.1.0 ubuntu-advantage-tools 27.10 ubuntu-drivers-common 0.0.0 ufw 0.36.1 unattended-upgrades 0.1 urllib3 1.26.5 wadllib 1.3.6 wheel 0.37.1 xkit 0.0.0 zipp 1.0.0 zope.interface 5.4.0
Additional info
No response