Server Methods

API Methods for dealing with servers

server.info()

Describes the server returning a dictionary.

Parameters:name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:A dictionary with the following keys:
name
String: name of this server (same as service name), e.g. “testaa1”.
host_name
String: host name for this server, e.g. “testaa1.miniserver.com”.
primary_ip
String: primary IP address for this server, e.g. “1.2.3.4”.
ips
List of Dictionaries: All the IP addresses assigned to this server described as a dictionary with the following keys:
address
String: IP address, e.g. “1.2.3.4”.
reverse_map
String: Reverse mapping for IP address, e.g. “server.example.com”.
bytes_in_yesterday
Integer: Bytes received yesterday to this IP address.
bytes_out_yesterday
Integer: Bytes sent yesterday from this IP address.
bytes_in_today
Integer: Bytes received today so far to this IP address.
bytes_out_today
Integer: Bytes sent today so far from this IP address.
vlans
Dictionary with the following keys:
tagged:
List of Strings: The names of all the tagged vLANs this server is in.
untagged:
List of Strings: The names of all the untagged vLANs this server is in.
os
String: describing the Operation System installed, e.g. “debian_wheezy_64”, “win2012serverstd_r2_64”.
backups
Boolean: whether this server has a backup service.
control_panel
String: describing the control panel, e.g. “none”, or “cpanel”.
firewall_type
String: describing the firewall type, e.g. “none”, “basic”, “self_managed” or “managed”.
firewall_rule_group
Dictionary: describing the firewall rule group applied to the server as returned by firewalling.rule_group_info(). Empty if firewall_type is “none”.
monitoring_level
Strong: describing the monitoring level, “basic”, “advanced” or “managed”.
monitor
Boolean: whether we are monitoring this server.
ignore_monitoring_off
Boolean: the customer has acknowledged that they aren’t being monitored.
no_nrpe
Boolean: Disable NRPE agent for this server.
no_auto_reboot
Boolean: Don’t auto reboot this server.
support_level
String: support level “infrastructure_only”, “basic” or “managed”.
vulnscan
String: whether this server is vulnerability scanned, ‘none’ = no scanning, ‘basic’ = Self-monitored, ‘managed’ = Memset-monitored.
penetration_patrol
String: The intrusion detection support level for this server e.g. “none”, “basic” = Self-monitored, “monitored” = Memset-monitored or “protected” = Memset-protected
penetration_patrol_alert_level
Integer: The alert level that is set for Penetration Patrol intrusion detection (1-15) or 0 (penetration_patrol=”none”)

The keys as described in service.info() will also be returned.

server.list()

List all the servers for an account.

If the status isn’t passed in then it will find all the servers with status=LIVE.

Parameters:status (String, Optional) – Status of the server to look for. Acceptable values: ‘LIVE’, ‘CANCELLED’.
Returns:Returns a list of dictionaries where each dictionary is as described in func:server_info.
server.move_ips()

Moves a list of public IPv4 address from one server to another.

This cannot be used to move IPs that are private, or where the source or destination server are in assigned to a load balancer.

The list of IPs will need to be configured on the host once the job has completed.

If the destination host is a Linux Miniserver, the IPs can be automatically applied by triggering a reboot with server.reboot().

Please note that if the destination host is a Miniserver without a vLAN, it will require a reboot using server.reboot() for the new IPs to be routed correctly.

The source and destination servers will be unavailable for a short period during this move.

Parameters:
  • source_ips (List) – List of public IP addresses to be moved.
  • destination_name (String) – Name of the server. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:

A dictionary as described in job.status().

Raises :

ApiErrorDoesNotExist if the destination_name or any ip in source_ips cannot be found.

ApiErrorBadParameters if an empty list of IPs is provided.

ApiErrorPreconditionFailed will be raised if:

  • Any server is in a load balancer.
  • Any IP cannot be moved to the destination network zone.
  • Any of the supplied IPs are private.
  • If any IP is the primary IP of a server.
