Created
December 6, 2013 14:17
-
-
Save deckerego/7824840 to your computer and use it in GitHub Desktop.
Reading RabbitMQ Message Statistics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
queueStatsToDataframe <- function(uri, username, password) { | |
uri <- paste(uri, "api/queues", sep="/") | |
credentials = paste(username, password, sep=":") | |
doc <- getURL(uri, userpwd=credentials, httpauth=1L) | |
src <- fromJSON(doc) | |
items.df <- data.frame() | |
if(length(src) > 0) { | |
for(i in 1:length(src)) { | |
if(length(src[[i]]$messages_details) == 3) { | |
record.df <- data.frame(src[[i]]$name, src[[i]]$messages_details, stringsAsFactors=FALSE) | |
names(record.df) <- c("Name", "Rate", "Interval", "LastEvent") | |
items.df <- rbind(items.df, record.df) | |
} | |
} | |
} | |
return(items.df) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment