Config - Attribute

Object type: attribute

Request URL: /rest/config/attribute

Example GET Copied

$ opsview_rest --token-file /path/to/opsview_restapi_token --pretty GET 'config/attribute?s.name=DISK'
{
  list => [
    {
      arg1          => "-w 5% -c 2%",
....
      id            => 172,
      label1        => "Warning/Critical values",
....
      name          => "DISK",
      ref           => "/rest/config/attribute/172",
....
      servicechecks => [
                         { name => "Disk", ref => "/rest/config/servicecheck/1308" },
                         {
                           name => "Read-only Partitions",
                           ref  => "/rest/config/servicecheck/1304",
                         },
                       ],
      uncommitted   => 0,
      value         => "",
    },
  ],
  summary => { allrows => 169, page => 1, rows => 1, totalpages => 1, totalrows => 1 },
}

Example minimal PUT (with changelog enabled) Copied

$ opsview_rest --token-file /path/to/opsview_restapi_token --pretty --data-format=json PUT 'config/attribute' --data '{"name":"NEWNAME","changelog":"A new attribute"}'
{
   "object" : {
      "arg1" : "",
      "arg2" : "",
      "arg3" : "",
      "arg4" : "",
      "id" : "174",
      "label1" : "",
      "label2" : "",
      "label3" : "",
      "label4" : "",
      "name" : "NEWNAME",
      "secured1" : "0",
      "secured2" : "0",
      "secured3" : "0",
      "secured4" : "0",
      "servicechecks" : [],
      "uncommitted" : "1",
      "value" : ""
   }
}

Note

When saving attributes, you cannot add a host attribute nor amend the list of service checks using an attribute. If you want to amend a service check so that it is no longer using multiple attributes, you have to edit the service check itself.

For more information on how to generate and use the token file, see opsview_rest documentation.

["Opsview On-Premises"] ["API", "Technical Reference"]

Was this topic helpful?