server.reboot()

Schedules a reboot for name

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • email_address (String, Optional) – Email address for response to reboot, uses admin contact email if not passed in. Must be a valid email address.
Returns:

A dictionary as described in job.status().

Raises :

May raise ApiErrorAlreadyInProgress if a reboot is pending already.

server.reimage_from_snapshot()

Schedules re-imaging of name.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • storage_name (String) – Name of the storage service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • image_type (String) – Snapshot image type. Acceptable values: ‘raw’, ‘tar’, ‘ntfsclone’.
  • snapshot_path (String) – Path to the snapshot (check notes).
Returns:

A dictionary as described in job.status().

Raises :

May raise one of the following exceptions:

This method is only available on Miniservers.

The snapshot path parameter depends on the image type:
  • raw images: the path to the .raw.gz image.
  • ntfsclone images: the path to the snapshot directory (it must contain the .XMBR file and all the .img.gz files).
  • tar images: the path to the .tar image.

When using a raw image, it must contain an instance of the same type of operating system as currently installed on the server. For example: re-imaging a Linux based server with a Microsoft Windows raw image will result in a broken system.

An email will be sent to the admin contact when the process is finished.

See also server.snapshot_list() for retrieving a list of valid snapshots from a storage.

server.reimage_from_stock_image()

Schedules re-imaging of name.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • os (String) – The Operating System name.
  • os_bits (String, Optional) – Whether to use a 32 or 64-bit system. Note that some operating systems may not be available in both versions. Acceptable values: ‘32’, ‘64’.
  • pub_ssh_key (String, Optional) – Public SSH key to be installed in the server (root user). Only available when reimaging a Linux server.
Returns:

A dictionary as described in job.status().

Raises :

May raise one of the following exceptions:

This method is only available on Miniservers.

The os and os_bits parameters are as described in Create Methods.

You can manage public SSH keys on the Manage SSH Keys page in the Memset control panel.

server.set_penetration_patrol_alert_level()

Sets the Penetration Patrol (intrusion detection) email alert level for name.

Refer to the Penetration Patrol page for alert levels.

Raises :

May raise ApiErrorPreconditionFailed if Penetration Patrol is not enabled on this server.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • alert_level (Integer) – The required new Penetration Patrol alert level. Ensure this value is greater than or equal to 1. Ensure this value is less than or equal to 15.
server.slave_ns_add()

Add a domain to the Memset name server slaves for the primary name server name.

It may take up to 30 minutes for the domain to be added.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • domain_name (String) – The slaved domain name. Must be a valid host name.
Returns:

The added domain name

Raises :
May raise one of the following exceptions:
server.slave_ns_delete()

Delete a domain from the Memset name server slaves for the primary name server name.

It may take up to 30 minutes for the domain to be deleted.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • domain_name (String) – The slaved domain name. Must be a valid host name.
Returns:

The deleted domain name.

Raises :

ApiErrorDoesNotExist if name cannot be found for the account or slaved domain_name not found for name.

server.slave_ns_list()

List all domain names being slaved by Memset’s name server slaves for the primary name server name.

Parameters:name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:A list of domain names.
Raises :ApiErrorDoesNotExist if name cannot be found for the account.
server.snapshot()

Schedules a snapshot for name.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • storage_name (String) – Name of the storage service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • image_type (String) – Snapshot image type. Acceptable values: ‘raw’, ‘tar’, ‘ntfsclone’.
Returns:

A dictionary as described in job.status().

Raises :

May raise one of the following exceptions:

This method is only available on Miniservers.

  • “raw” - Supported for Miniservers running Microsoft Windows or a Linux operating system.
  • “ntfsclone” - Only supported for Miniservers running a Microsoft Windows operating system.
  • “tar” - A deprecated image type for use with our classic Miniservers running a Linux operating system.

Please be advised that classic Miniservers are deprecated and won’t be supported in future API releases.

