With my Team, we’d like to apply a self-healing function when some alerts are triggered.
This is a silly example of code:
stream // Select just the cpu measurement from our example database. |from() .measurement('win_cpu') |alert() .crit(lambda: int("Percent_Idle_Time") > 50) .log('C:\Influx\Alerts\win_cpu_alerts.log') .exec('C:\temp\InfluxPoC\AnySelfHealingScript.ps1') //.exec('C://temp//InfluxPoC//AnySelfHealingScript.ps1') //It doesn't work even like this. .slack()
Even though the Powershell script called AnySelfHealingScript.ps1 is intended to actually execute some script to perform a self-healing process, right now it only appends information to a log file in c:\temp\execution.log
When I enable the alert, I know it’s working because the Slack notifications are being received, but the log file is never created. Even if I run the script manually and create the .log file, then the alert is not executing it.
What am I doing wrong?
Probably the log file is being created somewhere else?
Thank you in advance.