External Monitor Script

A10 Networks Support Forum Forums Thunder and AX Series External Monitor Script

This topic contains 2 replies, has 1 voice, and was last updated by avatar dcase99 6 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10782
    avatar
    dcase99
    Member

    Hi,

    I have a developed bash script that I need to be able to “convert” to an A10 external monitor script.

    The script is
    `#!/bin/bash
    TOKEN=curl -s -k https://<name of server>/icoauth/oauth2/token -d 'grant_type=client_credentials&client_id=as-client&client_secret=<secret key>&principal_attribute_extRef=exr999999' | sed 's/.*access_token":"//g' | sed 's/".*//g'
    curl -k -w “%{http_code}” -s -H “Authorization: Bearer ${TOKEN}” -H “Content-Type: application/json” -X POST -d ‘{ “service”: “<service name>”, “siteId”: “<site #>”, “data”: {“customerAccount”: “<acc #>”, “contactIds”: [ “<id #>” ] } }’ https://<name of server>

    What is does:
    The TOKEN line obtains a token from a given server (lets call it server1) and uses SED to extract the token out of the returned response

    The CURL line used the TOKEN from server1 and does a health check against server2-5 and returns a status code (200=good…. not 200=bad)

    How would I go about doing this?

    #10792
    avatar
    dcase99
    Member

    `#!/bin/bash
    TOKEN=curl -s -k https://portal.lab.intelligent-home.jp/icoauth/oauth2/token -d 'grant_type=client_credentials&client_id=as-client&client_secret=02875f01-6add-48fc-8c4f-d1693ba0695e&principal_attribute_extRef=exr999999' | sed 's/.*access_token":"//g' | sed 's/".*//g'
    curl -k -w “%{http_code}” -s -H “Authorization: Bearer ${TOKEN}” -H “Content-Type: application/json” -X POST -d ‘{ “service”: “sgs”, “siteId”: “123.4”, “data”: {“customerAccount”: “140601002”, “contactIds”: [ “140601002” ] } }’ https://ias.lab.intelligent-home.jp/alarm/icontrol

    #10802
    avatar
    dcase99
    Member

    well darn it, lets try this one more time

    #!/bin/bash
    TOKEN=curl -s -k https://portal.lab.intelligent-home.jp/icoauth/oauth2/token -d ‘grant_type=client_credentials&client_id=as-client&client_secret=02875f01-6add-48fc-8c4f-d1693ba0695e&principal_attribute_extRef=exr999999’ | sed ‘s/.*access_token”:”//g’ | sed ‘s/”.*//g’
    curl -k -w “%{http_code}” -s -H “Authorization: Bearer ${TOKEN}” -H “Content-Type: application/json” -X POST -d ‘{ “service”: “sgs”, “siteId”: “123.4”, “data”: {“customerAccount”: “140601002”, “contactIds”: [ “140601002” ] } }’ https://ias.lab.intelligent-home.jp/alarm/icontrol

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Comments are closed.