Controlling Oracle WebLogic Server via RESTFul Management Service

Posted by Dirk Nachbar on Monday, November 14, 2016 with 1 comment
RESTFul Management Services are really powerful in terms of monitoring your Oracle WebLogic Server Domain, but you can also use RESTFul Management Services to control your Oracle WebLogic Server Domain.

RESTFul Management Services are enabling you to startup, suspend, resume and shutdown for example your Managed Servers.

All what you need is cURL, the Admin User and Password of your Oracle WebLogic Server, Hostname of your Oracle WebLogic Domain and the Port of your AdminServer.

# cURL syntax to start up the Managed Server called DemoManagedServer1
#
curl -s --user weblogic:welcome1 \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -X POST http://localhost:7001/management/wls/latest/servers/id/DemoManagedServer1/start
{
    "item": {
        "beginTime": 1479137278206,
        "endTime": 1479137293451,
        "status": "completed",
        "description": "Starting DemoManagedServer1 server ...",
        "serverName": "DemoManagedServer1",
        "operation": "start",
        "name": "_0_start",
        "id": "DemoManagedServer1:_0_start",
        "type": "server"
    },
    "messages": [{
        "message": "Started the server 'DemoManagedServer1'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/server\/id\/DemoManagedServer1:_0_start"
    }]

# cURL syntax to suspend the Managed Server called DemoManagedServer1
#
curl -s --user weblogic:welcome1 \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -X POST http://localhost:7001/management/wls/latest/servers/id/DemoManagedServer1/suspend
{
    "item": {
        "beginTime": 1479137373341,
        "endTime": 1479137378061,
        "status": "completed",
        "description": "suspending DemoManagedServer1 server ...",
        "serverName": "DemoManagedServer1",
        "operation": "suspending",
        "name": "_1_suspendWithTimeout",
        "id": "DemoManagedServer1:_1_suspendWithTimeout",
        "type": "server"
    },
    "messages": [{
        "message": "Suspended the server 'DemoManagedServer1'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/server\/id\/DemoManagedServer1:_1_suspendWithTimeout"
    }]

# cURL syntax to resume the Managed Server called DemoManagedServer1
#
curl -s --user weblogic:welcome1 \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -X POST http://localhost:7001/management/wls/latest/servers/id/DemoManagedServer1/resume
{
    "item": {
        "beginTime": 1479137414870,
        "endTime": 1479137420100,
        "status": "completed",
        "description": "Resuming DemoManagedServer1 server ...",
        "serverName": "DemoManagedServer1",
        "operation": "resume",
        "name": "_2_resume",
        "id": "DemoManagedServer1:_2_resume",
        "type": "server"
    },
    "messages": [{
        "message": "Resumed the server 'DemoManagedServer1'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/server\/id\/DemoManagedServer1:_2_resume"
    }]

# cURL syntax to shutdown the Managed Server called DemoManagedServer1
#
curl -s --user weblogic:welcome1 \
> -H X-Requested-By:MyClient \
> -H Accept:application/json \
> -X POST http://localhost:7001/management/wls/latest/servers/id/DemoManagedServer1/shutdown
{
    "item": {
        "beginTime": 1479137450438,
        "endTime": 1479137457385,
        "status": "completed",
        "description": "Shutting down DemoManagedServer1 server ...",
        "serverName": "DemoManagedServer1",
        "operation": "shutdown",
        "name": "_3_shutdown",
        "id": "DemoManagedServer1:_3_shutdown",
        "type": "server"
    },
    "messages": [{
        "message": "Shutdown the server 'DemoManagedServer1'.",
        "severity": "SUCCESS"
    }],
    "links": [{
        "rel": "job",
        "uri": "http:\/\/localhost:7001\/management\/wls\/latest\/jobs\/server\/id\/DemoManagedServer1:_3_shutdown"
    }]



And with a bit of scripting you can create a UNIX Wrapper Shell script to cover all above described startup, suspend, resume and shutdown operations.

Reaktionen: