Contents
Monit
M/Monit
Wiki
MMonit.HTTP-API History
Hide minor edits - Show changes to output
Changed line 77 from:
GetMethod logout = new GetMethod("http://localhost:8080/logout.csp");
to:
GetMethod logout = new GetMethod("http://localhost:8080/login/logout.csp");
Added lines 28-33:
* Admin
->http://localhost:8080/json/admin/hosts/list
->http://localhost:8080/json/admin/users/list
->http://localhost:8080/json/admin/rules/list
Added lines 19-23:
* Reports
-> http://localhost:8080/json/reports/overview
-> http://localhost:8080/json/reports/host/overview?hostid=xxx
Changed lines 36-38 from:
Form Based Authentication utilize HTTP session and clients must support cookies. If the session timeout or is invalidated the user is logged out and subsequent requests requires the user to re-authenticate.
The takeaway is that your client must support cookies and must send the session cookie, ''zsessionid'', with every request.
The takeaway is that your client must support cookies and must send the session cookie, ''zsessionid'', with every request
to:
Form Based Authentication utilize HTTP session and clients must support cookies and send the session cookie, ''zsessionid'', with every request. If the session timeout or is invalidated the user is logged out and subsequent requests requires the user to re-authenticate.
Changed line 31 from:
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the user.
to:
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the client.
Changed line 46 from:
// Access e.g. the M/Monit dashboard to get the zsessionid cookie and login form
to:
// Access the M/Monit dashboard to get the zsessionid cookie and login form
Changed line 42 from:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a short Java snippet that login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the ''zsessionid'' cookie for you.
to:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java snippet that will login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the ''zsessionid'' cookie for you.
Changed line 38 from:
The takeaway is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every request after authentication.
to:
The takeaway is that your client must support cookies and must send the session cookie, ''zsessionid'', with every request.
Changed line 38 from:
The takeaway from this short description is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every request after authentication.
to:
The takeaway is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every request after authentication.
Changed line 46 from:
// Access the e.g. M/Monit dashboard to get the zsessionid cookie and login form
to:
// Access e.g. the M/Monit dashboard to get the zsessionid cookie and login form
Changed line 42 from:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the ''zsessionid'' cookie for you.
to:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a short Java snippet that login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the ''zsessionid'' cookie for you.
Changed line 38 from:
The takeaway from this short description is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every requests after authentication.
to:
The takeaway from this short description is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every request after authentication.
Changed line 46 from:
// Access the M/Monit dashboard to get the zsessionid cookie
to:
// Access the e.g. M/Monit dashboard to get the zsessionid cookie and login form
Changed line 51 from:
// Authenticate
to:
// Authenticate, programmatically post the login form back to M/Monit
Changed line 61 from:
//We are logged in and can request JSON data
to:
//We are logged in and can start request JSON data
Changed line 64 from:
to:
System.out.println(status.getResponseBodyAsString());
Deleted line 65:
Changed lines 42-43 from:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the zsessionid cookie for you.
to:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the ''zsessionid'' cookie for you.
Changed line 46 from:
// Access the M/Monit dashboard to get to get the zsessionid cookie
to:
// Access the M/Monit dashboard to get the zsessionid cookie
Changed line 61 from:
//We are logged in and can start request JSON data
to:
//We are logged in and can request JSON data
Changed line 42 from:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java code snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the housekeeping, by tracking and automatically resubmitting the cookies for you.
to:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the zsessionid cookie for you.
Changed line 42 from:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java code snippet that will login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the cookies for you.
to:
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java code snippet that can be used to login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the housekeeping, by tracking and automatically resubmitting the cookies for you.
Added lines 39-72:
!!!Example
Using [[http://hc.apache.org/httpclient-3.x/|Jakarta Commons HttpClient]] here is a Java code snippet that will login to M/Monit and print M/Monit JSON status data to stdout. Note that the HttpClient library is doing the cookie housekeeping, by tracking and automatically resubmitting the cookies for you.
[@HttpClient client = new HttpClient();
// Access the M/Monit dashboard to get to get the zsessionid cookie
GetMethod get = new GetMethod("http://localhost:8080/index.csp");
client.executeMethod(get);
get.releaseConnection();
// Authenticate
PostMethod auth = new PostMethod("http://localhost:8080/z_security_check");
NameValuePair[] credentials = {
new NameValuePair("z_username", "admin"),
new NameValuePair("z_password", "swordfish")
};
auth.setRequestBody(credentials);
client.executeMethod(auth);
auth.releaseConnection();
//We are logged in and can start request JSON data
PostMethod status = new PostMethod("http://localhost:8080/json/status/list");
client.executeMethod(status);
String response = status.getResponseBodyAsString();
status.releaseConnection();
System.out.println(response);
// Logout from M/Monit and release the login session
GetMethod logout = new GetMethod("http://localhost:8080/logout.csp");
client.executeMethod(logout);
logout.releaseConnection();@]
Changed line 27 from:
To access the JSON API you must first login to M/Monit. The form based authentication process supported by M/Monit is the same as the one specified in the [[http://java.sun.com/products/servlet/|Java Servlet Specification]] and used by Apache Tomcat.
to:
To access the JSON API your client must first login to M/Monit. The form based authentication process supported by M/Monit is the same as the one specified in the [[http://java.sun.com/products/servlet/|Java Servlet Specification]] and used by Apache Tomcat.
Changed line 25 from:
!!!The M/Monit authentication process
to:
!!!Authentication
Changed line 31 from:
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the user. Here is a short description of the authentication process.
to:
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the user.
Changed lines 22-40 from:
->http://localhost:8080/json/events/list
to:
->http://localhost:8080/json/events/list
!!!The M/Monit authentication process
To access the JSON API you must first login to M/Monit. The form based authentication process supported by M/Monit is the same as the one specified in the [[http://java.sun.com/products/servlet/|Java Servlet Specification]] and used by Apache Tomcat.
http://mmonit.com/_Media/formauth.jpg
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the user. Here is a short description of the authentication process.
# If the client has not been authenticated the mmonit server stores the original request URL and forwards to the login page. The client posts the login form back to the mmonit server and the server attempts to authenticate the user credentials embedded in the form. If authentication fails the server returns an error page. If authentication succeed, the server first check to see if the authenticated user belongs to a security role that is authorized to access the requested page. If the user is authorized the server redirect the request to the original stored request URL. If the user is not authorized to access the requested page the mmonit server will send a 403 Forbidden response back to the client.
Form Based Authentication utilize HTTP session and clients must support cookies. If the session timeout or is invalidated the user is logged out and subsequent requests requires the user to re-authenticate.
The takeaway from this short description is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every requests after authentication.
!!!The M/Monit authentication process
To access the JSON API you must first login to M/Monit. The form based authentication process supported by M/Monit is the same as the one specified in the [[http://java.sun.com/products/servlet/|Java Servlet Specification]] and used by Apache Tomcat.
http://mmonit.com/_Media/formauth.jpg
# Upon access to a protected area the mmonit server determines if the client has been previously authenticated, if this is the case, the requested page is sent back to the user. Here is a short description of the authentication process.
# If the client has not been authenticated the mmonit server stores the original request URL and forwards to the login page. The client posts the login form back to the mmonit server and the server attempts to authenticate the user credentials embedded in the form. If authentication fails the server returns an error page. If authentication succeed, the server first check to see if the authenticated user belongs to a security role that is authorized to access the requested page. If the user is authorized the server redirect the request to the original stored request URL. If the user is not authorized to access the requested page the mmonit server will send a 403 Forbidden response back to the client.
Form Based Authentication utilize HTTP session and clients must support cookies. If the session timeout or is invalidated the user is logged out and subsequent requests requires the user to re-authenticate.
The takeaway from this short description is that your client must support cookies and remember to send the session cookie, ''zsessionid'', with every requests after authentication.
Changed line 5 from:
Use for instance Firebug to find the URLs and JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data.
to:
Use for instance Firebug to find the URLs and the JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data:
Added lines 15-17:
* Topography
->http://localhost:8080/json/status/topography
Changed lines 9-11 from:
-->http://localhost:8080/json/dashboard/status
-->http://localhost:8080/json/dashboard/events
to:
->http://localhost:8080/json/dashboard/status
->http://localhost:8080/json/dashboard/events
->http://localhost:8080/json/dashboard/events
Changed lines 14-15 from:
to:
->http://localhost:8080/json/status/list
Changed line 18 from:
to:
->http://localhost:8080/json/events/list
Changed lines 9-11 from:
http://localhost:8080/json/dashboard/status
http://localhost:8080/json/dashboard/events
http://localhost:8080/json/dashboard/events
to:
-->http://localhost:8080/json/dashboard/status
-->http://localhost:8080/json/dashboard/events
-->http://localhost:8080/json/dashboard/events
Changed lines 14-15 from:
http://localhost:8080/json/status/list
to:
-->http://localhost:8080/json/status/list
Changed line 18 from:
http://localhost:8080/json/events/list
to:
-->http://localhost:8080/json/events/list
Changed line 5 from:
Use for instance Firebug to find the url and JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data.
to:
Use for instance Firebug to find the URLs and JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data.
Added lines 1-18:
M/Monit provides a simple JSON interface you can use to get data off M/Monit.
Most of the charts and tables in M/Monit are built using a JSON API and you can easily access the same API from your own program. The JSON API is only accessible via the HTTP POST method.
Use for instance Firebug to find the url and JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data.
* Dashboard
http://localhost:8080/json/dashboard/status
http://localhost:8080/json/dashboard/events
* Host status
http://localhost:8080/json/status/list
* Events
http://localhost:8080/json/events/list
Most of the charts and tables in M/Monit are built using a JSON API and you can easily access the same API from your own program. The JSON API is only accessible via the HTTP POST method.
Use for instance Firebug to find the url and JSON data you need. To get started, here are some useful URLs you can use to access M/Monit's data.
* Dashboard
http://localhost:8080/json/dashboard/status
http://localhost:8080/json/dashboard/events
* Host status
http://localhost:8080/json/status/list
* Events
http://localhost:8080/json/events/list