The map resource provides mapping between numerical ids and names for various objects in the system. The resource is accessible via the /api/2/map URL, which dumps the whole tree. You can also query a particular branch of the tree.

Two large subtrees are available, /api/2/map/name (name-to-id mapping) and the reverse, /api/2/map/id (id-to-name mapping). You can drill-down on these branches by using a more specific path (see below).

In addition to these maps, there are subtrees which provide more complex object maps, such /api/2/map/service, /api/2/map/servicegroup, /api/2/map/event and /api/2/map/user.

Note: This API is mainly for internal use, but you might also find it useful.

Maps overview:

GETPOST /api/2/map The whole map tree
GETPOST /api/2/map/id The map-id subtree
GETPOST /api/2/map/name The map-name subtree
id-to-name maps
GETPOST /api/2/map/id/action Action types list
GETPOST /api/2/map/id/host Host list
GETPOST /api/2/map/id/hostgroup Hostgroup list
GETPOST /api/2/map/id/hostmachine Host machine list
GETPOST /api/2/map/id/hostplatform Host platform list
GETPOST /api/2/map/id/hoststatus Host status types list
GETPOST /api/2/map/id/operator Operator types list
GETPOST /api/2/map/id/permission Permission types list
GETPOST /api/2/map/id/range Range types list
GETPOST /api/2/map/id/servicetype Service types list
GETPOST /api/2/map/id/statetype Service state types list
GETPOST /api/2/map/id/statisticstype Statistics type list
name-to-id maps
GETPOST /api/2/map/name/action Action types list
GETPOST /api/2/map/name/host Host list
GETPOST /api/2/map/name/hostgroup Hostgroup list
GETPOST /api/2/map/name/hostmachine Host machine list
GETPOST /api/2/map/name/hostplatform Host platform list
GETPOST /api/2/map/name/hoststatus Host status types list
GETPOST /api/2/map/name/operator Operator types list
GETPOST /api/2/map/name/permission Permission types list
GETPOST /api/2/map/name/range Range types list
GETPOST /api/2/map/name/servicetype Service types list
GETPOST /api/2/map/name/statetype Service state types list
GETPOST /api/2/map/name/statisticstype Statistics types list
Misc maps
GETPOST /api/2/map/event Event types
GETPOST /api/2/map/user User list
GETPOST /api/2/map/user/remote Logged in user as remote-user
GETPOST /api/2/map/service Service list
GETPOST /api/2/map/servicegroup Service group list

Arguments

none

Example1

Query the id-to-name hosts sub-tree and list all registered hosts

curl -b ~/.mmonit/cookie \
 https://127.0.0.1:8080/api/2/map/id/host
{
  "map":{
    "id":{
      "host":{
        "1":"solaris11-x64",
        "5":"debian4-x86",
        "6":"debian4-x64",
        "8":"freebsd80-x86",
        "9":"freebsd80-x64",
        "54213":"netbsd6-x64",
        "13":"tildeslash1",
        "49104":"wordpress"
      }
    }
  }
}

Example2

Query the reverse name-to-id hosts sub-tree

curl -b ~/.mmonit/cookie \
 https://127.0.0.1:8080/api/2/map/name/host
{
  "map":{
    "name":{
      "host":{
        "solaris11-x64":"1",
        "debian4-x86":"5",
        "debian4-x64":"6",
        "freebsd80-x86":"8",
        "freebsd80-x64":"9",
        "netbsd6-x64":"54213",
        "tildeslash1":"13",
        "wordpress":"49104"
      }
    }
  }
}