import pyrax

from util import option_chooser

pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cm = pyrax.cloud_monitoring

# We need the IP address of the entity for this check
ents = cm.list_entities()
if not ents:
    print("You must create an entity before you can create a notification.")
    sys.exit()
print("Select the entity on which you wish to create the notification:")
ent = option_chooser(ents, attr="name")
entity = ents[ent]
print(entity
)
checks = entity.list_checks()
print("Select a check to notify about:")
check_num = option_chooser(checks, attr="label")
check = checks[check_num]

# cm.list_notification_types() would provide all available check types.
# However, this sample will use the most basic type: email

email = six.moves.input("Enter the email address to be notified at: ")

# Create the notification
notif = cm.create_notification("email", label="sample email",
Exemple #2
0
import pyrax

from util import option_chooser

pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cm = pyrax.cloud_monitoring

# We need the IP address of the entity for this check
ents = cm.list_entities()
if not ents:
    print("You must create an entity before you can create a notification.")
    sys.exit()
print("Select the entity on which you wish to create the notification:")
ent = option_chooser(ents, attr="name")
entity = ents[ent]
print(entity)
aliases = entity.ip_addresses.items()
print("Select an IP address to check")
interface = option_chooser(aliases)
alias = aliases[interface][0]

# cm.list_check_types() would provide all available check types.
# However, this sample will use the most basic type: remote.ping

# List the available Monitoring Zones
zones = cm.list_monitoring_zones()
print("Select a Monitoring Zone:")
zone_choice = option_chooser(zones, attr="label")
zone = zones[zone_choice]
Exemple #3
0
import pyrax

from util import option_chooser

pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cm = pyrax.cloud_monitoring

# We need the IP address of the entity for this check
ents = cm.list_entities()
if not ents:
    print "You must create an entity before you can create a notification."
    sys.exit()
print "Select the entity on which you wish to create the notification:"
ent = option_chooser(ents, attr="name")
entity = ents[ent]
print entity

checks = entity.list_checks()
print "Select a check to notify about:"
check_num = option_chooser(checks, attr="label")
check = checks[check_num]

plans = cm.list_notification_plans()
plan_num = option_chooser(plans, attr="label")
plan = plans[plan_num]

# Create an alarm which causes your notification plan's `warning` to be
# notified whenever the average ping time goes over 5 seconds. Otherwise,
# the status will be `ok`.
Exemple #4
0
import pyrax

from util import option_chooser

pyrax.set_setting("identity_type", "rackspace")
creds_file = os.path.expanduser("~/.rackspace_cloud_credentials")
pyrax.set_credential_file(creds_file)
cm = pyrax.cloud_monitoring

# We need the IP address of the entity for this check
ents = cm.list_entities()
if not ents:
    print("You must create an entity before you can create a notification.")
    sys.exit()
print("Select the entity on which you wish to create the notification:")
ent = option_chooser(ents, attr="name")
entity = ents[ent]
print(entity
)
aliases = entity.ip_addresses.items()
print("Select an IP address to check")
interface = option_chooser(aliases)
alias = aliases[interface][0]

# cm.list_check_types() would provide all available check types.
# However, this sample will use the most basic type: remote.ping

# List the available Monitoring Zones
zones = cm.list_monitoring_zones()
print("Select a Monitoring Zone:")
zone_choice = option_chooser(zones, attr="label")