cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set "displayname" value dinamycally

apvazquez
Visitor

Hi All,

 

I am developing a plugin which makes a checking of a folder size. I want to know if it is possible to set the value of "displayname" dynamically, passing to it the value of the folder from the python code ?

 

Thanks in advance,

Axel

5 REPLIES 5

JamesKitson
Dynatrace Leader
Dynatrace Leader

No the display name must be set in the configuration plugin.json file. Typically in a situation like this you would have the metric name be something like "Folder size" and then you can report each folder name and value separately as a dimension which can be done dynamically. You can always filter down to that dimension on charts etc... and have the same result.

 

Only other option that comes to mind is if you decided not to use the built in methods for reporting metrics specifically for extensions and instead reported metrics over the API. This lets you define the metrics on the fly however you see fit but requires you write the extension to use this, you  may need to supply an api token in the config if it is not reporting to the OneAgent metric API, and as of now you specify a key (which could be dynamic) but there is no 'display name.'

 

I'd stick with the dimension approach.

Thanks a lot James!

Hello James,

 

I am trying with the dimensions but I not able to see each folder name at the keychart.

 

This is the plugin.json file:

 

{
    "name""custom.python.checkFolderSize",
    "version""1.1",
    "type""python",
    "entity""HOST",
    "metricGroup""folder_size",
    "source": {
      "package""checkFolderSize",
      "className""CheckFolderSizePlugin",
      "activation""Singleton"
    },
    "metrics": [
      {
        "timeseries": {
          "key""size",
          "unit""MegaByte",
          "displayname""MegaByte",
          "dimensions": ["directoryName"]
        }
      }
    ],
    "configUI": {
      "displayName""OneAgent Check Folder Extension"
    },
    "ui": {
        "keycharts" : [
          {
            "group" : "Size",
            "title" : "Directory size",
            "series" : [
              {
                "key" : "size",
                "displayname" : "Folder Value"
              }
            ]
          }
        ]
      }
  }
  
 
And this the python line which sends the data (inside a loop):
self.results_builder.absolute(key='size'value=sizeFolderdimensions={'directoryName'dirpath})
 
Thanks again

 

The key charts will always aggregate dimensions.  You'll see your dimensions under Further details or when creating a custom chart you'll have the option to split by dimension.

Hi James,

 

Thanks for helping.

 

I could see the dimensions on a custom chart. 

How could see them under a Further details ? Is it posible to do that with a HOST based plugin such as this one ?

 

Thanks again