gpt4 book ai didi

ubuntu - 使用 jmeter 插件进行 Nagios 测试失败,出现 CRITICAL : . .. java.util.prefs.FileSystemPreferences$1 运行

转载 作者:行者123 更新时间:2023-12-04 09:33:39 27 4
gpt4 key购买 nike

该问题已针对具有 5.4.0-42 通用内核、Nagios 4.4.6、Java 1.8.0_265、Jmeter 5.3 的全新安装和升级的 Lubuntu 20.04 重现。
enter image description here
手动运行此插件时:

user@ubuntu:~$ /usr/bin/perl /usr/local/nagios/libexec/jmeter.pl -j=/usr/local/nagios/share/jmeter -p=/usr/local/nagios/libexec/test.jmx -t 80 -w 90 -c 100
OK : | sum_time=26.91
user@ubuntu:~$ echo $#
0
一旦我得到与上面截图相同的结果,使用 sudo 运行相同的结果,但无法再次重现:
$ sudo /usr/bin/perl /usr/local/nagios/libexec/jmeter.pl -j=/usr/local/nagios/share/jmeter -p=/usr/local/nagios/libexec/test.jmx -t 80 -w 90 -c 100
[sudo] password for user:
CRITICAL: 'java -server -jar /usr/local/nagios/share/jmeter/bin/ApacheJMeter.jar --nongui --propfile /usr/local/nagios/share/jmeter/bin/jmeter.properties --testfile /usr/local/nagios/libexec/test.jmx --logfile /tmp/1597861570.41537.jtl' exit with wait status of 0 Errors Aug 19, 2020 9:26:21 PM java.util.prefs.FileSystemPreferences$1 run

INFO: Created user preferences directory.
为了获得更详细的输出,我在 中启用了调试。 nagios.cfg 文件( debug_level=-1):
[1597866795.863118] [001.0] [pid=44433] handle_async_service_check_result()
[1597866795.863907] [016.0] [pid=44433] ** Handling ACTIVE async check result for service 'Test production jmeter test' on host 'test.company.com' from 'Core Worker 44437'... current state 2 last_hard_state 2
[1597866795.864002] [016.1] [pid=44433] * OPTIONS: 0, SCHEDULED: 1, RESCHEDULE: 1, EXITED OK: 1, RETURN CODE: 2, OUTPUT:
CRITICAL: 'java -server -jar /usr/local/nagios/share/jmeter/bin/ApacheJMeter.jar --nongui --propfile /usr/local/nagios/share/jmeter/bin/jmeter.properties --testfile /usr/local/nagios/libexec/test.jmx --logfile /tmp/1597866748.44494.jtl' exit with wait status of 0 Errors Aug 19, 2020 10:52:34 PM java.util.prefs.FileSystemPreferences$1 run

WARNING: Couldn't create user preferences directory. User preferences are unusable.

Aug 19, 2020 10:52:34 PM java.util.prefs.FileSystemPreferences$1 run

WARNING: java.io.IOException: No such file or directory

Aug 19, 2020 10:53:06 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode

WARNING: Could not lock User prefs. Unix error code 2.

Aug 19, 2020 10:53:06 PM java.util.prefs.FileSystemPreferences syncWorld

WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.


[1597866795.864097] [001.0] [pid=44433] get_service_check_return_code()
[1597866795.864135] [016.1] [pid=44433] Service is in a non-OK state!
[1597866795.864262] [016.1] [pid=44433] Host is currently UP, so we'll recheck its state to make sure...
[1597866795.864337] [016.1] [pid=44433] Service was NOT OK at last check (CRITICAL).
[1597866795.864374] [016.1] [pid=44433] Service is still in a non-OK state (CRITICAL)!

最佳答案

谷歌搜索

WARNING: Could not lock User prefs.  Unix error code 2
通过查看调试日志文件 ( sudo tail -F /usr/local/nagios/var/nagios.debug) 我发现我需要创建 /home/nagios 文件夹:
$ sudo mkdir /home/nagios
$ sudo chmod nagios:nagios /home/nagios
在此之后,在 nagios 服务处理的情况下创建了下一个文件夹:
root@ubuntu:/home/nagios/.java# ls -ailh
total 0
100900054 drwxr-xr-x 4 nagios nagios 44 сер 19 23:23 .
67258544 drwxr-xr-x 3 nagios nagios 87 сер 19 23:24 ..
67261722 drwxr-xr-x 2 root root 52 сер 19 23:23 .systemPrefs
109430 drwx------ 3 nagios nagios 73 сер 19 23:23 .userPrefs
nagios 开始显示 OK地位:
enter image description here
Reference

关于ubuntu - 使用 jmeter 插件进行 Nagios 测试失败,出现 CRITICAL : . .. java.util.prefs.FileSystemPreferences$1 运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62700231/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com