12 Service Commands
The Service RESTful API is used to list and manage software services running on Oracle ZFS Storage Appliance.
Service Commands
The following service commands are available.
Table 12-1 Service Commands
Request | Append to Path /service/v{1|2} | Description |
---|---|---|
GET |
Use only /service/v{1|2} |
List service commands |
GET |
/services |
List all services |
GET |
/services/service |
Get configuration and status for the specified service |
PUT |
/services/service |
Modify the configuration of the specified service |
PUT |
/services/service/enable |
Enable the specified service |
PUT |
/services/service/disable |
Disable the specified service |
List Services
This command returns the list of configurable services available on Oracle ZFS Storage Appliance along with their enabled status. HTTP status 200 (OK) is returned for a successful command.
Example Request:
GET /api/service/v1/services HTTP/1.1 Host: zfs-storage.example.com:215 Accept: application/json
Example Result. For brevity, most entries are omitted:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked X-Zfssa-Service-Api: 1.0 { "services": [ { "<status>": "disabled", "href": "/api/service/v1/services/ad", "name": "ad", "log": { "href": "/api/log/v1/logs/appliance-kit-adstat:default", "size": 2 } }, { "<status>": "online", "href": "/api/service/v1/services/nfs", "name": "nfs", "log": { "href": "/api/log/v1/logs/appliance-kit-nfsconf:default", "size": 8 } }, { "<status>": "online", "href": "/api/service/v1/services/ssh", "name": "ssh", "log": { "href": "/api/log/v1/logs/network-ssh:default", "size": 134 } } ] }
Get Service
This command gets the details from a single service, including its state and its configuration.
Example Request:
GET /api/service/v1/services/ndmp HTTP/1.1 Host: zfs-storage.example.com:215 Accept: application/json
Example Result:
HTTP/1.1 200 OK Content-Type: application/json { "service": { "cram_md5_password": "", "cram_md5_username": "", "dar_support": true, "default_pools": [], "drive_type": "sysv", "href": "/api/service/v1/services/ndmp", "ignore_ctime": false, "name": "ndmp", "restore_fullpath": false, "status": "online", "tcp_port": 10000, "version": 4, "zfs_force_override": "off", "zfs_token_support": false } }
Change Service State
This command changes the state of a given service. The following URI parameters are used:
- service - Name of the service
- state - New service state:
enable
ordisable
Example Request:
PUT /api/service/v1/services/replication/enable HTTP/1.1 Host: zfs-storage.example.com:215 Accept: application/json
Successful response returns HTTP status 202 (Accepted). The service can also be enabled or disabled by sending a JSON request to the service.
Example Request Using JSON:
PUT /api/service/v1/services/replication HTTP/1.1 Host: zfs-storage.example.com:215 Accept: application/json Content-Type: application/json Content-Length: 22 {"<status>": "enable"}
To disable the service send the following JSON:
{"<status>": "disable"}
Modify Service Configuration
Configuration properties on a specified service can be modified by sending a PUT
request with the new property values defined in the header. Some services may have sub-resources, and they can also be modified by following the href defined in the sub-resource. Successful response returns HTTP status of 202 (Accepted).
Note:
To automatically configure the LDAP service for the currently joined AD domain, append/ldap?confirm=true
to path services/ad
. To view the settings after they are configured, use the GET
request and specify the LDAP service. See Get Service. To customize the settings, use the PUT
request and specify the LDAP service. See the following example.
The following example re-orders the list of servers for the LDAP service and specifies that the list of servers is in order of preference. For more information about LDAP configuration, see LDAP Configuration in Oracle ZFS Storage Appliance Administration Guide, Release OS8.8.x.
Current State:
GET /api/service/v1/services/ldap HTTP/1.1 Host: zfs-storage.example.com:215 Accept: application/json HTTP/1.1 200 OK Content-Type: application/json { "service":{ "href":"/api/service/v1/services/ldap", "<status>":"online", "servers":[ "ldap-server2.us.example.com:484", "ldap-server1.us.example.com:636" ], "use_server_order":false, "proxy_dn":"", "proxy_password":false, "base_dn":"dc=us,dc=oracle,dc=com", "search_scope":"one", "cred_level":"proxy", "auth_method":"simple", "use_tls":false, "user_search":[ ], "user_mapattr":[ ], "user_mapobjclass":[ ], "group_search":[ ], "group_mapattr":[ ], "group_mapobjclass":[ ], "netgroup_search":[ ], "netgroup_mapattr":[ ], "netgroup_mapobjclass":[ ], "server-000":{ "host":"ldap-server2.us.example.com", "port":484, "status": "online", "last_seen": "142s", "rtt": "70.285ms", "err_msg": "", "href":"/api/service/v1/services/ldap/server-000" }, "server-001":{ "host":"ldap-server1.us.example.com", "port":636, "status": "online", "last_seen": "142s", "rtt": "126.013ms", "err_msg": "", "href":"/api/service/v1/services/ldap/server-001" } } }
Example Request:
PUT api/service/v1/services/ldap HTTP/1.1 Host: zfs-storage.example.com:215 Content-Type: application/json { "servers": ["ldap-server1.us.example.com:636,ldap-server2.us.example.com:484"], "use_server_order":true }
Example Result:
HTTP/1.1 202 Accepted Content-Length: 1295 Content-Type: application/json; charset=utf-8 X-Zfssa-Service-Api: 1.0 { "service":{ "href":"/api/service/v1/services/ldap", "<status>":"online", "servers":[ "ldap-server1.us.example.com:636", "ldap-server2.us.example.com:484" ], "use_server_order":true, "proxy_dn":"", "proxy_password":false, "base_dn":"dc=us,dc=oracle,dc=com", "search_scope":"one", "cred_level":"proxy", "auth_method":"simple", "use_tls":false, "user_search":[ ], "user_mapattr":[ ], "user_mapobjclass":[ ], "group_search":[ ], "group_mapattr":[ ], "group_mapobjclass":[ ], "netgroup_search":[ ], "netgroup_mapattr":[ ], "netgroup_mapobjclass":[ ], "server-000":{ "host":"ldap-server1.us.example.com", "port":636, "status": "online", "last_seen": "142s", "rtt": "126.013ms", "err_msg": "", "href":"/api/service/v1/services/ldap/server-000" }, "server-001":{ "host":"ldap-server2.us.example.com", "port":484, "status": "online", "last_seen": "142s", "rtt": "70.285ms", "err_msg": "", "href":"/api/service/v1/services/ldap/server-001" } } }
Service Resources
Some services have sub-resources. See the data returned for each service or the list of service commands to see what sub-resources are available.
Table 12-2 Service Sub Resource Commands
Request | Path | Description |
---|---|---|
GET |
/services/service/resource |
List service sub-resource |
PUT |
/services/service/resource/href |
Modify sub-resource |
POST |
/services/service/resource |
Create a new sub-resource |
DELETE |
/services/service/resource/href |
Destroy an sub-resource |
Each of these commands follow the same pattern as other RESTful API commands where
GET
is used to list or get a specified sub-resource type,
POST
is used to create a new sub-resource type,
PUT
is used to modify the sub-resource and
DELETE
is used to destroy the specified sub-resource.
For a list of sub-resources and properties and commands available for each sub-resource, see Configuring Services in Oracle ZFS Storage Appliance Administration Guide, Release OS8.8.x.