Updated on 2022-08-02 GMT+08:00

Registering a Source Server with SMS

Function

This API is automatically called by the Agent to report the basic information about the source server to SMS. After the source server is registered successfully, you can view the source server information on the SMS console.

URI

POST /v3/sources

Request

Table 1 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Minimum length: 1 character

Maximum length: 16,384 characters

Table 2 Request body parameters

Specifies the parameter.

Mandatory

Type

Description

id

No

String

Specifies the ID of the source server in the SMS database.

Minimum length: 0 characters

Maximum length: 255 characters

ip

Yes

String

Specifies the IP address of the source server. This parameter is mandatory for registering the source server with SMS and optional for updating the information about the source server.

Minimum length: 0 characters

Maximum length: 255 characters

name

Yes

String

Specifies the name of the source server displayed on the SMS console.

Minimum length: 0 characters

Maximum length: 255 characters

hostname

No

String

Specifies the host name of the source server. This parameter is mandatory for registering the source server with SMS and optional for updating the information about the source server.

Minimum length: 0 characters

Maximum length: 255 characters

os_type

Yes

String

Specifies the OS type of the source server. This parameter is mandatory for registering the source server with SMS and optional for updating the information about the source server.

Minimum length: 0 characters

Maximum length: 255 characters

The value can be:

  • WINDOWS
  • LINUX

os_version

No

String

Specifies the OS version.

Minimum length: 0 characters

Maximum length: 255 characters

firmware

No

String

Specifies the boot mode.

Minimum length: 0 characters

Maximum length: 255 characters

The value can be:

  • BIOS
  • UEFI

cpu_quantity

No

Integer

Specifies the number of CPUs.

Minimum value: 0

Maximum value: 65535

memory

No

Long

Specifies the memory size (MB).

Minimum value: 0

Maximum value: 9223372036854775807

disks

No

Array of ServerDisk objects

Specifies the disk information of the source server.

btrfs_list

No

Array of BtrfsFileSystem objects

Specifies the Btrfs information on the source server. This parameter is mandatory for Linux. If no Btrfs exists on the source server, an empty array will be returned.

networks

No

Array of NetWork objects

Specifies the NIC information of the source server.

domain_id

No

String

Specifies the domain ID of a tenant.

Minimum length: 0 characters

Maximum length: 255 characters

has_rsync

No

Boolean

Specifies whether rsync is installed. This parameter is mandatory for Linux.

paravirtualization

No

Boolean

Specifies whether the source server is paravirtualized. This parameter is mandatory for Linux.

raw_devices

No

String

Specifies the list of raw devices. This parameter is mandatory for Linux.

Minimum length: 0 characters

Maximum length: 255 characters

driver_files

No

Boolean

Specifies whether any driver files are missing. This parameter is mandatory for Windows.

system_services

No

Boolean

Specifies whether there are abnormal services. This parameter is mandatory for Windows.

account_rights

No

Boolean

Specifies whether the account has the required permissions. This parameter is mandatory for Windows.

boot_loader

No

String

Specifies the system boot mode. This parameter is mandatory for Linux.

The value can be:

  • GRUB
  • LILO

system_dir

No

String

Specifies the system directory. This parameter is mandatory for Windows.

Minimum length: 0 characters

Maximum length: 255 characters

volume_groups

No

Array of VolumeGroups objects

This parameter is mandatory for Linux. If there is no volume group, remain an empty array [].

agent_version

Yes

String

Specifies the Agent version.

Minimum length: 0 characters

Maximum length: 255 characters

Table 3 ServerDisk

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the disk name.

Minimum length: 0 characters

Maximum length: 255 characters

partition_style

No

String

Specifies the disk partition type. This parameter is mandatory for source server registration.

The value can be:

  • MBR
  • GPT

device_use

Yes

String

Specifies the disk type.

The value can be:

  • BOOT
  • OS

size

Yes

Long

Specifies the disk size, in bytes.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

Specifies the used disk space, in bytes.

Minimum value: 0

Maximum value: 9223372036854775807

physical_volumes

Yes

Array of PhysicalVolume objects

Specifies the physical partition information of the disk.

os_disk

No

Boolean

Specifies whether the disk is the system disk.

relation_name

No

String

Specifies the name of the corresponding disk on the target server running Linux.

Minimum length: 0 characters

Maximum length: 255 characters

Table 4 PhysicalVolume

Parameter

Mandatory

Type

Description

device_use

No

String

Specifies the partition type. The value can be NORMAL, BOOT, or OS.

