What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
300.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Monitor RabbitMQ

Votes:

0

Your Vote:

Up

Down

Hello,

I'm trying to monitor some RBMQ components like queue, connections and so on. I succeed to monitor those components and more using custom sensor (HTTP XML/REST Value) ,but I'm getting all the time randomly time outs, warning and down statuses (code: PE018) as the other sensors are working fine (ping and http).

Plus,

1. Other monitor systems like Nagios are working fine and not getting those timeouts not errors.

2. I'm using 60 sec interval scanning and I cannot use 5 min interval as it too long.

3. I used the following article, https://blog.cdemi.io/monitoring-rabbitmq-in-prtg/

I would appreciate your help.

Thanks,

Shay

custom custom-script-exe custom-sensor help http-xml-rest-value pe018 prtg rabbitmq rbmq sensor

Created on Dec 13, 2016 9:10:04 AM by  shayz (0) 1



6 Replies

Votes:

0

Your Vote:

Up

Down

Hello Shay,

Thank you for your KB-post.

Kindly note that we do not offer technical support for sensor customization, sorry.

Maybe some other user can help you with this, or the owner of the blog http://blog.cdemi.io

Best regards

Created on Dec 13, 2016 12:27:02 PM by  Isidora Jeremic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

Thanks for the response. Can you please let me know what is the best recommended sensor to use for monitoring RabbitMQ server components?

Thanks, Shay

Created on Dec 13, 2016 1:46:25 PM by  shayz (0) 1



Votes:

0

Your Vote:

Up

Down

Hello,

Which exact server components do you want to monitor?

Created on Dec 13, 2016 3:11:23 PM by  Isidora Jeremic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Hi,

At this moment I would like to monitor,

Consumers

Publish Messages

Queue

Connections

Messages in queue

In the near future I would like to monitor more components.

Thanks, Shay

Created on Dec 14, 2016 8:49:06 AM by  shayz (0) 1



Votes:

0

Your Vote:

Up

Down

Hello Shay,

Please note that PRTG does not have any default sensors designated for RabbitMQ monitoring.

You can try the following alternatives:

  • As already mentioned, as Rabbit MQ services provide an API which returns results via JSON, you can use HTTP XML/REST Value sensor to monitor this JSON output. Specify the node for the value of interest in the sensor settings and the sensor will return the corresponding value; please have a look also at this article.

Best regards

Created on Dec 14, 2016 2:52:09 PM by  Isidora Jeremic [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I just wrote a powershell script to use in an EXE/Script Advanced sensor. I include channels for "Message Publish Rate", "Message Count", Connections, Consumers, and Queues. You could certainly do others.

I adapted the script found here: https://kb.paessler.com/en/topic/71263

Here's the script:

# Monitor stats from RabbitMQ in PRTG v0.1 20/01/2021
# Adapted from the script written to monitor Unifi Access Points Published Here: https://kb.paessler.com/en/topic/71263
#
# Parameters in PRTG are: Controller's URI, Port, Username and Password. Example without placeholders:
# -server 'unifi.domain.tld' -port '8443' -username 'admin' -password 'somepassword'
#
# -server '%host' -port '8443' -site 'default' -username '%windowsuser' -password '%windowspassword'
# This second option requires the device's address in PRTG to be the controller's address, the credentials for windows devices
# must also match the log-in/password from the controller. This way you don't leave the password exposed in the sensor's settings.
#
# It's recommended to use larger scanning intervals for exe/xml scripts. Please also mind the 50 exe/script sensor's recommendation per probe.
# The sensor will not generate alerts by default, after creating your sensor, define limits accordingly.
# This sensor is to be considered experimental. 
#
#   Source(s):
#   https://blog.cdemi.io/monitoring-rabbitmq-in-prtg/
#	https://documentation.solarwinds.com/en/Success_Center/appoptics/content/kb/host_infrastructure/integrations/rabbitmq.htm
#	https://www.paessler.com/manuals/prtg/custom_sensors

param(
	[string]$server = 'testserver.domain.com',
	[string]$port = '15672',
	[string]$username = 'guest',
	[string]$password = 'guest',
	[switch]$debug = $false
)

#Ignore SSL Errors
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}  

