centreon / centreon-nsclient-build

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

apps::activedirectory::local::plugin problem #14

Closed Cool34000 closed 3 years ago

Cool34000 commented 4 years ago

Hi,

I have a server where the plugin does'nt work: /usr/lib64/nagios/plugins/check_centreon_nrpe -H 10.0.1.4 -p 5666 -t 55 -u -m 8192 -c check_centreon_plugins -a 'apps::activedirectory::local::plugin' 'dcdiag' ' --config="scripts/centreon/conf/dcdiag.xml" --language="en" '

UNKNOWN: Cannot match output test (maybe you need to set the good language) |

Here's the DCDIAG.EXE output on the server:

C:\Users\Administrator>dcdiag

Directory Server Diagnosis

Performing initial setup:
   Trying to find home server...
   Home Server = SRV-AD-BXL
   * Identified AD Forest.
   Done gathering initial info.

Doing initial required tests

   Testing server: Bruxelles\SRV-AD-BXL
      Starting test: Connectivity
         The host cdb7cd38-b7fe-4f51-a5ef-1d567e988b28._msdcs.mydomain.local
         could not be resolved to an IP address. Check the DNS server, DHCP,
         server name, etc.
         Got error while checking LDAP and RPC connectivity. Please check your
         firewall settings.
         ......................... SRV-AD-BXL failed test Connectivity

Doing primary tests

   Testing server: Bruxelles\SRV-AD-BXL
      Skipping all tests, because server SRV-AD-BXL is not responding to
      directory service requests.

   Running partition tests on : ForestDnsZones
      Starting test: CheckSDRefDom
         ......................... ForestDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... ForestDnsZones passed test
         CrossRefValidation

   Running partition tests on : DomainDnsZones
      Starting test: CheckSDRefDom
         ......................... DomainDnsZones passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... DomainDnsZones passed test
         CrossRefValidation

   Running partition tests on : Schema
      Starting test: CheckSDRefDom
         ......................... Schema passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Schema passed test CrossRefValidation

   Running partition tests on : Configuration
      Starting test: CheckSDRefDom
         ......................... Configuration passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... Configuration passed test CrossRefValidation

   Running partition tests on : mydomain
      Starting test: CheckSDRefDom
         ......................... mydomain passed test CheckSDRefDom
      Starting test: CrossRefValidation
         ......................... mydomain passed test CrossRefValidation

   Running enterprise tests on : mydomain.local
      Starting test: LocatorCheck
         Warning: DcGetDcName(PDC_REQUIRED) call failed, error 1355
         A Primary Domain Controller could not be located.
         The server holding the PDC role is down.
         ......................... mydomain.local failed test LocatorCheck
      Starting test: Intersite
         ......................... mydomain.local passed test Intersite
garnier-quentin commented 4 years ago

Could you test it locally (without nrpe) ?

Cool34000 commented 4 years ago
centreon_plugins.exe --plugin="apps::activedirectory::local::plugin --mode="dcdiag" --config="scripts/centreon/conf/dcdiag.xml" --language="en"

CRITICAL: test Connectivity WARNING: test FsmoCheck |

garnier-quentin commented 4 years ago

So it's working. i don't know why it's not working with nrpe.

UrBnW commented 4 years ago

You could perhaps test again now that configuration files are embedded (you don't need --config anymore).

Sims24 commented 4 years ago

Hi @Cool34000

Could you please tell us if the problem still appears now that XML config is embedded?

Thanks

Cool34000 commented 4 years ago

Hi,

Sorry the server doesn't exists anymore (it was replaced with a 2019 Server) It's working on this one

Cool34000 commented 3 years ago

Hi,

I have the same problem on another server... Same behaviour: it's not working from the poller but working locally. NSClient is the last available (Centreon-NSClient-0.5.2.41-20201207-x64.exe)

# /usr/lib64/nagios/plugins/check_centreon_nrpe -H x.x.x.x -p 5666 -t 55 -u -m 8192 -c check_centreon_plugins -a 'apps::activedirectory::local::plugin' 'dcdiag' ' --language="fr" '
UNKNOWN: Cannot match output test (maybe you need to set the good language) |
"C:\Program Files\Centreon NSClient++\scripts\centreon\centreon_plugins.exe" --plugin="apps::activedirectory::local::plugin" --mode="dcdiag" --language="fr"
ag"
CRITICAL: test Connectivity WARNING: test FsmoCheck |

Any hints to see what's the result of the command (I don't see anything with --debug option)

garnier-quentin commented 3 years ago

Do you use the last plugin ? https://github.com/centreon/centreon-nsclient-build/releases/tag/20201207190634

Cool34000 commented 3 years ago

Do you use the last plugin ? https://github.com/centreon/centreon-nsclient-build/releases/tag/20201207190634

Yes, latest version

UrBnW commented 3 years ago

By curiosity try using NSClient++ new RestAPI instead of NRPE ?

/usr/lib/centreon/plugins/centreon_protocol_nrpe.pl
--plugin=apps::protocols::nrpe::plugin
--custommode=nsclient
--hostname=x.y.z.t
--port=8443
--username=centreon
--password=centreon
--new-api
--ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE'
--mode=query
--command=check_centreon_plugins
--arg='apps::activedirectory::local::plugin'
--arg='dcdiag'
--arg='--language="fr"'
Cool34000 commented 3 years ago

Hi,

Sorry for dumb question but how do I install the new RestAPI? centreon_protocol_nrpe.pl is not found on my poller...

yum install centreon-nrpe-plugin -y

Le paquet centreon-nrpe-plugin-2.15-4.el7.centos.x86_64 est déjà  installé dans sa dernière version

yum install *nrpe* -y installs:

But still not found after that!

Cool34000 commented 3 years ago

Also

# updatedb
# locate centreon_protocol_nrpe.pl

Gives me nothing...

Cool34000 commented 3 years ago

OK, I managed to do something but I still get the error!

First, I installed these dependencies: yum install perl-URI-Encode perl-JSON-XS -y

Then I switched "centreon_protocol_nrpe.pl" to "centreon_plugins.pl" : # /usr/lib/centreon/plugins/centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin --custommode=nsclient --hostname=x.x.x.x --port=8443 --username=centreon --password=centreon --new-api --ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE' --mode=query --command=check_centreon_plugins --arg='apps::activedirectory::local::plugin' --arg='dcdiag' --arg='--language="fr"'

But I was getting a 403 response, so I switched the username to "admin" instead of "centreon":

# /usr/lib/centreon/plugins/centreon_plugins.pl --plugin=apps::protocols::nrpe::plugin  --custommode=nsclient --hostname=x.x.x.x --port=8443 --username=admin --password=centreon --new-api --ssl-opt='SSL_verify_mode => SSL_VERIFY_NONE' --mode=query --command=check_centreon_plugins --arg='apps::activedirectory::local::plugin' --arg='dcdiag' --arg='--language="fr"'

UNKNOWN: Cannot match output test (maybe you need to set the good language) |
======> request send
GET https://x.x.x.x:8443/api/v1/queries/check_centreon_plugins/commands/execute?apps%3A%3Aactivedirectory%3A%3Alocal%3A%3Aplugin&dcdiag&--language%3D%22fr%22
Authorization: Basic YWRtaW46Y2VudHJlb24=
User-Agent: centreon::plugins::backend::http::useragent

======> response done
HTTP/1.1 200 OK
Content-Length: 159
Client-Date: Wed, 23 Dec 2020 07:57:55 GMT
Client-Peer: x.x.x.x:8443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /CN=localhost
Client-SSL-Cert-Subject: /CN=localhost
Client-SSL-Cipher: AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Set-Cookie: token=yapnxrpMCARCr4zdGc81tBDKsMlaZTXC; path=/
Set-Cookie: uid=admin; path=/

{"command":"check_centreon_plugins","lines":[{"message":"UNKNOWN: Cannot match output test (maybe you need to set the good language) |","perf":{}}],"result":3}
nsclient return = {"command":"check_centreon_plugins","lines":[{"message":"UNKNOWN: Cannot match output test (maybe you need to set the good language) |","perf":{}}],"result":3}
UrBnW commented 3 years ago

Try using --arg='--language=fr' instead of --arg='--language="fr"', I remember having faced same sort of issue.

Cool34000 commented 3 years ago

Try using --arg='--language=fr' instead of --arg='--language="fr"', I remember having faced same sort of issue.

Same result

Cool34000 commented 3 years ago

Hi,

I just tested with the last version of Centreon NSClient (version 0.5.2.41-20211102) and it works now

/usr/lib64/nagios/plugins/check_centreon_nrpe -H 10.0.1.4 -p 5666 -t 55 -u -m 8192 -c check_centreon_plugins -a 'apps::microsoft::activedirectory::local::plugin' 'dcdiag' ' --language="en" '
OK: Connectivity - Advertising - FrsEvent - SysVolCheck - KccEvent - MachineAccount - Replications - RidManager - Services - FsmoCheck |