YaST REST Service Documentation

Copyright © 2009-10 Novell, Inc.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright notice and license. A copy of the license version 1.2 is included in the section entitled "GNU Free Documentation License".

Status Module

Only authenticated users are allowed to access the API. Authentication is done by sending a Basic HTTP Authorisation header.

All names aren't allowed to contain spaces, slashes or colons.

Table of Contents

Table of Contents

Formats

The status REST service supports only XML and JSON input/output formats.

Overview

This module provides an overview about system state like CPU, Memory or Disk usage.

The information will be provided by the service "collectd" which has to run.

PolicyKit Access Rights

The following PolicyKit permission are needed:

Reading system information: org.opensuse.yast.system.status.read

Writing limits: org.opensuse.yast.system.status.writelimits

System Actions

GET /graphs/<component>?checklimits=true

Arguments:

Get the graph description which data has to be shown and how the data has to be shown in the graphs.

component: component like CPU, memory,... (optional)

checklimits: checking if a defined limit has been reached for all or only one component (optional)

CURL Example:

curl -u user http://localhost:4984/graphs.xml

curl -u user http://localhost:4984/graphs.xml?checklimits=true

curl -u user http://localhost:4984/graphs/Memory.xml

curl -u user http://localhost:4984/graphs/Memory.xml?checklimits=true

Result: Example

GET /metrics

Getting the information which data is available (CPU, Network,..). This call does not return the current values of e.G. free Memory.

CURL Example: curl -u user http://localhost:4984/metrics.xml

Result: Example

GET /metrics/<metrics-id>?start=value&stop=value

Arguments:

This call returns the current values of the given metrics-id (e.g.waerden+cpu-0+cpu-idle)

metrics-id: collectd id like "waerden+memory+memory-used"

start: starttime in seconds (unix format) (optional)

stop: endtime in seconds (unix format) (optional)

CURL Example:

curl -u user http://localhost:4984/metrics/waerden+memory+memory-used.xml

curl -u user http://localhost:4984/metrics/waerden+memory+memory-used.xml?start=1262701653&stop=1262701953

Result: Example

PUT /graphs/<group-id>

Arguments:

Set limits of system states which should not be exceeded or undercut.

group-id: Graph group id like Memory, CPU, Disk,...

CURL Example: curl -u user -X PUT -H 'Content-type: application/xml' -d @memory.xml http://localhost:4984/graphs/memory.xml

Body: Example

Result: Example

GET /logs

Getting the information which logfiles are available. This call does not return the content of a file.

CURL Example: curl -u user http://localhost:4984/logs.xml

Result: Example

GET /logs/<log-id>?pos_begin=value&lines=value

Arguments:

Getting the content of a file.

log-id: File id. Defined in the description file.

pos_begin: Line number of the requested text.

lines: Number of lines which are requested.

CURL Example: curl -u user http://localhost:4984/logs/system.xml?pos_begin=260;lines=2

Result: Example