ERROR:500 INTERNAL SERVER ERROR%

Home Forums Help ERROR:500 INTERNAL SERVER ERROR%

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #786
    palouf34
    Participant

    Hi,

    I’m good install vmic_server, the test script is ok.
    I’m install the last version 1.68

    this verification of good version of perl module :

     ./check_wmi_plus.pl -d -d | head -n 25
    Command Line (v1.68): ./check_wmi_plus.pl -d -d
    Base Dir: /usr/lib/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
    HTTP::Request::Common                6.36      ok          0
    DateTime                             1.58      ok       0.66
    Getopt::Long                         2.52      ok       2.38
    Perl Version                     5.034000      ok       5.01
    Storable                             3.23      ok       2.22
    Scalar::Util                         1.55      ok       1.22
    Number::Format                       1.75      ok       1.73
    Config::IniFiles                 3.000003      ok       2.58
    LWP::UserAgent                       6.67      ok          0
    JSON                                 4.09      ok          0
    Data::Dumper                        2.179      ok      2.125
    Net::DNS -
    --------------------- Environment ---------------------
    ENV=$VAR1 = {
              'MOTD_SHOWN' => 'pam',
              'SSH_TTY' => '/dev/pts/0',
              'PLUGINS' => '/usr/lib/nagios/plugins',
    
    

    now I’m launch one wmi_check and don’t run

     ./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%
    

    Have you one idea for this bug?

    Best regards.

    • This topic was modified 1 year ago by palouf34.
    #800
    hsz
    Participant

    Have you checked logs of the wmic server itself? Is it even installed? Can you query the host with the wmic server itself?

    #802
    palouf34
    Participant

    I have set up the new wmic system because our monitoring is not working anymore since a windows update, which blocks the integration.

    Our wmi monitors had been working for about 8 years.

    #817
    admin
    Keymaster

    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%

    Please make sure that you have performed the testing on the wmic server as per https://github.com/cesbit/aiowmi/tree/main/contrib/wmic_server#testing-the-server

    #822
    palouf34
    Participant

    hi,

    this test is ok.

    I’m make this test whith check_wmi_plus.pl and obtaaint this response

    [code]{./check_wmi_plus.pl -H 10.83.23.3 -m checkeventlog -a Application,1,12
    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%
    ➜ plugins ./check_wmi_plus.pl -H 10.83.23.3 -u user1 -m checkeventlog -a Application,1,12
    UNKNOWN – The WMI query had problems. The target host (10.83.23.3) did not allow our network connection. Is it running? It seems to be a valid name/IP Address. A firewall might be blocking us. There might be some critical services not running. Is it even running Windows? Wmic error text on the next line.
    Problem with connection to target host. [Errno 113] Connect call failed (‘10.83.23.3’, 135)%
    }[/code]

    best regard.

    • This reply was modified 11 months, 2 weeks ago by palouf34.
    • This reply was modified 11 months, 2 weeks ago by palouf34.
    • This reply was modified 11 months, 2 weeks ago by palouf34.
    • This reply was modified 11 months, 2 weeks ago by palouf34.
    #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

    #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’

    #838
    admin
    Keymaster

    @palouf34:

    Problem with connection to target host. [Errno 113] Connect call failed (‘10.83.23.3’, 135)%

    Please make sure that you have performed the testing on the wmic server as per https://github.com/cesbit/aiowmi/tree/main/contrib/wmic_server#testing-the-server

    Also, please run that same testing from the nagios server to the wmic_server

    • This reply was modified 11 months ago by admin.
    #841
    admin
    Keymaster

    @gmourani

    ./check_wmi_plus.pl -d -d | head -n 25
    Command Line (v1.68): ./check_wmi_plus.pl -d -d

    Can you please provide all the output from the above?

    ./wmic_client.sh -i user1 -h 172.31.1.45 -q ‘SELECT * FROM Win32_UTCTime’

    Can you please run the above from the nagios server?

    #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 ~]#

    #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}]

    #847
    admin
    Keymaster

    /usr/lib64/nagios/plugins/check_wmi_plus.pl -d -d | head -n 25

    Sorry, I was not clear.
    Please provide all the output from a complete run of the plugin which does a WMI check and sends a command to the wmic server, using -d -d.

    eg check_wmi_plus.pl -H HOST -u USER -p TOKEN -m checkdrivesize -a . -d -d

    #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,

    #851
    admin
    Keymaster

    -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

    This requirement is documented in the –help output of check_wmi_plus.pl

    
           REQUIRED  OPTIONS  FOR WMIC Server 
    These only apply if using the new WMIC Server You must specify username/password/domain (referred to as auth info) in the
           WMIC Server configuration. Check WMI PLus does not hold auth info. It only points to the auth info in the WMIC Server.  You must point to the auth info  us‐
           ing an identifier that matches one in the WMIC Server configuration.
    
                  -u ID  specify the identifier for the auth info that matches the one defined in the WMIC Server
    
                  -p TOKEN
                         specific  the token required to authenticate to the WMIC Server. This is not Windows authentication information. The tokens are defined in the
                         WMIC Server configuration
    
    • This reply was modified 10 months, 4 weeks ago by admin.
    • This reply was modified 10 months, 4 weeks ago by admin.
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.