Can I monitor my baramundi Management Suite (bMS) installation with PRTG? What steps do I need to take?
Article Comments
Hi,
thanks for this very good step-by-step guide. I followed everything (I think) but still encounter the following error when checking the bMS Endpoint Summary sensor:
XML: The returned XML does not match the expected schema. (code: PE233) -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231)
I tried to run the ps1 script step by step locally on the PRTG node and found that I get a count of 0 endpoints which lets me think that something is wrong with the query.
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> $channels += Get-PrtgChannel "Total endpoints" "Co unt" $endpoints.Count PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> $channels Channel : Total endpoints Value : 0 Unit : Count LimitMaxError : LimitMaxWarning : LimitMinError : LimitMinWarning : LimitErrorMsg : LimitWarningMsg : LimitMode : 0 ValueLookup :
Do you have any idea what the problem may be?
Thanks in advance, Daniel
PS: I'm also aware of this: https://helpdesk.paessler.com/en/support/solutions/articles/76000041700-guide-for-powershell-based-custom-sensors
Apr, 2019 - Permalink
Hi there,
Please activate the "Write EXE result to disk" option in the sensor's settings and post the log files (Result of Sensor XXX.Data.txt and Result of Sensor XXX.txt) located on the corresponding probe under "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)".
Best regards.
Apr, 2019 - Permalink
Result of Sensor XXX.Data.txt contains the following:
Data['linuxloginpassword'].asString := '';
Data['notonpod'].asString := '0';
Data['fastcount'].asString := '0';
Data['lastmsg'].asString := '#Y2 @#O233 @#O231[Invalid JSON.]';
Data['resultfile'].asString := 'Result of Sensor 47295.txt';
Data['windowsloginusername'].asString := '<username@domain.com>';
Data['hostv6'].asString := '';
Data['exefile'].asString := 'bMS Endpoint Summary.ps1';
Data['lastuptime'].asString := '0';
Data['writeresult'].asString := '2';
Data['blockedsens'].asString := '';
Data['reqmsginterval'].asString := '60';
Data['windowslogindomain'].asString := '';
Data['tlsexplicit_imap'].asString := '';
Data['channelnames'].asString := '';
Data['tlsexplicit_default'].asString := '';
Data['canlinux'].asString := '0';
Data['isexesensor'].asString := '1';
Data['windowsloginpassword'].asString := '***';
Data['environment'].asString := '';
Data['mutexname'].asString := '';
Data['channelinfos'].asString := '{}';
Data['uptimecount'].asString := '0';
Data['reboot'].asString := '43555.5629205787';
Data['usednstime'].asString := '0';
Data['linuxlogindomain'].asString := '';
Data['exeparamshash'].asString := 'da39a3ee5e6b4b0d3255bfef95601890afd80709';
Data['tlsexplicit_port'].asString := '';
Data['monitorchange'].asString := '';
Data['inerror'].asString := '1';
Data['sensorid'].asString := '47295';
Data['ipversion'].asString := '0';
Data['tlsexplicit_smtp'].asString := '';
Data['host'].asString := '<fqdn of baramundi server>';
Data['exeparamscache'].asString := '';
Data['usewindowsauthentication'].asString := '1';
Data['simulate'].asString := '0';
Data['tlsexplicit_ftp'].asString := '';
Data['timeout'].asString := '60';
Data['exeparams'].asString := '';
Data['momopersistent'].asString := '';
Data['tlsexplicit_pop3'].asString := '';
Result of Sensor XXX.txt is empty.
Apr, 2019 - Permalink
Hi there,
That's most likely the issue - as no output is generated. Could you check if the execution policy is properly set in the 32-Bit PowerShell of your Server?
https://helpdesk.paessler.com/en/support/solutions/articles/76000063331-powershell-32-bit-or-64-bit-and-execution-policy
Best regards.
Apr, 2019 - Permalink
Sorry, I have configured this already on both PRTG node and Baramundi server. So it does not seem to be the issue.
However I have discovered that I can run the command "using module ".\bMS Sensor.psm1"" manually only when I set the execution policy to "Unrestricted". Even then it asks me whether I want to run it.
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Get-ExecutionPolicy Unrestricted PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> using module ".\bMS Sensor.psm1" Security warning Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML\bMS Sensor.psm1? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
Apr, 2019 - Permalink
Hi there,
Have you set the execution policy specifically in the 32-bit version of PowerShell? Additionally, what do the sensor results show as output?
Best regards.
Apr, 2019 - Permalink
Yes, I did that in 32-bit and I already posted output above last week. The result file is just empty. Meanwhile I tried to run the script on the Powershell command line and got the following:
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> & '.\bMS Endpoint Summary.ps1' { "prtg": { "error": "Specified cast is not valid.", "text": "System.InvalidCastException: Specified cast is not valid.\r\n at CallSite.Target(Closure , CallSite , Object , Int64 )\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0 , T1 arg1)\r\n at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)\r\n at S ystem.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)" } }
I also ran the script line by line which gave me the following:
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Write-Output $r { "prtg": { "result": [ { "Channel": "Total endpoints", "Value": 0, "Unit": "Count", "LimitMaxError": null, "LimitMaxWarning": null, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 0, "ValueLookup": null }, { "Channel": "Active endpoints", "Value": 0, "Unit": "Count", "LimitMaxError": null, "LimitMaxWarning": null, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 0, "ValueLookup": null }, { "Channel": "Inactive endpoints", "Value": 0, "Unit": "Count", "LimitMaxError": null, "LimitMaxWarning": null, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 0, "ValueLookup": null }, { "Channel": "Not compliant endpoints", "Value": 0, "Unit": "Count", "LimitMaxError": 0, "LimitMaxWarning": null, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 1, "ValueLookup": null }, { "Channel": "Compliance check deactivated", "Value": 0, "Unit": "Count", "LimitMaxError": null, "LimitMaxWarning": 0, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 1, "ValueLookup": null }, { "Channel": "Max last seen in days", "Value": 0, "Unit": "Count", "LimitMaxError": 60, "LimitMaxWarning": 10, "LimitMinError": null, "LimitMinWarning": null, "LimitErrorMsg": null, "LimitWarningMsg": null, "LimitMode": 1, "ValueLookup": null } ] } }
On the sensor itself I still get the XML: The returned XML does not match the expected schema. (code: PE233) -- JSON: The returned JSON does not match the expected structure (Invalid JSON.). (code: PE231) as already stated above.
Apr, 2019 - Permalink
Hi there,
It might be worth checking this with Baramundi directly as the sensors are written by them as well:
https://github.com/baramundisoftware/PRTG-Sensors
Best regards.
Apr, 2019 - Permalink
This article applies to PRTG Network Monitor 18 or later
Monitoring baramundi Management Suite with PRTG
You can monitor your baramundi Management Suite (bMS) with the EXE/Script Advanced sensor from PRTG and a custom script. With the custom script, you can create a custom bMS Endpoint sensor, a custom bMS Endpoint Summary sensor, and a custom bMS Job Summary sensor. These sensors allow you to monitor important aspects of your bMS installation.
Requirements
Copy and Save the Files
Before you can create the custom sensors in PRTG, you need to save the scripts and lookups in the respective subfolders of the probe system's PRTG program directory. You can find the files in the baramundisoftware/PRTG-Sensors project on GitHub.
Optional: You can also execute the PowerShell script PublishTo-Prtg.ps1 to automatically copy the files to the respective folders of the PRTG program directory.
Copy and save the following scripts in the Custom Sensors\EXEXML subfolder of the PRTG program directory.
Copy and save the following lookup files in the lookups\custom subfolder of the PRTG program directory.
Note: If necessary, (re)load the lookup files by clicking the Load Lookups and File Lists button in the PRTG web interface under Setup | System Administration | Administrative Tools.
Store the bConnect Context
To access the bConnect interface, authentication with a username and password is required. To store the bConnect context (URL and password), follow these steps.
sl "${env:ProgramFiles(x86)}\PRTG Network Monitor\Custom Sensors\EXEXML"
Import-Module '.\bMS Sensor.psm1'
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Set-bConnectContext
Note: Before creating sensors in PRTG, you can use the cmdlet Test-b-ConnectContext to test the connectivity to the bConnect interface.
Monitoring bMS Endpoints
You can monitor the status of a single endpoint registered in the bMS using the EXE/Script Advanced sensor and the custom script to create a custom bMS Endpoint sensor. This sensor has the following channels.
1. Create a new device in PRTG with the IP address of the device to be monitored.
2. On the device, create a new EXE/Script Advanced sensor.
3. Under EXE/Script select bMS Endpoint.ps1.
4. Enter the FQDN or display name of the monitored device under Parameters, for example %host.
5. Under Security Context, select the security context that matches the Windows user who stored the files. Because the PRTG probe is run by the local SYSTEM user by default, you will have to use the Windows credentials of the parent device that match this user in most cases.
6. Click Create to add the sensor.
Monitoring bMS Endpoint Summary
You can monitor general aspects of all endpoints registered in the bMS using the EXE/Script Advanced sensor and the custom script to create a custom bMS Endpoint Summary sensor. This sensor has the following channels.
1. Create a new device in PRTG with the IP address of the bMS server.
2. On the device, create a new EXE/Script Advanced sensor.
3. Under EXE/Script select bMS Endpoint Summary.ps1.
4. Under Security Context, select the security context that matches the Windows user who stored the files. Because the PRTG probe is run by the local SYSTEM user by default, you will have to use the Windows credentials of the parent device that match this user in most cases.
5. Click Create to add the sensor.
Monitoring bMS Jobs
You can monitor the status of jobs on endpoints in the bMS using the EXE/Script Advanced sensor and the custom script to create a custom bMS Job Summary sensor. This sensor has the following channels.
1. Create a new device in PRTG with the IP address of the bMS server.
2. On the device, create a new EXE/Script Advanced sensor.
3. Under EXE/Script select bMS Job Summary.ps1.
4. Under Parameters, enter the job name.
5. Under Security Context, select the security context that matches the Windows user who stored the files. Because the PRTG probe is run by the local SYSTEM user by default, you will have to use the Windows credentials of the parent device that match this user in most cases.
6. Click Create to add the sensor.
Troubleshooting
If you receive an error regarding unsupported file formats or have other issues with your sensors, take the following steps to help identify the cause.
See Also
Dec, 2018 - Permalink