Welcome to uDCV Developer Guide

Introduce

This documentation provides guidelines on interact with uDCV thought API, the following API topic are included:

Contents

API Concepts

uDCV provides 4 different API interfaces, which is command line, web service, JDCB, and message queue respectively.

Command Line API

Summary

uDCV come with a handy command line tools named uDCV-cli, which capable of send alarms, performance data, even add/update/delete asset records by a single command. This howto guide shows you how to use this powerful tool.

Install

Send Alarm

Usage

Open a windows command line, run event.bat with follow arguments:

Usage
Arguments Value
arg1 Scene name
arg2 _
arg3 Device ID
arg4 Event Title
arg5 OPEN/CLOSED
arg6 Severity (1 ~6) 1 = highest
arg7 Event Body
arg8 Occurrence
arg9 Modify time
arg10 _
arg11 _

Example

event.bat ecc _ rack5_10 "cpu high" OPEN 4 "cpu usage is over 80% for 10 minutes" 1447211892000 1447211892000 _ _ event.bat ecc _ rack18_11 "apache processes down" OPEN 2 "apache processes down" 1447211892000 1447211892000 _ _

Screen Capture

_images/event.png

Send Performance Data

Usage

Usage
Arguments Value
arg1 Scene name
arg2 _
arg3 Device ID
arg4 Index group
arg5 instance
arg6 Index name
arg7 [numerical|state]
arg8 unit
arg9 value
arg10 Occurrence

Example

perf.bat ecc _ rack5_10 CPU cpu01 cpu numerical % 80 1447211892000

perf.bat ecc _ rack5_10 Memory memory memory numerical % 20 1447211892000

perf.bat ecc _ rack5_10 Disk Disk1 /opt numerical % 51 1447211892000

Screen Capture

_images/perf.png

Add Asset to Cabinet

Usage
Arguments Value
arg1 Add, update or delete [add| upd| del]
arg2 scene
arg3 classID such as rackDevice
arg4 Asset ID
arg5 Asset properties in JSON format, see example below

Example

asset.bat upd ecc rackDevice cli001 "{'ID':'cli001','name':'cli001','belongTo':'567','CPU':'4 Core','Memory':'32G','OS':'WinServer 2008 R2 (64-bit)','site':'36-37','layout': '','deviceModelNumber':'IBM_system_x3550_m4'}"

Screen Capture

_images/asset.png

Web Service API

Summary

uDCV provides web service API to manipulate assets, performance and event data. A typical web service invoke in Java as following :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;

/**
* @Title: callService
* @Description:
* @return:Client
*/

public static Client callService() {
    JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
    Client client = dcf.createClient("http://localhost:8080/uinv_dev/services/DataStream?wsdl");
    return client;
}

