Can I monitor my baramundi Management Suite (bMS) installation with PRTG? What steps do I need to take?
How to monitor baramundi with PRTG
Votes:
0
10 Replies
Votes:
2
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
- The custom scripts are built using PowerShell 5.1. Ensure that you have installed this version on the probe system.
- The custom sensors use the bConnect interface to read information from your bConnect installation. Ensure that you have installed and configured the bConnect interface before you create sensors in PRTG.
- Ensure that the bConnect interface uses TLS.
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.
- bMS Endpoint Summary.ps1
- bMS Endpoint.ps1
- bMS Job Summary.ps1
- bMS Sensor.psm1
Copy and save the following lookup files in the lookups\custom subfolder of the PRTG program directory.
- oid.baramundi.compliancestate.ovl
- oid.baramundi.managementstate.ovl
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.
- Log in to the Windows account that will be used for access from PRTG.
- Open a PowerShell prompt.
- Change the location to the directory that contains the PowerShell scripts in PRTG using the following command.
sl "${env:ProgramFiles(x86)}\PRTG Network Monitor\Custom Sensors\EXEXML"
- Import the module that contains the basic functionality for the sensors.
Import-Module '.\bMS Sensor.psm1'
- Call the function Set-bConnectContext.
PS C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\EXEXML> Set-bConnectContext
- Provide the following information:
- Enter the URL of the bConnect server, for example https://srv-baramundi.bms-demo.local.
- Enter the bConnect username.
- Enter the bConnect password.
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.
- Compliance state
- Job Instances: Finished cancelled
- Job Instances: Finished error
- Job Instances: Requirements not met
- Job Instances: Skipped due to incompatibility
- Job Instances: Total
- Job Instances: Waiting for user
- Job Instances: Waiting for user (non-blocking)
- Last seen in hours
- Management state
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.
- Active Endpoints
- Compliance check deactivated
- Inactive endpoints
- Max last seen in days
- Not compliant endpoints
- Total endpoints
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.
- Finished cancelled
- Finished error
- Requirements not met
- Skipped due to incompatibility
- Total Instances
- Waiting for user
- Waiting for user (non-blocking)
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.
- If you have issues with your baramundi sensors, enable a Write EXE result to disk option under EXE Result in the sensor's settings. This is helpful for troubleshooting.
- Ensure that the sensor stores the EXE result in the file system so that you can access the error message in the \Logs (Sensors) subfolder of the PRTG program directory.
- Run Test-bConnectContext to check whether the bConnect connection works.
- Ensure that the bConnect certificate is trusted on the machine where the probe system is running.
See Also
Created on Dec 4, 2018 10:12:07 AM by
Brandy Greger [Paessler Support]
Last change on Dec 10, 2018 7:44:58 AM by
Brandy Greger [Paessler Support]
Votes:
0
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://kb.paessler.com/en/topic/71356-guide-for-powershell-based-custom-sensors
Created on Apr 1, 2019 1:26:01 PM
Last change on Apr 1, 2019 3:17:40 PM by
Dariusz Gorka [Paessler Support]
Votes:
0
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.
Votes:
0
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 := '<[email protected]>';
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.
Votes:
0
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://kb.paessler.com/en/topic/20443-powershell-32-bit-or-64-bit-and-execution-policy
Best regards.
Votes:
0
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"):
Created on Apr 2, 2019 7:04:08 AM
Last change on Apr 2, 2019 7:07:24 AM by
Dariusz Gorka [Paessler Support]
Votes:
0
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.
Votes:
0
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.
Votes:
0
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.
Created on Apr 16, 2019 2:18:58 PM by
Dariusz Gorka [Paessler Support]
Last change on Feb 17, 2022 7:08:51 AM by
Luciano Lingnau [Paessler]
Add comment