pythonrackspace-cloudrackspacepyrax

pyrax cloud monitoring checks test


I have created the entities and checks using Rackspace Cloud Monitoring APIs now I need to run/test the checks so I can feed the values every 60 seconds or so in our existing monitoring system and can trigger alert or mainly report on the data.

I am able to use via command line utility raxmon-checks-test and raxmon-checks-test-existing but I could not find a direct way of doing this using pyrax module. May be this can be done using requests instance of pyrax.cloudmonitoring but I couldn't find any good examples. Any help will be highly appreciated.


Solution

  • The equivalent to raxmon-checks-test is to use create_check and pass in test_only=True. At this time there is no direct equivalent to raxmon-checks-test-existing

    Here is the docstring provided in the create_check method:

    Creates a check on the entity with the specified attributes. The 'details' parameter should be a dict with the keys as the option name, and the value as the desired setting.

    If the 'test_only' parameter is True, then the check is not created; instead, the check is run and the results of the test run returned. If 'include_debug' is True, additional debug information is returned. According to the current Cloud Monitoring docs: "Currently debug information is only available for the remote.http check and includes the response body."

    The docs for create_check can be found at https://github.com/rackspace/pyrax/blob/master/docs/cloud_monitoring.md#create-the-check although they are currently lacking information about test_only.