gmourani

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: ERROR:500 INTERNAL SERVER ERROR% #849
    gmourani
    Participant

    Hello,

    It works, the problem was that it was necessary to add in the command line check_wmi_plus.pl the option -u user1 so that it uses the credentials of the user in question. I never put this option because not explain in the guide and on the site. Now and without any modification, adding the -u username option makes it work, thanks.

    Regards,

    in reply to: ERROR:500 INTERNAL SERVER ERROR% #845
    gmourani
    Participant

    [root@localhost ~]# /usr/lib64/nagios/plugins/wmic_client.sh -i user1 -h 172.31.1.45 -q ‘SELECT * FROM Win32_UTCTime’
    HTTP/1.1 200 OK
    Server: gunicorn
    Date: Sat, 24 Sep 2022 19:41:51 GMT
    Connection: close
    Content-Type: text/html; charset=utf-8
    Content-Length: 145

    [{“Year”: 2022, “Month”: 9, “Day”: 25, “DayOfWeek”: 0, “WeekInMonth”: 5, “Quarter”: 3, “Hour”: 1, “Minute”: 46, “Second”: 13, “Milliseconds”: 0}]

    in reply to: ERROR:500 INTERNAL SERVER ERROR% #843
    gmourani
    Participant

    [root@localhost ~]# /usr/lib64/nagios/plugins/check_wmi_plus.pl -d -d | head -n 25
    Command Line (v1.68): /usr/lib64/nagios/plugins/check_wmi_plus.pl -d -d
    Base Dir: /usr/lib64/nagios/plugins
    Conf File Dir: /etc/check_wmi_plus
    Loaded Conf File /etc/check_wmi_plus/check_wmi_plus.conf
    WMI Ini Dir: /etc/check_wmi_plus/check_wmi_plus.d
    ======================================== SYSTEM INFO =====================================================
    ——————— Module Versions ———————
    MODULE_NAME INSTALLED_VERSION STATUS DESIRED_VERSION
    LWP::UserAgent 6.34 ok 0
    DateTime 1.50 ok 0.66
    HTTP::Request::Common 6.18 ok 0
    Perl Version 5.026003 ok 5.01
    Data::Dumper 2.167 ok 2.125
    Config::IniFiles 3.000002 ok 2.58
    JSON 2.97001 ok 0
    Storable 3.11 ok 2.22
    Number::Format 1.75 ok 1.73
    Getopt::Long 2.5 ok 2.38
    Scalar::Util 1.56 ok 1.22
    Net::DNS –
    ——————— Environment ———————
    ENV=$VAR1 = {
    ‘_’ => ‘/usr/lib64/nagios/plugins/check_wmi_plus.pl’,
    ‘XDG_RUNTIME_DIR’ => ‘/run/user/0’,
    ‘PATH’ => ‘/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin’,
    [root@localhost ~]#

    in reply to: ERROR:500 INTERNAL SERVER ERROR% #836
    gmourani
    Participant

    Also, I get these errors in /var/log/messages :
    Sep 22 15:52:32 localhost nice[255092]: [2022-09-22 15:52:32,674] ERROR in app: Exception on /wmic [POST]
    Sep 22 15:52:32 localhost nice[255092]: Traceback (most recent call last):
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib/python3.8/site-packages/flask/app.py”, line 2525, in wsgi_app
    Sep 22 15:52:32 localhost nice[255092]: response = self.full_dispatch_request()
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib/python3.8/site-packages/flask/app.py”, line 1822, in full_dispatch_request
    Sep 22 15:52:32 localhost nice[255092]: rv = self.handle_user_exception(e)
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib/python3.8/site-packages/flask/app.py”, line 1820, in full_dispatch_request
    Sep 22 15:52:32 localhost nice[255092]: rv = self.dispatch_request()
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib/python3.8/site-packages/flask/app.py”, line 1796, in dispatch_request
    Sep 22 15:52:32 localhost nice[255092]: return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/aiowmi/contrib/wmic_server/wmic_server.py”, line 130, in wmic
    Sep 22 15:52:32 localhost nice[255092]: return asyncio.run(wmic_core())
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib64/python3.8/asyncio/runners.py”, line 44, in run
    Sep 22 15:52:32 localhost nice[255092]: return loop.run_until_complete(main)
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/lib64/python3.8/asyncio/base_events.py”, line 616, in run_until_complete
    Sep 22 15:52:32 localhost nice[255092]: return future.result()
    Sep 22 15:52:32 localhost nice[255092]: File “/usr/aiowmi/contrib/wmic_server/wmic_server.py”, line 205, in wmic_core
    Sep 22 15:52:32 localhost nice[255092]: username = cfg[id][“user”]
    Sep 22 15:52:32 localhost nice[255092]: KeyError: ‘administrator’

    in reply to: ERROR:500 INTERNAL SERVER ERROR% #834
    gmourani
    Participant

    Hello,

    I’ve the same problem.
    Using check_wmi_plus.pl version 1.68

    aiowmi installed under /usr/aiowmi
    /usr/aiowmi/aiowmi/*
    /usr/aiowmi/contrib/wmic_server/__pycache__
    /usr/aiowmi/contrib/wmic_server/wmic_server.py
    /usr/aiowmi/contrib/wmic_server/wmic_server.yaml

    /etc/check_wmi_plus/check_wmi_plus.conf
    /etc/check_wmi_plus/check_wmi_plus.d/*.ini and *.chtml
    /etc/check_wmi_plus/check_wmi_plus.data/check_wmi_plus.compiledini

    /usr/lib64/nagios/plugins/check_wmi_plus.pl
    /usr/lib64/nagios/plugins/check_wmi_plus_help.pl
    /usr/lib64/nagios/plugins/check_wmi_plus.makeman.sh

    Checking if all in place :
    ./check_wmi_plus.pl -d -d | head -n 25
    Command Line (v1.68): ./check_wmi_plus.pl -d -d
    Base Dir: /usr/lib64/nagios/plugins
    Conf File Dir: /etc/check_wmi_plus
    Loaded Conf File /etc/check_wmi_plus/check_wmi_plus.conf
    WMI Ini Dir: /etc/check_wmi_plus/check_wmi_plus.d
    ======================================== SYSTEM INFO =====================================================
    ——————— Module Versions ———————
    MODULE_NAME INSTALLED_VERSION STATUS DESIRED_VERSION
    Number::Format 1.75 ok 1.73
    Config::IniFiles 3.000002 ok 2.58
    LWP::UserAgent 6.34 ok 0
    Perl Version 5.026003 ok 5.01
    JSON 2.97001 ok 0
    HTTP::Request::Common 6.18 ok 0
    Scalar::Util 1.56 ok 1.22
    Data::Dumper 2.167 ok 2.125
    DateTime 1.50 ok 0.66
    Storable 3.11 ok 2.22
    Getopt::Long 2.5 ok 2.38
    Net::DNS –
    ——————— Environment ———————
    ENV=$VAR1 = {
    ‘which_declare’ => ‘declare -f’,
    ‘PATH’ => ‘/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin’,
    ‘SSH_TTY’ => ‘/dev/pts/0’,

    Content of my /usr/aiowmi/contrib/wmic_server/wmic_server.yaml:
    user1:
    user: administrator
    pass: passwd

    validation:
    id:
    # includes only alpha,digits,-,_
    – ^[a-z0-9\-_]+$
    token:
    # includes only alpha,digits,-,_
    – ^[a-z0-9\-_]+$
    host:
    # includes only alpha,digits,. or –
    – ^[a-z0-9\.\-]+$
    query:
    # format like SELECT something FROM something
    – ^select.+from)
    – OTHERREGEX
    namespace:
    # format like alpha or digits then a “/” followed by alpha or digits
    – ^[a-z0-9]+/[a-z0-9]+$

    Using netstat ccommand to be sure that wmi_server is running and listening:
    netstat -nlp
    tcp 0 0 127.0.0.1:2313 0.0.0.0:* LISTEN 222771/python3.8

    Using ps command to see wmi_server processes running too:
    ps ax
    222771 ? SNs 0:00 /usr/bin/python3.8 /usr/bin/gunicorn -b 127.0.0.1:2313 –pythonpath /usr/aiowmi/contrib/wmic_server –threads 1 wmic_server:app
    222773 ? SN 0:01 /usr/bin/python3.8 /usr/bin/gunicorn -b 127.0.0.1:2313 –pythonpath /usr/aiowmi/contrib/wmic_server –threads 1 wmic_server:app

    Testing with original wmic_client.sh script to connect to remote Windows server
    ./wmic_client.sh -i user1 -h 172.31.1.45 -q ‘SELECT * FROM Win32_UTCTime’
    HTTP/1.1 200 OK
    Server: gunicorn
    Date: Thu, 22 Sep 2022 19:18:12 GMT
    Connection: close
    Content-Type: text/html; charset=utf-8
    Content-Length: 145

    [{“Year”: 2022, “Month”: 9, “Day”: 23, “DayOfWeek”: 5, “WeekInMonth”: 4, “Quarter”: 3, “Hour”: 1, “Minute”: 22, “Second”: 43, “Milliseconds”: 0}]

    Testing now with latest check_wmi_plus.pl script and receive ERROR: 500 ….
    ./check_wmi_plus.pl -H IP -m checkcpu
    UNKNOWN – The WMI query had problems. Something is probably wrong with the wmic_server (http://127.0.0.1:2313/wmic)
    ERROR:500 INTERNAL SERVER ERROR

Viewing 5 posts - 1 through 5 (of 5 total)