Minimum length: 0 characters

Maximum length: 255 characters

file_system

No

String

Specifies the file system type.

Minimum length: 0 characters

Maximum length: 255 characters

index

No

Integer

Specifies the serial number of the volume.

Minimum value: 0

Maximum value: 2147483647

mount_point

No

String

Specifies the mount point.

Minimum length: 0 characters

Maximum length: 255 characters

name

No

String

Specifies the volume name. In Windows, it indicates the drive letter, and in Linux, it indicates the device ID.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

No

Long

Specifies the used space.

Minimum value: 0

Maximum value: 9223372036854775807

uuid

No

String

Specifies the GUID of the volume, which can be obtained from the source server.

Minimum length: 0 characters

Maximum length: 255 characters

size_per_cluster

No

Integer

Specifies the size of each cluster.

Minimum value: 0

Maximum value: 2147483647

Table 5 BtrfsFileSystem

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the file system name.

Minimum length: 0 characters

Maximum length: 255 characters

label

Yes

String

Specifies the file system tag. If no tag exists, the value is an empty string.

Minimum length: 0 characters

Maximum length: 255 characters

uuid

Yes

String

Specifies the UUID of the file system.

Minimum length: 0 characters

Maximum length: 255 characters

device

Yes

String

Specifies the device name in the Btrfs.

Minimum length: 0 characters

Maximum length: 255 characters

size

Yes

Long

Specifies the space occupied by the file system.

Minimum value: 0

Maximum value: 9223372036854775807

nodesize

Yes

Long

Specifies the size of the Btrfs node.

Minimum value: 0

Maximum value: 9223372036854775807

sectorsize

Yes

Integer

Specifies the sector size.

Minimum value: 0

Maximum value: 2147483647

data_profile

Yes

String

Specifies the data profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

system_profile

Yes

String

Specifies the file system profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

metadata_profile

Yes

String

Specifies the metadata profile (RAD).

Minimum length: 0 characters

Maximum length: 255 characters

global_reserve1

Yes

String

Specifies the Btrfs file system information.

Minimum length: 0 characters

Maximum length: 255 characters

g_vol_used_size

Yes

Long

Specifies the used space of the Btrfs volume.

Minimum value: 0

Maximum value: 9223372036854775807

default_subvolid

Yes

String

Specifies the ID of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_name

Yes

String

Specifies the name of the default subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

default_subvol_mountpath

Yes

String

Specifies the mount path of the default subvolume or Btrfs file system.

Minimum length: 0 characters

Maximum length: 255 characters

subvolumn

Yes

Array of BtrfsSubvolumn objects

Specifies the subvolume information.

Table 6 BtrfsSubvolumn field description

Parameter

Mandatory

Type

Description

uuid

Yes

String

Specifies the UUID of the parent volume.

Minimum length: 0 characters

Maximum length: 255 characters

is_snapshot

Yes

String

Specifies whether the subvolume is a snapshot.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_id

Yes

String

Specifies the subvolume ID.

Minimum length: 0 characters

Maximum length: 255 characters

parent_id

Yes

String

Specifies the parent volume ID.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_name

Yes

String

Specifies the subvolume name.

Minimum length: 0 characters

Maximum length: 255 characters

subvol_mount_path

Yes

String

Specifies the mount path of the subvolume.

Minimum length: 0 characters

Maximum length: 255 characters

Table 7 NetWork field description

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the NIC name.

Minimum length: 0 characters

Maximum length: 255 characters

ip

Yes

String

Specifies the IP address bound to the NIC.

Minimum length: 0 characters

Maximum length: 255 characters

netmask

Yes

String

Specifies the subnet mask.

Minimum length: 0 characters

Maximum length: 255 characters

gateway

Yes

String

Specifies the gateway.

Minimum length: 0 characters

Maximum length: 255 characters

mtu

No

Integer

Specifies the NIC MTU. This parameter is mandatory for Linux.

Minimum value: 0

Maximum value: 2147483647

mac

Yes

String

Specifies the MAC address.

Minimum length: 0 characters

Maximum length: 255 characters

id

No

String

Specifies the database ID.

Minimum length: 0 characters

Maximum length: 255 characters

Table 8 VolumeGroups field description

Parameter

Mandatory

Type

Description

components

No

String

Specifies the physical volume information.

Minimum length: 0 characters

Maximum length: 255 characters

free_size

No

Long

Specifies the available space.

Minimum value: 0

Maximum value: 9223372036854775807

