-
Notifications
You must be signed in to change notification settings - Fork 88
RESTful API For Job
Echo edited this page Apr 18, 2018
·
4 revisions
Request
GET /saltshaker/api/v1.0/job?product_id=p-c5008b0421d611e894b0000c298454d8
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
{
"id": "10.10.10.10",
"cmd": "_return",
"fun": "cmd.run",
"jid": "20180418202055060383",
"_stamp": "2018-04-18T12:20:55.099029",
"return": " 20:20:55 up 135 days, 9:10, 1 user, load average: 0.00, 0.03, 0.07",
"retcode": 0,
"success": "true",
"fun_args": [
"uptime"
],
"product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8"
},
{
"id": "10.10.10.11",
"cmd": "_return",
"fun": "cmd.run",
"jid": "20180418202055060383",
"_stamp": "2018-04-18T12:20:55.096757",
"return": " 20:20:55 up 135 days, 9:18, 0 users, load average: 0.00, 0.01, 0.05",
"retcode": 0,
"success": "true",
"fun_args": [
"uptime"
],
"product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8"
},
{
"arg": [
"uptime"
],
"fun": "cmd.run",
"jid": "20180418202055060383",
"tgt": "10.55.30.22,10.55.30.23",
"user": "saltapi",
"_stamp": "2018-04-18T12:20:55.061305",
"minions": [
"10.10.10.10",
"10.10.10.11"
],
"tgt_type": "list",
"product_id": "p-4bc4a5b83bd011e8aa0e000c298454d8"
}
],
"status": true,
"message": ""
}
Request
GET /saltshaker/api/v1.0/job/20180322162445601279?product_id=p-c5008b0421d611e894b0000c298454d8
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"echo": "docker0 Link encap:Ethernet HWaddr 02:42:13:41:92:7c \n inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0\n inet6 addr: fe80::42:13ff:fe41:927c/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:5111 errors:0 dropped:0 overruns:0 frame:0\n TX packets:6419 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:0 \n RX bytes:2965753 (2.9 MB) TX bytes:2988554 (2.9 MB)\n\ndocker_gwbridge Link encap:Ethernet HWaddr 02:42:50:ef:f5:48 \n inet addr:172.18.0.1 Bcast:0.0.0.0 Mask:255.255.0.0\n inet6 addr: fe80::42:50ff:feef:f548/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n TX packets:63 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:0 \n RX bytes:0 (0.0 B) TX bytes:6870 (6.8 KB)\n\nens33 Link encap:Ethernet HWaddr 00:0c:29:84:54:d8 \n inet addr:192.168.44.128 Bcast:192.168.44.255 Mask:255.255.255.0\n inet6 addr: fe80::dd47:53fb:935:8717/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:12257 errors:0 dropped:0 overruns:0 frame:0\n TX packets:7676 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:5230544 (5.2 MB) TX bytes:4593788 (4.5 MB)\n\nlo Link encap:Local Loopback \n inet addr:127.0.0.1 Mask:255.0.0.0\n inet6 addr: ::1/128 Scope:Host\n UP LOOPBACK RUNNING MTU:65536 Metric:1\n RX packets:4680 errors:0 dropped:0 overruns:0 frame:0\n TX packets:4680 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:448658 (448.6 KB) TX bytes:448658 (448.6 KB)\n\nveth44715f5 Link encap:Ethernet HWaddr 52:37:f9:79:73:88 \n inet6 addr: fe80::5037:f9ff:fe79:7388/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:0 errors:0 dropped:0 overruns:0 frame:0\n TX packets:106 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:0 \n RX bytes:0 (0.0 B) TX bytes:11432 (11.4 KB)\n\nveth6ce9bc7 Link encap:Ethernet HWaddr 8a:13:a4:cd:ce:7f \n inet6 addr: fe80::8813:a4ff:fecd:ce7f/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:5111 errors:0 dropped:0 overruns:0 frame:0\n TX packets:6456 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:0 \n RX bytes:3037307 (3.0 MB) TX bytes:2992585 (2.9 MB)"
}
Request
GET /saltshaker/api/v1.0/job/manager?product_id=p-c5008b0421d611e894b0000c298454d8
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [
{
"Function": "cmd.run",
"Returned": [],
"Target-type": "glob",
"Running": [
{
"10.10.10.10": 14332
},
{
"10.10.10.11": 22167
}
],
"User": "root",
"StartTime": "2018, Apr 18 20:22:29.433631",
"Arguments": [
"ping www.baidu.com"
],
"Target": "*",
"Jid": "20180418202229433631"
}
],
"status": true,
"message": ""
}
Request
POST /saltshaker/api/v1.0/job/manager?action=kill&jid=20180322183450546428&product_id=p-c5008b0421d611e894b0000c298454d8
POST Body
{
"minion_id": ["10.10.10.10"]
}
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": true,
"message": ""
}