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:
You can use either of the HTTP methods GET and POST.
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:
_value: The operation that you want to perform for the action specified in the _action field. Acceptable values include for:
_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
For example, to add a server:
Additional parameters for registering servers are listed here.
For example, suppose you have a server named Production001 registered with Monyog. To stop data collection for this server using the HTTP GET method, the URL would look like:
In summary, the various URLs that you can use with curl:
Starts data collection for <server name>
Starts data collection for <multiples servers>
Stops data collection for <server name>(Slave Of Production)
Starts data collection for <tag>
Stops data collection for <tag>
Stops data collection globally for all the servers (Maintenance)
Enables alerts for <server name>
Disables alerts for <server name>
Enables alerts for <tag>
Disables alerts for <tag>
Disables alerts globally for all the servers(Maintenance)
Enables alerts globally for all the servers(Maintenance)
Enables Sniffer for <server name>
Disables Sniffer for <server name>
Add Server with SSH Tunnel
Delete all the servers under <tag>
Delete multiple servers
Assuming that the connection to SQL DM for MySQL was successful, it returns a text message. The message is in the JSON format:
Your application can parse this message and determine whether the operation was successfully carried out or not.
Since version 5.21 we have deprecated the API calls to
_object=ConnectionMgr. Instead use
The Monyog API is very flexible and can be accessed from other programming languages including scripting languages such as Perl, VBScript, etc. Here is a very generic Perl script that accepts the required parameters from the command line and executes the specified action: