Ok tanks a lot itâs working now,
Iâm using another command to test the smb path
If (get-childitem $pathtocheck -ErrorAction SilentlyContinue){ Write-Output "0 $ServiceName Access=1;; Access ok " }
Else { Write-Output "0 $ServiceName Access=0;; NO ACCESS " }
Result locally and on check_mk website are same now
Have a nice day
Christophe
De : Andreas Döhler <***@gmail.com>
Envoyé : jeudi, 29 novembre 2018 12:00
à : Etienne, Christophe (RTS) <***@rts.ch>
Cc : dominique Arpin <***@gmail.com>; <checkmk-***@lists.mathias-kettner.de> <checkmk-***@lists.mathias-kettner.de>
Objet : Re: [Check_mk (english)] Plugin powershell
I took a look at the internet and found some problems with the "Test-Path" cmdlet.
A suggested solution looked like the following --> Test-Path $('filesystem::\\Server\share$\file')
The problem is the complete UNC path not only the share name.
Best regards
Andreas
Am Do., 29. Nov. 2018 um 11:29 Uhr schrieb Etienne, Christophe (RTS) <***@rts.ch<mailto:***@rts.ch>>:
Thx for your answer,
Sure, just a little function to check smb access. Iâve started my session with the same service account used to run the check_mk_agent service.
function SmbAccess {
Param(
$PathToCheck,
$ServiceName,
$servername
)
If (Test-Connection -ComputerName $servername -Quiet -Count 1){
If (Test-Path -Path $pathtocheck){ Write-Output "0 $ServiceName Access=1;; Access ok " }
Else { Write-Output "0 $ServiceName Access=0;; NO ACCESS " }
}
}
Christophe
De : Andreas Döhler <***@gmail.com<mailto:***@gmail.com>>
Envoyé : jeudi, 29 novembre 2018 11:24
à : Etienne, Christophe (RTS) <***@rts.ch<mailto:***@rts.ch>>
Cc : dominique Arpin <***@gmail.com<mailto:***@gmail.com>>; <checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>> <checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>>
Objet : Re: [Check_mk (english)] Plugin powershell
Hi Christophe,
the result depends on what your script is doing. If you look for a mounted filesystem then the outcome is correct as the service user don't see this filesystem also if it is mounted under your user in your current session.
For a more qualified answer it is important to know what the script is doing.
Best regards
Andreas
Am Do., 29. Nov. 2018 um 11:16 Uhr schrieb Etienne, Christophe (RTS) <***@rts.ch<mailto:***@rts.ch>>:
Hello,
I have a same example of this issue:
Locally, cmd -> âcheck_mk_agent.exe testâ result :
<<<local>>>
0 CheckSMB_access Access=1;; Access ok
And in the diagnostic window from the web site:
<<<local>>>
<<<local>>>
0 CheckSMB_access Access=0;; NO ACCESS
<<<local>>>
Running with the same account in the service account and in the command line
Best regards,
Christophe
De : checkmk-en-***@lists.mathias-kettner.de<mailto:checkmk-en-***@lists.mathias-kettner.de> <checkmk-en-***@lists.mathias-kettner.de<mailto:checkmk-en-***@lists.mathias-kettner.de>> De la part de dominique Arpin
Envoyé : vendredi, 18 mars 2016 13:55
à : checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Objet : [Check_mk (english)] Plugin powershell
Hi,
I write a local Powershell script in the local directory of checkmk.
If a test locally with check_mk_agent.exe test, everything work fine. However, from my server, I got empty value. I tried also with a telnet .
I use Get-Counter to retrieve values from my exchange server. The script took 17 seconds to run. It's a French version, but I tried with only non-accent counter with same result.
Regards,
Dominique
_______________________________________________
checkmk-en mailing list
checkmk-***@lists.mathias-kettner.de<mailto:checkmk-***@lists.mathias-kettner.de>
Manage your subscription or unsubscribe
https://lists.mathias-kettner.de/cgi-bin/mailman/listinfo/checkmk-en