centreon / centreon-nsclient-build

Source use to build the centreon NSClient agent
19 stars 3 forks source link

os::windows::local::plugin session mode #12

Closed Cool34000 closed 4 years ago

Cool34000 commented 4 years ago

Hi,

I'm trying to use the plugin "os::windows::local::plugin" to list RDS sessions... First, the plugin have a permission problem: /usr/lib64/nagios/plugins/check_centreon_nrpe -H 192.168.x.x -p 5666 -t 55 -u -m 8192 -c check_centreon_plugins -a 'os::windows::local::plugin' 'sessions' ' --filter-sessionname="" --config="scripts/centreon/conf/qwinsta.xml" --language="fr"'

Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
UNKNOWN: Cannot write statefile '/var/lib/centreon/centplugins/windows_sessions_a181a603769c1f98ad927e7367c7aa51_a181a603769c1f98ad927e7367c7aa51'. Need write/exec permissions on directory.

For testing, I granted "Everyone" full access to C:\Windows\Temp (ugly fix!). Looks better but I still have errors:

Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
UNKNOWN: Cannot write statefile '/var/lib/centreon/centplugins/windows_sessions_a181a603769c1f98ad927e7367c7aa51_a181a603769c1f98ad927e7367c7aa51'. Need write/exec permissions on directory.
 [ID => 8] [PRIPHRIQUE => -] [SESSION => rdp-tcp#16] [TYPE => -] [UTILISATEUR => Administrateur] [TAT => Actif]
garnier-quentin commented 4 years ago

Please use following option:

--statefile-dir=C:/Windows/Temp/
garnier-quentin commented 4 years ago

You can also provide the result of following command on your windows:

qwinsta /COUNTER
Cool34000 commented 4 years ago

# /usr/lib64/nagios/plugins/check_centreon_nrpe -H 192.168.x.x -p 5666 -t 55 -u -m 8192 -c check_centreon_plugins -a 'os::windows::local::plugin' 'sessions' ' --filter-sessionname="" --config="scripts/centreon/conf/qwinsta.xml" --language="fr" --statefile-dir=C:/Windows/Temp/'

Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
Use of uninitialized value in regexp compilation at C:\Windows\TEMP\par-5352562d52445324\cache-e911f522c2e788f4c9128b42d8f6076582f7d9e4\inc\lib/os/windows/local/mode/sessions.pm line 238.
OK: Sessions created : 0, disconnected : 0, reconnected : 0, current active : 2, current disconnected : 0 | 'sessions_created'=0;;;0; 'sessions_disconnected'=0;;;0; 'sessions_reconnected'=0;;;0; 'sessions_active'=2;;;0; 'sessions_disconnected_current'=0;;;0;
# qwinsta /COUNTER
 SESSION           UTILISATEUR              ID  ÉTAT    TYPE        PÉRIPHÉRIQUE
 services                                    0  Déco
 console                                     1  Conn
>rdp-tcp#16        Administrateur            8  Actif
 rdp-tcp#17        LS                        9  Actif
 31c5ce94259d4...                        65536  Écouter
 rdp-tcp                                 65537  Écouter
Nombre total de sessions créées : 19
Nombre total de sessions déconnectées : 21
Nombre total de sessions reconnectées : 0
Cool34000 commented 4 years ago

It's a Windows 2019 Server by the way...

garnier-quentin commented 4 years ago

I have fixed the bug. You need to update your qwinsta.xml file (on your windows server)

Cool34000 commented 4 years ago

Wonderful! Thanks Quentin... Again and again

garnier-quentin commented 4 years ago

thanks for the feedback! you're welcome.