Save a screenshot of a running KVM virtual machine on a target

Save a screenshot of a running KVM virtual machine on a target

POST api/v2/jobs/rvc '{"method":"kvm.screenshot","params":{"hostname":"<kvm_hostname>"},"hostnames":["<node_hostname>"]}'

Starts a SC//Reliantâ„¢ Virtual Controller (RVC) job to take a screenshot of a running KVM virtual machine on one or more targets. By default, the screenshot is returned in the job payload as a base64-encoded PNG image. If base64 is false, the PNG file is saved in the /tmp directory on the node and only its path is returned. The available targets are a node, node group, or saved filter. The response will indicate that the RVC job is created and is scheduled to run. You can use the job ID from the response to retrieve the job status and the payload.

The file name of a saved screenshot is screenshot_<kvm_hostname>_<timestamp>-UTC.png. The directory cannot be changed. Saved screenshots are not removed automatically.

In order to perform this action, the following conditions must be met:

  • Must have the Remote Job Execution feature turned on at the site level.
  • The user must have the following capabilities:
    • Create and Update a RVC job
    • Call KVM read-only methods

Request syntax

post api/v2/jobs/rvc '{"method":"kvm.screenshot","params":{"hostname":"<kvm_hostname>"},"hostnames":["<node_hostname>"]}'

Request parameters

The request accepts the following data in JSON format.

ParameterTypeDescriptionRequired
methodStringThe RVC action to start. This value is specified as a combination of the RVC module and method. For example, to take a screenshot of a KVM virtual machine you would specify the kvm module and the screenshot method combined as kvm.screenshot.Yes
paramsObjectThe parameters for the method. For the supported parameters, see Method parameters.Yes
hostnamesString arrayThe list of node hostnames on which to run the RVC job.Dependent. Only if no node group or saved filter is provided.
node_group_nameStringThe name of the node group on which to run the RVC job. The RVC job will run on all nodes that are members of the node group.Dependent. Only if no hostnames or saved filter is provided.
node_group_idIntegerThe ID of the node group on which to run the RVC job. The RVC job will run on all nodes that are members of the node group.Dependent. Only if no hostnames or saved filter is provided.
saved_filter_nameStringThe name of the saved filter on which to run the RVC job. The RVC job will run on all nodes that match the saved filter.Dependent. Only if no hostnames or node group is provided.
saved_filter_idIntegerThe ID of the saved filter on which to run the RVC job. The RVC job will run on all nodes that match the saved filter.Dependent. Only if no hostnames or node group is provided.

Method parameters

The params object accepts the following parameters.

ParameterTypeDescriptionRequiredDefault value
hostnameStringThe name of the virtual machine on the node.Yes-
base64BooleanIf true, the screenshot is returned as a base64-encoded PNG image in the contents field of the result, together with its width, height, and timestamp. If false, the screenshot is saved to the /tmp directory on the node and the result contains only its path.Notrue

Response syntax

When the hostnames request parameter is used, the following response syntax is received.

{
    "id": integer,
    "type": "RVC3",
    "status": "string",
    "message": "string",
    "trigged_by": "string",
    "parameters": {
        "method": "kvm.screenshot",
        "params": {
            "hostname": "<kvm_hostname>"
        },
        "update_rpm": boolean,
        "hostnames": [
            "string"
        ]
    },
    "time_started": "timestamp"
}

Response parameters

If the action is successful, an HTTP 200 response is returned. The following data is returned in JSON format.

FieldTypeDescription
idIntegerThe ID of the RVC job.
typeStringThe type of RVC job. For RVC jobs, it is RVC3.
statusStringThe status of the job.
messageStringThis field is reserved for internal use.
trigged_byStringThe username of the person who initiated the job.
parametersObjectThe request parameters indicating the method, method parameters, and the hostnames, node groups, or saved filters the RVC job ran on.
time_startedTimestampThe timestamp indicating when the job started. The timestamp is given in ISO 8601 UTC datetime format.

Errors

The following errors can be returned for a node in the job payload. For other errors, see Troubleshooting RVC jobs and Common errors.

CodeMessageCause
-32086Virtual Machine <name> not found on host.The virtual machine does not exist on the node. Run kvm.list to see the virtual machines on the node.

Examples

Example 1: Take a screenshot of a KVM virtual machine on a node.

This example takes a screenshot of the KVM virtual machine kvm1 on the node with hostname sit0001red0 and returns it as a base64-encoded PNG image.

ruby api.rb <customer_code> POST api/v2/jobs/rvc '{"method":"kvm.screenshot","params":{"hostname":"kvm1"},"hostnames":["sit0001red0"]}'

Response

{
  "id": 1782414,
  "type": "RVC3",
  "status": "pending",
  "message": null,
  "trigged_by": "test.user",
  "parameters": {
    "method": "kvm.screenshot",
    "params": {
      "hostname": "kvm1"
    },
    "update_rpm": true,
    "hostnames": [
      "sit0001red0"
    ]
  },
  "time_started": "2026-10-12T17:38:32Z"
}

Example 2: Retrieving the payload from the RVC job.

This example retrieves the payload from RVC job ID 1782414.

ruby api.rb <customer_code> GET "api/jobs/1782414?include_payload=true"

Response

{
  "id": 1782414,
  "type": "RVC3",
  "status": "finished",
  "message": null,
  "trigged_by": "test.user",
  "success_nodes_count": 1,
  "failed_nodes_count": 0,
  "total_nodes_count": 1,
  "parameters": {
    "method": "kvm.screenshot",
    "params": {
      "hostname": "kvm1"
    },
    "hostnames": [
      "sit0001red0"
    ],
    "update_rpm": true
  },
  "time_started": "2026-10-12T17:38:32Z",
  "time_finished": "2026-10-12T17:38:34Z",
  "payload": {
    "sit0001red0": [
      {
        "result": {
          "width": 1024,
          "height": 768,
          "contents": "iVBORw0KGgoAAAANSUhEUgAABAAAAAMACAIAAAA12IJa...",
          "timestamp": "2026-10-12-17-38-34.449-UTC"
        },
        "timestamp": 1791826715
      }
    ]
  }
}

The contents value is shortened in this example. Decode it from base64 to get the PNG image.

Example 3: Save a screenshot to a file on the node.

This example saves a screenshot of the KVM virtual machine kvm1 to the /tmp directory on the node with hostname sit0001red0. After the job finishes, retrieve the payload as shown in Example 2.

ruby api.rb <customer_code> POST api/v2/jobs/rvc '{"method":"kvm.screenshot","params":{"hostname":"kvm1","base64":false},"hostnames":["sit0001red0"]}'

Payload response

{
  "id": 1782412,
  "type": "RVC3",
  "status": "finished",
  "message": null,
  "trigged_by": "test.user",
  "success_nodes_count": 1,
  "failed_nodes_count": 0,
  "total_nodes_count": 1,
  "parameters": {
    "method": "kvm.screenshot",
    "params": {
      "base64": false,
      "hostname": "kvm1"
    },
    "hostnames": [
      "sit0001red0"
    ],
    "update_rpm": true
  },
  "time_started": "2026-10-12T17:38:14Z",
  "time_finished": "2026-10-12T17:38:16Z",
  "payload": {
    "sit0001red0": [
      {
        "result": {
          "path": "/tmp/screenshot_kvm1_2026-10-12-17-38-16.303-UTC.png"
        },
        "timestamp": 1791826697
      }
    ]
  }
}