Get Virtualizor

List Services

Use the list services API to list all the services of the server. The API response consists of "services" key which are the services present on the server, "autostart" key which are the services that will start on server when the server boots and the "running" key which contains the services that are currently running. You can check services on both the Master as well Slave server using this API.

HTTP Request

https://hostname:4085/index.php?act=services

Parameters

NameMethodValueDescriptionRequired
actGETservicesThe action specified to perform the operation and return the dataYes
changeseridGETIntThe server ID whose services need to be fetched, default is zeroNo

Sample Code

<?php

    require_once('/usr/local/virtualizor/sdk/admin.php');

    $key =  'your_api_key';
    $pass = 'your_api_pass';
    $ip = 'your_server_ip';

    $admin = new Virtualizor_Admin_API($ip, $key, $pass);

    $post = array();
    $post['changeserid'] = 3;       

    $output = $admin->services($post);

    print_r(json_encode($output));

?>

Output

{
    "title": "Services",
    "autostart": [
        "auditd",
        "blk-availability",
        "cgconfig",
        "crond",
        "dhcpd",
        "haldaemon",
        "ip6tables",
        "iptables",
        "iscsi",
        "iscsid",
        "ksm",
        "ksmtuned",
        "libvirt-guests",
        "libvirtd",
        "lvm2-monitor",
        "mdmonitor",
        "messagebus",
        "netcf-transaction",
        "netfs",
        "network",
        "nfslock",
        "portreserve",
        "rpcbind",
        "rpcgssd",
        "rsyslog",
        "sendmail",
        "sshd",
        "udev-post",
        "virtnetwork",
        "virtualizor",
        "zzvirtservice"
    ],
    "running": [
        "auditd",
        "cgconfig",
        "crond",
        "dhcpd",
        "ebtables",
        "haldaemon",
        "ip6tables",
        "iptables",
        "ksm",
        "ksmtuned",
        "libvirt-guests",
        "libvirtd",
        "messagebus",
        "netcf-transaction",
        "netconsole",
        "network",
        "nfslock",
        "rpcbind",
        "rsyslog",
        "sendmail",
        "sshd",
        "virtnetwork",
        "virtualizor"
    ],
    "services": {
        "0": "auditd",
        "1": "cgconfig",
        "2": "crond",
        "3": "dhcpd",
        "4": "ebtables",
        "5": "haldaemon",
        "6": "ip6tables",
        "7": "iptables",
        "8": "ksm",
        "9": "ksmtuned",
        "10": "libvirt-guests",
        "11": "libvirtd",
        "12": "messagebus",
        "13": "netcf-transaction",
        "14": "netconsole",
        "15": "network",
        "16": "nfslock",
        "17": "rpcbind",
        "18": "rsyslog",
        "19": "sendmail",
        "20": "sshd",
        "21": "virtnetwork",
        "22": "virtualizor",
        "24": "blk-availability",
        "31": "iscsi",
        "32": "iscsid",
        "37": "lvm2-monitor",
        "38": "mdmonitor",
        "41": "netfs",
        "44": "portreserve",
        "46": "rpcgssd",
        "50": "udev-post",
        "53": "zzvirtservice"
    },
    "timenow": 1536668727,
    "time_taken": "2.193"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list