API Docs for: 2.6
Show:

plugin_rest_profiling Class

Module: plugins_rest
Parent Module: com_profiling_rest

REST plugin that provides profiling functions through the following REST API:

GET requests

  1. profiling/proc
  2. profiling/ports
  3. profiling/system
  4. profiling/pkg_ver
  5. profiling/node_ver
  6. profiling/proc_mem
  7. profiling/sys_cpus
  8. profiling/db_stats
  9. profiling/log_stats
  10. profiling/tot_users
  11. profiling/conn_clients

profiling/proc

Returns the data about the process.

Example JSON response:

{
    "pid": 23511,
    "uptime": "0 Days - 00:00:04",
    "pkg_ver": {
        "nethcti": "nethcti-2.1.10.3-1.el5.nh",
        "nethcti-server": "nethcti-server-2.1.9-1.el5.nh"
    },
    "proc_mem": {
        "rss": 58224640,
        "heapTotal": 48951456,
        "heapUsed": 30448624
    },
    "db_stats": {
        "numExecQueries": 7
    },
    "tot_users": 7,
    "conn_clients": {
        "ws_conn_clients": 1,
        "tcp_conn_clients": 0
    }
}

profiling/ports

Returns the listening network ports.

Example JSON response:

{
    "tcp": "8182",
    "websocket": {
        "http": "8183",
        "https": "8181"
    },
    "http_proxy": {
        "http": "8179",
        "https": "8180"
    }
}

profiling/system

Returns the data about the system.

Example JSON response:

{
    "cpus": [
        {
            "model": "AMD Athlon(tm) II X2 260 Processor",
            "speed": 3203,
            "times": {
                "user": 27304700,
                "nice": 23400,
                "sys": 8106900,
                "idle": 2591394200,
                "irq": 3706000,
            }
        }
    ],
    "arch": "ia32",
    "distro": "Neth Service release 8.2",
    "totmem": 527241216,
    "freemem": 9342976,
    "hostname": "nethvoice",
    "node_ver": "v0.8.26",
    "load_avg": [
        0.1328125,
        0.24951171875,
        0.29638671875
    ]
}

profiling/pkg_ver

Returns the package software version.

Example JSON response:

{ "nethcti": "nethcti-2.1.10.3-1.el5.nh", "nethcti-server": "nethcti-server-2.1.9-1.el5.nh" }

profiling/node_ver

Returns the node version.

Example JSON response:

{ "node_ver": "v0.8.26" }

profiling/proc_mem

Returns the quantity of the memory used by the process in byte.

Example JSON response:

{
    "rss": 4935680,
    "heapTotal": 1826816,
    "heapUsed": 650472
}

profiling/sys_cpus

Returns the data about the system cpus.

Example JSON response:

[{
    model: "AMD Athlon(tm) II X2 260 Processor",
    speed: 3203,
    times: {
        user: 19331800,
        nice: 22300,
        sys: 5780900,
        idle: 1808449400,
        irq: 2565200
    }
}]

profiling/tot_users

Returns the total number of the configured users.

Example JSON response:

{ tot_users: 15 }

profiling/conn_clients

Returns the number of connected clients.

Example JSON response:

{ ws_conn_clients: 4, tcp_conn_clients: 2 }

profiling/db_stats

Returns the database statistics.

Example JSON response:

{ num_exec_queries: 151 }

profiling/log_stats

Returns the log statistics.

Example JSON response:

{ warn: 5, error: 0 }

Methods

all

(
  • req
  • res
  • next
)

Get the quantity of the memory usage by the process by the following REST API:

proc_mem

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

conn_clients

(
  • req
  • res
  • next
)

Gets the number of connected clients with the following REST API:

conn_clients

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

db_stats

(
  • req
  • res
  • next
)

Gets the number of executed queries with the following REST API:

db_stats

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

getConnectedClientsNum

() Object private

Returns the number of connected clients.

Returns:

Object:

The number of connected clients by websocket and tcp.

getLogStats

() Object private

Returns the log statistics.

Returns:

Object:

The log statistics.

log_stats

(
  • req
  • res
  • next
)

Gets the number of warning and error logs with the following REST API:

log_stats

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

node_ver

(
  • req
  • res
  • next
)

Get the version of the node by the following REST API:

node_ver

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

pkg_ver

(
  • req
  • res
  • next
)

Get version of the packages by the following REST API:

pkg_ver

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

ports

(
  • req
  • res
  • next
)

Get the listening network ports by the following REST API:

ports

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

proc

(
  • req
  • res
  • next
)

Get the data about the process by the following REST API:

proc

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompConfigManager

(
  • comp
)

Sets the configuration architect component.

Parameters:

  • comp Object

    The configuration architect component.

setCompDbConn

(
  • comp
)

Sets the database architect component.

Parameters:

  • comp Object

    The database architect component.

setCompProfiling

(
  • comp
)

Sets the profiling architect component.

Parameters:

  • comp Object

    The profiling architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

sys_cpus

(
  • req
  • res
  • next
)

Gets the data about the cpus with the following REST API:

sys_cpus

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

system

(
  • req
  • res
  • next
)

Get the data about the system by the following REST API:

system

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

tot_users

(
  • req
  • res
  • next
)

Gets the total number of the configured users with the following REST API:

tot_users

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

Properties

compConfigManager

Object private

The configuration architect component.

compDbConn

Object private

The database architect component.

compProfiling

Object private

The profiling architect component.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • proc String

    To get the data about the process

  • ports String

    To get the listening network ports

  • system String

    To get the data about the system

  • pkg_ver String

    To get version of the packages

  • node_ver String

    To get version of the node

  • proc_mem String

    To get the quantity of the memory usage by the process

  • sys_cpus String

    To get the data about the cpus of the system

  • db_stats String

    To get the database statistics

  • log_stats String

    To get the log statistics

  • tot_users String

    To get the total number of the configured users

  • conn_clients String

    To get the number of connected clients

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/profiling]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console