简介:
Remedy 是个流行的cmdb 管理平台,下面就其接口调用做个总结。
方法一: 调用pyARS
1.下载安装客户端 https://rrr.se/cgi/index?pg=arapi (8的客户端,可以调用7的 server版本)
2.设置环境变量 export LD_LIBRARY_PATH=/root/test/api811linux/lib/:$LD_LIBRARY_PATH
3.安装pyARS http://freefr.dl.sourceforge.net/project/pyars/pyars/1.8.2/pyars-1.8.2.zip
4.使用:
from pyars import erars, cars
ars = erars.erARS()
a=ars.Login('10.1.64.16:2722','username','passwd')
手册:http://pyars.sourceforge.net/docs.html
方法二: PyRemedy
from __future__ import print_function
from pyremedy import ARS, ARSError
ars = ARS( server='10.16.4.16', port=2722, user='l1', password='aa123')
import os, atexit,rlcompleter,readline
readline.parse_and_bind('tab: complete')
ars.query(schema='Midea_CMDB_Automation',qualifier="",fields=[])
ars.fields(schema='Midea_CMDB_Automation')
a={'Chr_CIName':'aaaa', 'Chr_HostName':'bbb'}
ars.create(schema='Midea_CMDB_Automation',entry_values=a)
ars.get(schema='Midea_CMDB_Automation',entry_id='000000000000017',fields=[])