logical_volumes

No

Array of LogicalVolumes objects

Specifies the logical volume information.

name

No

String

Specifies the volume group name.

Minimum length: 0 characters

Maximum length: 255 characters

size

No

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

Table 9 LogicalVolumes field description

Parameter

Mandatory

Type

Description

block_count

No

Integer

Specifies the number of blocks.

Minimum value: 0

Maximum value: 4294967296

Default value: 0

block_size

No

Long

Specifies the block size.

Minimum value: 0

Maximum value: 1048576

Default value: 0

file_system

Yes

String

Specifies the file system.

Minimum length: 0 characters

Maximum length: 255 characters

inode_size

Yes

Integer

Specifies the number of inodes.

Minimum value: 0

Maximum value: 4294967296

mount_point

Yes

String

Specifies the mount point.

Minimum length: 0 characters

Maximum length: 256 characters

name

Yes

String

Specifies the volume group name.

Minimum length: 0 characters

Maximum length: 1,024 characters

size

Yes

Long

Specifies the volume size.

Minimum value: 0

Maximum value: 9223372036854775807

used_size

Yes

Long

Specifies the used space.

Minimum value: 0

Maximum value: 9223372036854775807

free_size

Yes

Long

Specifies the available space.

Minimum value: 0

Maximum value: 9223372036854775807

Response

Status code: 200

Table 10 Response body parameter

Parameter

Type

Description

id

String

Specifies the source server ID.

Minimum length: 0 characters

Maximum length: 255 characters

Example Request

After the Agent installed on the source server collects basic information about the source server, it automatically makes a call to this API to report the basic information to SMS.

POST https://{endpoint}/v3/sources