public static void main(String[] args) {
    String pushData = "[{"scene":"demo","key":"","id":"ds003Server","app":"seltImport","inst":"_","param":"temperature","type":"numberic","unit":"%","val":"58","time": 1431405196437},{"scene":"demo","key":"","id":"ds002Server","app":"seltImport","inst":"_","param":"temperature","type":"status","unit":"%","val":"xxx58","time":1431405196437}]";
    Object[] res = null;
    try {
        res = client.invoke("pushMonitor", pushData);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return (String) res[0];
}

Performance Service

Usage
Arguments Value
URL http://localhost:8080/uinv_dev/services/DataStream?wsdl
Function Name pushMonitor
Input Parameter performance data in JSON format

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
public static void main(String[] args) {
    String pushData = "[{"scene":"demo","key":"","id":"ds003Server","app":"seltImport","inst":"_","param":"temperature","type":"numberic","unit":"%","val":"58","time": 1431405196437},{"scene":"demo","key":"","id":"ds002Server","app":"seltImport","inst":"_","param":"temperature","type":"status","unit":"%","val":"xxx58","time":1431405196437}]";
    Object[] res = null;
    try {
        res = client.invoke("pushMonitor", pushData);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return (String) res[0];
}

Monitoring Service

Usage
Arguments Value
URL http://localhost:8080/uinv_dev/services/DataStream?wsdl
Function Name pushAlarm
Input Parameter alarm data in JSON format

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
String pushData= "[{"scene":"demo","key":"","id":"d03server","title":"alarm title","status":"OPEN","severity":"1","msg":"alarm boday","time":1431405196437,"modifyTime":1431405196437,"arg1":"","arg2":""},{"scene":"demo","key":"","id":"d03server","title":"alarm title2","status":"CLOSED","severity":"1","msg":"alarm body 2","time":1431405196437,"modifyTime":1431405196437,"arg1":"","arg2":""}]";

Object[] res = null;

try {
    res = client.invoke("pushAlarm", pushData);
} catch (Exception e) {
    e.printStackTrace();
}
    return (String) res[0];
}

Asset Service

Add Asset

addRackEquipment
Arguments Value
URL http://localhost:8080/uinv_dev/services/DataStream?wsdl
Function Name addRackEquipment
Input Parameter data in JSON format
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
public static void main(String[] args) {
    String pushData= "{\"type\":\"rackDevice\",\"BizID\":\"FX10023100234\",\"Name\" : \"FX10023100234\",\"belongTo\" : \"P310-E-08\", \"location\" : \"\",\"deviceType\" : \"IBM System x3650\",\"site\":\"12-13\",\"ID\": \"IBM System x3650\", \"CabinetID\": \"\", \"Name\": \"FX10023100234\"}";
    Object[] res = null;
    try {
        res = client.invoke("addRackEquipment", pushData);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return (String) res[0];
}

Update Asset

updateRackEquipment
Arguments Value
URL http://localhost:8080/uinv_dev/services/DataStream?wsdl
Function Name updateRackEquipment
Input Parameter data in JSON format
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
public static void main(String[] args) {
    String pushData= "{\"type\":\"rackDevice\",\"BizID\":\"FX10023100234\",\"Name\" : \"FX10023100234\",\"belongTo\" : \"P310-E-08\", \"location\" : \"\",\"deviceType\" : \"IBM System x3650\",\"site\":\"12-13\",\"ID\": \"IBM System x3650\", \"CabinetID\": \"\", \"Name\": \"FX10023100234\"}";
    Object[] res = null;
    try {
        res = client.invoke("updateRackEquipment", pushData);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return (String) res[0];
}

Delete Asset

deleteRackEquipment
Arguments Value
URL http://localhost:8080/uinv_dev/services/DataStream?wsdl
Function Name deleteRackEquipment
Input Parameter data in JSON format
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
public static void main(String[] args) {
    String pushData= "[\"FX10023100234\",\"FX10023100244\"]";
    Object[] res = null;
    try {
        res = client.invoke("deleteRackEquipment", pushData);
    } catch (Exception e) {
        e.printStackTrace();
}
    return (String) res[0];
}

JDBC API

uDCV can connect and fetch data from external database using JDBC, to setup database connection, configure field mapping and schedule data fetch job, please go to management console --> data source menu in left-hand side navigation bar.

Define Datasource

_images/datasource.png

Message Queue API

Summary

uDCV leverage Apache Active MQ http://activemq.apache.org , as Message API, which:

MQ
Queue Name Usage
asset Asset Data
perf Performance Data
event Event Data

Note

  • The data format of Message body is JSON.
  • Default MQ listening port is 61616

asset

asset
Name Value Type
_operation_ add|upd|del String
_sc_ scene name String
_pool_ catalog String
_id_ primary key String
_data_ asset properties JSON

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[
   {
      "_operation_":"upd",
      "_sc_":"t1",
      "_pool_":"rackDevice",
      "_id_":"dtz",
      "_data_":{
         "ID":"dtz",
         "name":"VM-DB2",
         "belongTo":"P311-A1-01",
         "CPU":"4",
         "Memory":"4096111M",
         "OS":"WinServer 2008 R2 (64-bit)",
         "site":"23-25",
         "layout":"12",
         "deviceType":"IBMSystem"
      }
   }
]

perf

perf
Name Value Type
scene scene name String
id CI id String
app Performance group name Stirng
inst Performance instance name String
param Performance name String
type numerical|status String
unit Performance unit String
val Performance value String or Double

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[
   {
      "scene":"demo",
      "key":"",
      "id":"ds003Server",
      "app":"seltImport",
      "inst":"_",
      "param":"temperature",
      "type":"numerical",
      "unit":"%",
      "val":"58",
      "time":1431405196437
   },
   {
      "scene":"demo",
      "key":"",
      "id":"ds002Server",
      "app":"seltImport",
      "inst":"_",
      "param":"temperature",
      "type":"status",
      "unit":"%",
      "val":"xxx58",
      "time":1431405196437
   }
]

event

perf
Name Value Type
scene scene name String
id CI id String
title Event title Stirng
status open|close String
severity 1|2|3|4|5|6 String
msg Event body String
time Event occurrence time Long
modifyTime Event modify time Long
arg1 Extended field (optional) String
arg2 Extended field (optional) String

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[
   {
      "scene":"demo",
      "key":"",
      "id":"d03server",
      "title":"CPU High",
      "status":"OPEN",
      "severity":"1",
      "msg":"CPU usage is over 90% over 5 minutes",
      "time":1431405196437,
      "modifyTime":1431405196437,
      "arg1":"",
      "arg2":""
   },
   {
      "scene":"demo",
      "key":"",
      "id":"d03server",
      "title":"Disk Full",
      "status":"CLOSED",
      "severity":"1",
      "msg":"Disk usage is over 70%",
      "time":1431405196437,
      "modifyTime":1431405196437,
      "arg1":"",
      "arg2":""
   }
]