慕后森
这是使用Python进行检查的一种方法:#!/usr/bin/env pythonimport socketfrom kombu import Connectionhost = "localhost"port = 5672user = "guest"password = "guest"vhost = "/"url = 'amqp://{0}:{1}@{2}:{3}/{4}'.format(user, password, host, port, vhost)with Connection(url) as c: try: c.connect() except socket.error: raise ValueError("Received socket.error, " "rabbitmq server probably isn't running") except IOError: raise ValueError("Received IOError, probably bad credentials") else: print "Credentials are valid"