#!/usr/bin/env python
#
# List the current state of monitoring.

import pyrax
import os

pyrax.set_setting("identity_type", "rackspace")
pyrax.set_setting("region", os.environ['RAX_REGION'])
pyrax.set_credential_file(os.path.expanduser("~/.rackspace_cloud_credentials"))

cm = pyrax.cloud_monitoring

print ">> ENTITIES ::"
for e in cm.list_entities():
    print e

print ">> CHECKS ::"
for e in cm.list_entities():
    print "- %s" % e.label
    for c in e.list_checks():
        print c

print ">> NOTIFICATIONS ::"
for n in cm.list_notifications():
    print n

print ">> NOTIFICATION PLANS ::"
for np in cm.list_notification_plans():
    print np

print ">> ALARMS ::"
for e in cm.list_entities():
    print "- %s" % e.label
    for a in e.list_alarms():
        print a