server.snapshot_delete()

Deletes a snapshot.

Parameters:
  • storage_name (String) – Name of the storage service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • snapshot_path (String) – Path to the snapshot as returned by server.snapshot_list method. Ensure this value has at most 255 characters.
Returns:

A dictionary as described in job.status().

Raises :

May raise ApiErrorAlreadyInProgress if there is a pending deletion for that snapshot.

The snapshots are expected to be in a container named ‘miniserver-snapshots’, so the path to the snapshot is relative to this container.

See also server.snapshot_list() for retrieving a list of valid snapshots from a storage.

server.snapshot_list()

Lists snapshots found in the storage identified by storage_name.

Parameters:storage_name (String) – Name of the storage service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
Returns:An array of dictionaries with the following keys:
snapshot_path
String: full path to the snapshot.
image_type
String: “raw”, “ntfsclone” or “tar”.
os_type
String: “linux”, “windows”, “freebsd”, etc; or “unknown” in case it can’t be identified.
os_option
String: operating system option to be used to provision a Miniserver using this snapshot.
description
String: description of the snapshot.
user_comment
String: user provided comment (if any) or none.
last_modified
Date: last modification date of the snapshot.
Raises :May raise ApiErrorDoesNotExist if no snapshots are found.

The snapshots are expected to be in a container named ‘miniserver-snapshots’. This function doesn’t guarantee that found snapshots are correct.

server.upgrade()

Upgrades a Miniserver instance to a higher specification.

Parameters:
  • name (String) – Name of the service. Service names are 1-64 characters A-Z, a-z, 0-9, -, . and _. Ensure this value has at most 64 characters.
  • new_sku (String) –

    The SKU you wish to upgrade to. Acceptable values for Miniserver VM VPS packages (monthly billing) are

    sku description
    MS0025 Miniserver VM1000
    MS0050 Miniserver VM2000
    MS0100 Miniserver VM4000
    MS0200 Miniserver VM8000
    MS0400 Miniserver VM16000
    MS0800 Miniserver VM32000

    Acceptable values for Miniserver cloud compute (billed hourly) are

    sku description
    MS0025H Miniserver VM1000 (Hourly)
    MS0050H Miniserver VM2000 (Hourly)
    MS0100H Miniserver VM4000 (Hourly)
    MS0200H Miniserver VM8000 (Hourly)
    MS0400H Miniserver VM16000 (Hourly)
    MS0800H Miniserver VM32000 (Hourly)
  • dry_run (Boolean) – If True, then the service is not provisioned but the information is still returned.
  • upgrade_disk (Boolean, Optional) – If set to False, the disk won’t be upgraded. If you don’t change your disk you can reduce the time required for the upgrade and later you’ll have the option to downgrade your Miniserver if you need to.
Returns:

A dictionary with the following keys

new_sku

String: The new SKU of the server.

dry_run

Boolean: As specified in the API call.

currency

String: The currency of the order. You cannot specify the currency in the API request, the account’s currency will be used. Currently, the account currency must be changed via the Memset website. Returned value will be one of ‘GBP’, ‘USD’, or ‘EUR’.

net_setup_price

Float: There will be a one-off setup charge to cover the rental increase until the service expiry date, net of VAT. Only for Miniserver VM VPS Packages.

net_increase

Float: The increase of the monthly rental for the service, net of VAT. Only for Miniserver VM VPS packages.

net_hourly_inarrears_rental_price

Float: The new hourly rate for the service, net of VAT. Only for Miniserver cloud compute.

invoice_ref

Integer: The invoice reference for the order. Will not be provided if the method is called with dry_run=True.

job

Dictionary: Provides the status of the job to set up the requested service. Will not be provided when the method is called with dry_run=True. See job.status() for further details.

This method is only available on Miniservers.

See the following pages for princing and more information:

Previous topic

Payment Method Methods

Next topic

Server Monitoring Methods

This Page