Jump to: navigation, search

Difference between revisions of "ServicePluginDocumentation"

Line 212: Line 212:
 
=== Showing Basic Service Info ===
 
=== Showing Basic Service Info ===
  
 +
GET /service/<ID>
 +
 +
 +
<pre><nowiki>
 
$ curl -v -X GET \
 
$ curl -v -X GET \
 
>        -H "X-Auth-Project-Id: openstack" \
 
>        -H "X-Auth-Project-Id: openstack" \
Line 239: Line 243:
 
     }
 
     }
 
}
 
}
 +
</nowiki></pre>

Revision as of 18:42, 8 February 2012

Services Extension Documentation

Description

The services extension for Nova is a tool to provide additional visibility into a running Nova installation, providing metrics, version, and configuration information.

Installation

Server-Side (Nova)

To use the service plugin, you must install the server-side extension into the nova/api/openstack/compute/contrib directory and then restart the API server.

Client-Side (Novaclient)

To use the service plugin from novaclient, you must install the novaclient extension. The easiest way to do this is to run:


pip install rax_services_python_novaclient_ext


Novaclient Extension Usage

Listing Available Services

$ nova service-list

+----+-----------+---------+----------+--------------+---------------------+
| ID |   topic   |   host  | disabled | report_count |      updated_at     |
+----+-----------+---------+----------+--------------+---------------------+
| 1  | compute   | squeeze | False    | 704782       | 2012-02-01 19:14:28 |
| 2  | scheduler | squeeze | False    | 714968       | 2012-02-01 19:14:34 |
| 3  | network   | squeeze | False    | 714983       | 2012-02-01 19:14:26 |
| 4  | console   | squeeze | False    | 0            | None                |
+----+-----------+---------+----------+--------------+---------------------+


Showing Basic Service Info

This shows information common to all services.


$ nova service-show 1

+--------------+------------------------------------------+
|   Property   |                  Value                   |
+--------------+------------------------------------------+
| disabled     | False                                    |
| host         | squeeze                                  |
| href         | http://10.127.4.222:8774/v1.1/services/1 |
| id           | 1                                        |
| report_count | 704789                                   |
| topic        | compute                                  |
| updated_at   | 2012-02-01 19:15:39                      |
+--------------+------------------------------------------+


Show Additional Service Details

This will show any information specific to a particular service-type. For example, the compute service will include hypervisor information.


$ nova service-details 1

+------------------------+-------+
|        Property        | Value |
+------------------------+-------+
| cpu_info               | 8     |
| hypervisor_type        | xen   |
| hypervisor_version     | 0     |
| local_gb               | 265   |
| local_gb_used          | 23    |
| memory_mb              | 32767 |
| memory_mb_used         | 2216  |
| memory_mb_used_servers | 256   |
| vcpus                  | 0     |
| vcpus_used             | 0     |
+------------------------+-------+


List Servers Belonging to Compute Resource

nova service-servers 1
+--------------------------------------+------------+--------+-------------------+
|                  ID                  |    Name    | Status |      Networks     |
+--------------------------------------+------------+--------+-------------------+
| 855f28fd-1d89-4a7d-b5a5-f4dd54e83550 | apple      | ACTIVE | private=10.0.0.34 |
| dae7b332-de5d-4fdd-a82b-1354e5b69f88 | dewberry   | ACTIVE | private=10.0.0.37 |
| f057f9ca-77db-445c-9867-77da79006232 | cherry     | ACTIVE | private=10.0.0.36 |
| f64687c3-9f93-46a0-81b8-be65d8286a69 | blackberry | ACTIVE | private=10.0.0.35 |
+--------------------------------------+------------+--------+-------------------+


Show Service Configuration Information

This will show Nova's FLAG settings.


$ nova service-config 1

+------------------------+-------+
|        Property        | Value |
+------------------------+-------+
| flag                   | 0     |
+------------------------+-------+


Show Service Version

$ nova service-version 1
2012.1-dev


API

Preface

To to pretty-print the JSON you can add:

alias ppjson="python -mjson.tool"


Listing Available Services

GET /services


$ curl -v -X GET \
        -H "X-Auth-Project-Id: openstack" \
        -H"X-Auth-Token: rick:openstack" \
        127.0.0.1:8774/v1.1/openstack/services | ppjson

> GET /v1.1/openstack/services HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 710
< Date: Wed, 08 Feb 2012 18:34:17 GMT
< 
{
    "services": [
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/1", 
            "id": 1, 
            "report_count": 764419, 
            "topic": "compute", 
            "updated_at": "2012-02-08 18:34:10"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/2", 
            "id": 2, 
            "report_count": 775038, 
            "topic": "scheduler", 
            "updated_at": "2012-02-08 18:34:14"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/3", 
            "id": 3, 
            "report_count": 775054, 
            "topic": "network", 
            "updated_at": "2012-02-08 18:34:10"
        }, 
        {
            "disabled": false, 
            "host": "squeeze", 
            "href": "http://127.0.0.1:8774/v1.1/services/4", 
            "id": 4, 
            "report_count": 0, 
            "topic": "console", 
            "updated_at": null
        }
    ]
}


Showing Basic Service Info

GET /service/<ID>


$ curl -v -X GET \
>         -H "X-Auth-Project-Id: openstack" \
>         -H"X-Auth-Token: rick:openstack" \
>         127.0.0.1:8774/v1.1/openstack/services/1 | ppjson
> GET /v1.1/openstack/services/1 HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.15 libssh2/1.2.6
> Host: 127.0.0.1:8774
> Accept: */*
> X-Auth-Project-Id: openstack
> X-Auth-Token: rick:openstack
> 
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 190
< Date: Wed, 08 Feb 2012 18:40:10 GMT
< 
{
    "service": {
        "disabled": false, 
        "host": "squeeze", 
        "href": "http://127.0.0.1:8774/v1.1/services/1", 
        "id": 1, 
        "report_count": 764454, 
        "topic": "compute", 
        "updated_at": "2012-02-08 18:40:01"
    }
}