123456789101112131415161718192021222324252627 |
- // do: Http request
- // params: method<string>, url<string>, header<object>, body<string>, successfunc<function>, errfunc<function>
- // return: none
- http.do("POST", "http://17.194.0.81/cmdb/dataSet/execute", {"Content-Type":"application/json"}, '{"password": "bW9uaXRvcipZd3h0YkA2Ng==","pageSize": 1000,"ciClass": "机房","type": 2,"pageNum": 1,"username": "monitor"}', function(message){
- // success func
- OUTPUT = message.data.data.data;
- _.forEach(message.data.data.data,function(v){
-
- var comp = _.template("INSERT INTO /cncc/entity/room (id,name,building, datacenter, floor,smvid,title) values ('<%=id %>','<%=name %>','<%=building %>','<%=datacenter %>','<%=floor %>','<%=smvid %>','<%=title %>')");
- var attrs = v.attrs;
-
- var mql = comp({
- id: "room:"+attrs['机房编号'],
- name:attrs['机房编号'],
- building:attrs['楼栋'],
- datacenter:attrs['数据中心'],
- floor:attrs['楼层'],
- smvid:attrs['SMVID'],
- title:attrs['机房名称']
- })
- log.info(mql)
- odb.mql(mql);
- })
- }, function(message){
- // error func
- log.info(message.data);
- })
|