2.3. Obtaining Information About an OpenIDM Instance

OpenIDM includes a customizable information service that provides detailed information about a running OpenIDM instance. The information can be accessed over the REST interface, under the context http://localhost:8080/openidm/info.

By default, OpenIDM provides the following information:

  • Basic information about the health of the system.

    This information can be accessed over REST at http://localhost:8080/openidm/info/ping. For example:

    $ curl
     --header "X-OpenIDM-Username: openidm-admin"
     --header "X-OpenIDM-Password: openidm-admin"
     --request GET
     "http://localhost:8080/openidm/info/ping"
    
     {"state":"ACTIVE_READY","shortDesc":"OpenIDM ready"}
          

    The information is provided by the script openidm/bin/defaults/script/info/ping.js.

  • Information about the current OpenIDM session.

    This information can be accessed over REST at http://localhost:8080/openidm/info/login. For example:

    $ curl
     --header "X-OpenIDM-Username: openidm-admin"
     --header "X-OpenIDM-Password: openidm-admin"
     --request GET
     "http://localhost:8080/openidm/info/login"
    
     {
      "username":"openidm-admin",
      "userid":{
         "id":"openidm-admin",
         "component":"internal/user"
      }
     }      

    The information is provided by the script openidm/bin/defaults/script/info/login.js.

You can extend or override the default information that is provided by creating your own script file and its corresponding configuration file in openidm/conf/info-name.json. Custom script files can be located anywhere, although a best practice is to place them in openidm/script/info. A sample customized script file for extending the default ping service is provided in openidm/samples/infoservice/script/info/customping.js. The corresponding configuration file is provided in openidm/samples/infoservice/conf/info-customping.json.

The configuration file has the following syntax:

{
    "infocontext" : "ping",
    "type" : "text/javascript",
    "file" : "script/info/customping.js"
} 
  

The parameters in the configuration file are as follows:

  • "infocontext" specifies the relative name of the info endpoint under the info context. The information can be accessed over REST at this endpoint, for example, setting "infocontext" to "mycontext/myendpoint" would make the information accessible over REST at http://localhost:8080/openidm/info/mycontext/myendpoint.

  • "type" specifies the type of the information source. Currently, only Javascript is supported, so the type must be "text/javascript".

  • "file" specifies the path to the Javascript file, if you do not provide a "source" parameter.

  • "source" specifies the actual Javascript, if you have not provided a "file" parameter.

Additional properties can be passed to the script in this configuration file ( openidm/samples/infoservice/conf/info-name.json).

Script files in openidm/samples/infoservice/script/info/ have access to the following objects:

  • request - the request details, including the method called and any parameters passed.

  • healthinfo - the current health status of the system.

  • openidm - access to the JSON resource API.

  • Any additional properties that are defined in the configuration file ( openidm/samples/infoservice/conf/info-name.json.)