{
  "os_type" : "LINUX",
  "name" : "host-192-168-136-161",
  "os_version" : "SUSE12_64BIT_SP2",
  "linux_block_check" : "{\"release_type\": \"SUSE\", \"release_version\": \"12.2\", \"kernel_simplification\": \"4.4.21\", \"architecture\": \"x86_64\", \"kernel_version\": \"4.4.21-69-default\"}",
  "kernel_version" : "4.4.21-69-default",
  "virtualization_type" : "HVM",
  "paravirtualization" : true,
  "firmware" : "BIOS",
  "has_rsync" : true,
  "boot_loader" : "GRUB",
  "disks" : [ {
    "name" : "/dev/vda",
    "device_use" : "BOOT",
    "size" : 42949672960,
    "partition_style" : "MBR",
    "used_size" : 42948624384,
    "physical_volumes" : [ {
      "name" : "/dev/vda1",
      "size" : 2153775104,
      "device_use" : "NORMAL",
      "used_size" : 2153775104,
      "inode_size" : 0,
      "file_system" : "swap",
      "mount_point" : ""
    }, {
      "name" : "/dev/vda2",
      "size" : 16862150656,
      "device_use" : "BTRFS",
      "used_size" : 16862150656,
      "inode_size" : 0,
      "file_system" : "btrfs",
      "mount_point" : ""
    }, {
      "name" : "/dev/vda3",
      "size" : 23932698624,
      "device_use" : "NORMAL",
      "used_size" : 33988608,
      "inode_size" : 0,
      "file_system" : "xfs",
      "mount_point" : "/home"
    } ]
  }, {
    "name" : "/dev/vdb",
    "device_use" : "NORMAL",
    "size" : 21474836480,
    "partition_style" : "MBR",
    "used_size" : 21473787904,
    "physical_volumes" : [ {
      "name" : "/dev/vdb1",
      "size" : 21473787904,
      "device_use" : "VOLUME_GROUP",
      "used_size" : 21473787904,
      "inode_size" : 0,
      "file_system" : "LVM2_member",
      "mount_point" : ""
    } ]
  }, {
    "name" : "/dev/vdc",
    "device_use" : "VOLUME_GROUP",
    "size" : 21474836480,
    "partition_style" : "MBR",
    "used_size" : 0,
    "physical_volumes" : [ ]
  } ],
  "volume_groups" : [ {
    "name" : "vg1",
    "size" : 42948624384,
    "components" : "/dev/vdb1;/dev/vdc",
    "logical_volumes" : [ {
      "name" : "/dev/mapper/vg1-lv1",
      "device_use" : "NORMAL",
      "size" : 10737418240,
      "free_size" : 10713837568,
      "used_size" : 23580672,
      "file_system" : "ext4",
      "mount_point" : "/mnt/lv1",
      "inode_size" : "256"
    } ]
  } ],
  "btrfs_list" : [ {
    "name" : "/dev/vda2",
    "label" : "none",
    "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
    "device" : "/dev/vda2",
    "size" : "3.30GiB",
    "nodesize" : "16384",
    "sectorsize" : "4096",
    "data_profile" : "single",
    "system_profile" : "single",
    "metadata_profile" : "single",
    "global_reserve1" : "single",
    "g_vol_used_size" : "3894038528",
    "default_subvolid" : "259",
    "default_subvol_name" : "@/.snapshots/1/snapshot",
    "default_subvol_mountpath" : "/",
    "subvolumn" : [ {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "257",
      "parent_id" : "5",
      "subvol_name" : "@",
      "subvol_mount_path" : "null"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "258",
      "parent_id" : "257",
      "subvol_name" : "@/.snapshots",
      "subvol_mount_path" : "/.snapshots"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "true",
      "subvol_id" : "259",
      "parent_id" : "258",
      "subvol_name" : "@/.snapshots/1/snapshot",
      "subvol_mount_path" : "/"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "260",
      "parent_id" : "257",
      "subvol_name" : "@/boot/grub2/i386-pc",
      "subvol_mount_path" : "/boot/grub2/i386-pc"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "261",
      "parent_id" : "257",
      "subvol_name" : "@/boot/grub2/x86_64-efi",
      "subvol_mount_path" : "/boot/grub2/x86_64-efi"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "262",
      "parent_id" : "257",
      "subvol_name" : "@/opt",
      "subvol_mount_path" : "/opt"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "263",
      "parent_id" : "257",
      "subvol_name" : "@/srv",
      "subvol_mount_path" : "/srv"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "264",
      "parent_id" : "257",
      "subvol_name" : "@/tmp",
      "subvol_mount_path" : "/tmp"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "265",
      "parent_id" : "257",
      "subvol_name" : "@/usr/local",
      "subvol_mount_path" : "/usr/local"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "266",
      "parent_id" : "257",
      "subvol_name" : "@/var/cache",
      "subvol_mount_path" : "/var/cache"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "267",
      "parent_id" : "257",
      "subvol_name" : "@/var/crash",
      "subvol_mount_path" : "/var/crash"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "268",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/libvirt/images",
      "subvol_mount_path" : "/var/lib/libvirt/images"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "269",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/machines",
      "subvol_mount_path" : "/var/lib/machines"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "270",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/mailman",
      "subvol_mount_path" : "/var/lib/mailman"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "271",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/mariadb",
      "subvol_mount_path" : "/var/lib/mariadb"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "272",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/mysql",
      "subvol_mount_path" : "/var/lib/mysql"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "273",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/named",
      "subvol_mount_path" : "/var/lib/named"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "274",
      "parent_id" : "257",
      "subvol_name" : "@/var/lib/pgsql",
      "subvol_mount_path" : "/var/lib/pgsql"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "275",
      "parent_id" : "257",
      "subvol_name" : "@/var/log",
      "subvol_mount_path" : "/var/log"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "276",
      "parent_id" : "257",
      "subvol_name" : "@/var/opt",
      "subvol_mount_path" : "/var/opt"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "277",
      "parent_id" : "257",
      "subvol_name" : "@/var/spool",
      "subvol_mount_path" : "/var/spool"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "false",
      "subvol_id" : "278",
      "parent_id" : "257",
      "subvol_name" : "@/var/tmp",
      "subvol_mount_path" : "/var/tmp"
    }, {
      "uuid" : "51bc2b06-d675-4429-bef5-fedb11fe47f4",
      "is_snapshot" : "true",
      "subvol_id" : "282",
      "parent_id" : "258",
      "subvol_name" : "@/.snapshots/2/snapshot",
      "subvol_mount_path" : "null"
    } ]
  } ],
  "cpu_quantity" : 1,
  "memory" : 934752256,
  "networks" : [ {
    "name" : "eth0",
    "ip" : "192.168.136.161",
    "mac" : "1a9660eb8a3ffcf4df6d7865b52eb54f7b0cd194029e0eadd8e2c7f1267d80c0"
  } ],
  "ip" : "192.168.136.161",
  "agent_version" : "2.2.1"
}

Example Response

Status code: 200

The source server has been registered with SMS.

{
  "id" : "8abda8635e09d185015e09d188dd0001xx"
}

Status Codes

Status Code

Description

200

The source server has been registered with SMS.

Error Codes

See Error Codes.