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

OneAgent Plugin checking for created file within particular location

Hi All,

I am trying to develop OneAgent plugin which will monitor paricular file location for any generated files. Plugin was built under Linux as it will be used on it and succesfully uploaded on DT SaaS.However when a file is generated instead of reporting the mentioned problem, DT just increased the number of monitored hosts.

{

"version": "0.2",

"name": "custom.python.basic_file_check_linux",

"type": "python",

"entity": "HOST",

"processTypes": [1],

"source": {

"package": "basic_file_check_linux",

"className": "BasicFileCheckLinux",

"install_requires": [],

"activation": "Singleton"

},

"metrics": [

{

"timeseries": {

"key": "file_exists",

"unit": "Count",

"displayname": "File with extension.fail was generated",

"dimensions": []

}

}

],

"configUI": {

"displayName": "Basic File Existence Check (Linux)"

},

"properties": [

{

"key": "file_path",

"type": "String"

}

],

"alert_settings": [

{

"alert_id": "custom_file_exists_check_linux",

"event_type": "ERROR_EVENT",

"event_name": "Fail file generated",

"description": "File with extension .fail was generated within {file_path}",

"threshold": 1,

"alert_condition": "ABOVE",

"samples": 5,

"violating_samples": 3,

"dealerting_samples": 5

}

]

}


Alerting settings are minimized as possibly.

Do you have any idea what should be adjusted in order to have the problem reported when the file is generated within the file location?

Cheers,

Konstantin


6 REPLIES 6

skrystosik
DynaMight Guru
DynaMight Guru

Did you tried creating custom threshold via API on this custom metric?

https://www.dynatrace.com/support/help/shortlink/api-threshold#put-a-threshold-

Sebastian


Regards, Sebastian

No, I haven't tried to define a custom threshold via the API but what is the idea behind that action?

Also today I received strange error during plugin upload:

The metricGroup field is missing. Since version 1.172, the metric group is an obligatory field. It is used for grouping custom metrics into a hierarchical namespace where various sources, for example multiple plugins, can provide data. Moreover, the metric group becomes a primary part of the metric key, which means that once defined, it must remain the same for the continuity of data. The metric group will also help you find metrics on custom charts.


Where should that MetricGroup be placed - in the Metrics section of plugin.json probably?

Cheers,

Konstantin


My idea was threshold on this metrics because without it it will never fire problem I think.

Sebastian


Regards, Sebastian

dave_mauney
Dynatrace Champion
Dynatrace Champion

Have you considered just writing a daemon process to watch for the file and push an error event to Dynatrace when it exists? This way there will be no charge for custom metrics, you can set the interval to whatever makes sense, etc.


Hi Dave, no I haven't considered such an option. But how could I configure the push event to Dynatrace when the file exists?

Thanks in advance,

Konstantin


You should be able to send an ERROR_EVENT as documented here:

https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/events/post-ev...

You would just need to send a description, title and source.

HTH,

dave


Featured Posts