Config - Plugin

Plugin - List Copied

Object type: plugin

Permission: CONFIGUREVIEW

Request URL: /rest/config/plugin

Methods:

Parameters:

Example GET /rest/config/plugin Copied

{
   "list" : [
      {
         "envvars" : "",
         "name" : "check_nrpe",
         "servicechecks" : [
            {
               "name" : "/",
               "ref" : "/rest/config/servicecheck/47"
            },
            ....
            {
               "name" : "Z Drive",
               "ref" : "/rest/config/servicecheck/71"
            }
         ],
         "hostcheckcommands" : [],
         "uncommitted": "1"
      },
      {
         "envvars" : "",
         "name" : "check_tcp",
         "servicechecks" : [
            {
               "name" : "AFS",
               "ref" : "/rest/config/servicecheck/1"
            },
            ....
            {
               "name" : "X.400",
               "ref" : "/rest/config/servicecheck/32"
            }
         ],
         "hostcheckcommands" : [
            {
               "name" : "tcp port 21 (FTP)",
               "ref" : "/rest/config/hostcheckcommand/13"
            },
            ....
            {
               "name" : "tcp port 161 (SNMP)",
               "ref" : "/rest/config/hostcheckcommand/14"
            }
         ],
         "uncommitted": "1"
      },
      {
         "envvars" : "",
         "name" : "check_snmp_linkstatus",
         "servicechecks" : [
            {
               "name" : "Discards",
               "ref" : "/rest/config/servicecheck/101"
            },
            {
               "name" : "Errors",
               "ref" : "/rest/config/servicecheck/100"
            },
            {
               "name" : "Interface",
               "ref" : "/rest/config/servicecheck/95"
            }
         ],
         "hostcheckcommands" : [],
         "uncommitted": "1"
      }
   ],
   "summary" : {
      "allrows" : "125",
      "page" : "1",
      "rows" : "3",
      "totalpages" : "42",
      "totalrows" : "125"
   }
}

Plugin - Delete Copied

URL: /rest/config/plugin/PLUGINNAME

Permission: CONFIGUREVIEW

Methods:

Note

If you have the plugin on a remote collector, this will not be removed.

Plugin - Upload Copied

Warning

Only import plugins from trusted sources. Uploading untrusted and unverified scripts could compromise your system’s integrity.

Used for uploading plugin. The plugin is staged and executed to test if the plugin is appropriate. The plugin will not be made live until it is imported.

URL: /rest/config/plugin/upload

Permission: ADMINACCESS

Method:

Headers:

Parameters:

The actual plugin contents must be attached to the request as multipart form data. For example, you can use the curl command:

curl -H "Accept: text/html" -H "X-Opsview-Token: <TOKEN>" -F "x-opsview-token=<TOKEN>" -F "filename=@/path/to/plugin;type=text/plain" https://<OPSVIEW URL>/rest/config/plugin/upload

Returns for a failure:

{
 success: false,                 // or true
 error: "Plugin already exists", // If success is false, will return an internationalised string for display
 detail: "File not found",       // May exist if success is false. Will have further information about failure
}

Returns for a success:

{
 return_code: 0,                                          // Return code of script
 stdout: 'text from plugin running -h\nwith extra lines', // Output from plugin
 stderr: '',                                              // Stderr from plugin
 exists: true,                                            // Returns true if a plugin of the same name is already live
 valid_plugin: true,                                      // This is a valid plugin based on heuristics. Could return false
}

When uploading Opsview will:

Plugin - Import Copied

Warning

Only import plugins from trusted sources. Importing untrusted and unverified scripts could compromise your system’s integrity.

Import plugin to make live (after it has been successfully uploaded).

URL: /rest/config/plugin/import

Permission: ADMINACCESS

Method:

Parameters:

Returns:

{ success: true }

When importing:

["Opsview"] ["API", "Technical Reference"]

Was this topic helpful?