Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Starting with 8.9.7 we are also exposing a new ‘Get’API. This API would aim to get information from the tool.

General ‘Get’ API


The endpoint for all ‘Get’ requests will look like:

curl "

You can access the API by passing parameters to Monyog through its base URL.

For example, if Monyog is running on a system with IP 192.168.1.1, then the parameters need to be passed to: http://192.168.1.1:5555/

You can use either of the HTTP methods GET and POST.

The Parameters

The parameters that you will need to pass are:

  • _object: This basically addresses the logical object in Monyog that you want to direct your request to.The only acceptable value is MONyogAPI.
  • _action: This specifies the part of the object specified above that you want to direct your request to. The acceptable values are:
    • Alerts
    • DataCollection
    • Sniffer
    • LongRunningQueries
    • LockedQueries
    • LongRunningQueryAction
    • AddServer
    • EditServer
    • RemoveServer
  • _value: The operation that you want to perform for the action specified in the _action field. Acceptable values include for:
    • Alerts, DataCollection, Sniffer, LongRunningQueries, LockedQueries: enable and disable
    • LongRunningQueryAction: notify, kill and notifyandkill
  • _user: It may be Monyog user, LDAP user or LDAP Group user. In case, no user is supplied, admin account is used by default.
  • _password: The password for the specified _user.
  • _server: Name or data directory number of the servers separated by a comma(‘,’) for which the operation to be performed.
  • _tags: Name of the tag separated by a comma(‘,’) for which the operation to be performed for all the servers under the specified tag.

API's for server management

To manage servers in Monyog via API, the following parameters need to be passed:

  • _server: The name or data directory number of the server to be registered
  • _mysqlhost: MySQL host/ip address
  • _mysqluser: MySQL user name
  • _mysqlport: MySQL port
  • _mysqlpassword: MySQL user password

...

?_object=MONyogAPI&_action=get&_details=<resource>&[optional Additional params]&_user=<sqldm user name>&_password=<sqldm user password>”

  • _action: Should be ‘get’
  • _details: the value of this will determine what data to be fetched



getlicenseinfo 


API to fetch license-related details:

curl "[IP]/?_object=MONyogAPI&_action=get&_details=getlicenseinfo&_user=<sqldm user name>&_password=<sqldm user password>”

  • _details=getlicenseinfo
  • The API will return:
    • RegName
    • Expiry date (time in seconds)
    • Current version
    • MaxServerLimit
  • If a non-admin users fetch the API, then the ExpiryDate and MaxServerLimit will not be returned
  • Return format JSON
  • For the trial build Regname will be empty and no ExpiryDate and MaxServerLimitwill be sent




—- Example 

  • curl"34.225.194.88:5555/?_object=MONyogAPI&_action=get&_details=getlicenseinfo&_user=admin"
  • {"STATUS": "SUCCESS", "RESPONSE": "{ "Version": "8.9.7", "RegName": "Ankush" , "ExpiryDate":1868745599, "MaxServerLimit": 400 }"}


























Code Block
themeConfluence
$ curl "192.168.1.1:5555/?_object=MONyogAPI&_action=addserver&_user=admin
       &_server=Production&_mysqlhost=127.0.0.1&_mysqluser=admin
       &_mysqlport=3306&_mysqlpassword=adminpassword"

...