Idea Details

NodeJS SDK

Last activity 12 days ago
Tgentilhomme's profile image
09-05-2016 08:29 AM

Hi,

 

A NodeJS SDK could be very useful (In response to async needs). A multi thread mentality is not very useful in many situations (and really hard to develop/maintain). The NodeJS mentaly is better for all I/O processing (And monitoring system is a lot of I/O actions...).

 

ECMAscript6 is now a pretty cool langage (more than perl for scripting) and may be similar to JAVA with TypeScript. NodeJS is a world reference to work with a REST API (And can implement their own REST easily).

 

If you want to deploy a NodeJS script without Node on the system : you can (just put Node.exe in the package on the root path). 

 

In a service way Node and Javascript are better to handle callback with events listening than any langages... (With a non-blocking main thread). 

 

And many many other advantages. (Events,Streams, cool TCP/UDP server etc..).

 

Implementation example for PU.exe here : GitHub - UIM-Community/NodeUIM: CA UIM NodeJS interface to work with pu.exe in a full async way.   (A first Sugar preview in some).

 

Best Regards,

Thomas


Comments

05-22-2017 11:15 AM

Hi,

 

Another update on this subject, do not hesitate to check my latest NodeUIM npm package (and the API documentation).

request.md · UIM-Community/NodeUIM Wiki · GitHub 

 

Little code sample : GitHub - UIM-Community/checkconfig_node: checkconfig with NodeUIM lib. (Example)  

And here this is just a little example with one or two hours of works. (Still have some works around)

 

I repeat for those they love typings, you could transpile from Dartlang or TypeScript. TypeScript follow ECMA standard (Structural Typing) and Dartlang with a strict nominal typing (JAVA/C# Like). Both are mature and used in production by many big company.

 

TypeScript - JavaScript that scales. 

Dart programming language | Dart 

 

These two langages are perfectly integrated into VS Code and in all recent Visual Studio suite. 

Visual Studio Code - Code Editing. Redefined 

 

Other big point for Node

 

Most NoSQL database of today (MongoDB, Redis, ArrangoDB, RethinkDB, etc..) have a very good NodeJS implementations (most of them support NodeJS has a primary platform). Seem obvious when most of them are Object-oriented ( without talking of the simplicity of async operations that give NodeJS ). 

 

ACID Model is not good enougth (or cost to much to perform "well" ). A NodeJS SDK will bring new opportunity for customers and developers.

 

Best Regards,

Thomas

03-07-2017 10:01 AM

Hi,

 

I worked a little bit on the subject ( Main structure ). 

 

GitHub - fraxken/REST_NodeUIM: NodeJS RESTFul lib for CA UIM 

 

Now i have to code all http calls  

 

Best Regards,

Thomas

02-18-2017 08:27 AM

Good job. I already made something similar for fun. What i want to do on this side is an api like : 

 

Rest.alarms.getAll() 

Rest.alarms.acknowledge('id'); 

etc...

 

Thing like that for all http calls with native http and promise support (maybe directly with async/await with the latest Node version that bring this without --harmony flag). 

 

Maybe one day when i have some free time

02-17-2017 10:07 AM

I've done some similar efforts with the REST API from NodeJS here is an example of a GET request using the request-promise library if you are interested.

 

var rp = require('request-promise');

var user = "username";
var password = "password";
var auth = "Basic " + new Buffer(user + ":" + password).toString("base64");
/**
* GET /alarms
* Retrieve all alarms via REST.
*/

exports.getAllAlarms = function(req, res) {
    var options = {
        uri: 'http://ump.ca.com/rest/alarms',
        headers: {
            'Authorization': auth,
            'Content-Type': 'application/json',
            'Accept': 'application/json'
        },
        json: true // Automatically parses the JSON string in the response
    }
    rp(options)
        .then(function(response) {
            console.log(response);
            res.json(response);
        })
};

 

and a POST example:

 

/** * POST /alarms * POST an alarm via REST. */ exports.postAlarm = function(req, res) { console.log('Posting alarm'); var options = { method: 'POST', uri: 'http://ump.ca.com/rest/alarms/createAlarm', headers: { 'Authorization': auth, 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: { "level":"1", "message":"Test message", "metId":"MD8110AB685AA9D19C8F7F807FDAC306F", "severity":"Informational", "source":"w2k8r2-x64-lc", "subsystemId":"1", "suppressionKey":"", "ciType":"1.1.2", "ciName":"Disk Usage", "hostname":"", "custom1":"A custom property 1", "custom2":"A custom property 2", "custom3":"A custom property 3", "custom4":"A custom property 4", "custom5":"A custom property 5" }, json: true // Automatically parses the JSON string in the response } rp(options) .then(function(response) { console.log('Post alarm succeeded'); res.json(response); }) .catch(function(err) { console.log('Post alarm failed: '+err); }) };

02-14-2017 08:06 AM

Hi,

 

I recently made a NodeJS interface/binding to use pu.exe (and some others very soon) in idea to bring something more structured and complete than shell scripting.

 

GitHub - UIM-Community/NodeUIM: CA UIM NodeJS interface to work with pu.exe in a full async way. 

 

I'm working on a lower integration without pu (directly with the C SDK).

 

Best Regards,

Thomas

10-05-2016 01:07 PM

*added product category to this idea