#Define supported Protocols
[System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3")


# Confirm Powershell Version.
if ($PSVersionTable.PSVersion.Major -lt 3) {
	Write-Output "<prtg>"
	Write-Output "<error>1</error>"
	Write-Output "<text>Powershell Version is $($PSVersionTable.PSVersion.Major) Requires at least 3. </text>"
	Write-Output "</prtg>"
	Exit
}


# Create $controller and $credential using multiple variables/parameters.
[string]$controller = "http://$($server):$($port)"
[string]$credential = "`{`"username`":`"$username`",`"password`":`"$password`"`}"

$pair = "$($username):$($password)"

$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))

$basicAuthValue = "Basic $encodedCreds"

$Headers = @{
    Authorization = $basicAuthValue
}

# Start debug timer
$queryMeasurement = [System.Diagnostics.Stopwatch]::StartNew()

# Perform the authentication and store the token to myWebSession
try {
$null = Invoke-Restmethod -Uri "$controller/api/overview" -Headers $Headers -ContentType "application/json; charset=utf-8"  -SessionVariable myWebSession
}catch{
	Write-Output "<prtg>"
	Write-Output "<error>1</error>"
	Write-Output "<text>Authentication Failed: $($_.Exception.Message)</text>"
	Write-Output "</prtg>"
	Exit
}

#Query API providing token from first query.
try {
$jsonresultat = Invoke-Restmethod -Uri "$controller/api/overview" -WebSession $myWebSession
}catch{
	Write-Output "<prtg>"
	Write-Output "<error>1</error>"
	Write-Output "<text>API Query Failed: $($_.Exception.Message)</text>"
	Write-Output "</prtg>"
	Exit
}

# Load File from Debug Log
# $jsonresultatFile = Get-Content '.\unifi_sensor2017-15-02-05-42-24_log.json'
# $jsonresultat = $jsonresultatFile | ConvertFrom-Json

# Stop debug timer
$queryMeasurement.Stop()


#Write Results

write-host "<prtg>"

Write-Host "<result>"
Write-Host "<channel>Message Publish Rate</channel>"
Write-Host "<value>$($jsonresultat.message_stats.publish_details.rate)</value>"
Write-Host "<float>1</float>"
Write-Host "</result>"

Write-Host "<result>"
Write-Host "<channel>Message Count</channel>"
Write-Host "<value>$($jsonresultat.queue_totals.messages)</value>"
Write-Host "</result>"

Write-Host "<result>"
Write-Host "<channel>Connections</channel>"
Write-Host "<value>$($jsonresultat.object_totals.connections)</value>"
Write-Host "</result>"

Write-Host "<result>"
Write-Host "<channel>Consumers</channel>"
Write-Host "<value>$($jsonresultat.object_totals.consumers)</value>"
Write-Host "</result>"

Write-Host "<result>"
Write-Host "<channel>Queues</channel>"
Write-Host "<value>$($jsonresultat.object_totals.queues)</value>"
Write-Host "</result>"

write-host "</prtg>"

# Write JSON file to disk when -debug is set. For troubleshooting only.
if ($debug){
	[string]$logPath = ((Get-ItemProperty -Path "hklm:SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Core" -Name "Datapath").DataPath) + "Logs (Sensors)\"
	$timeStamp = (Get-Date -format yyyy-dd-MM-hh-mm-ss)

	$json = $jsonresultat | ConvertTo-Json
	$json | Out-File $logPath"rabbit_sensor$($timeStamp)_log.json"
}

Created on Jan 21, 2021 12:00:38 AM by  Noah Sutherland (23) 2

Last change on Jan 21, 2021 6:19:22 PM by  Noah Sutherland (23) 2



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.