0

My application is spamming my log with disk threshold messages. I already found out (here low disk watermark [??%] exceeded on) what I need to do. I have attached the a curl command below, which should solve my problem. Unfortunately I am in Windows, so no curl.

I have already tried building my own "Invoke-RestMethod" command, which all did not work (and I also forgot to preserve them for reference here). I looked at parse-curl on github, but did not understand how it'll help me. SO I'm a bit lost in documentation... The errors form Invoke-RestMethod in the shell also were not very helpful in the end.

curl -X PUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d' 
{
"persistent" : {
"cluster.routing.allocation.disk.threshold_enabled" : "false"
}
}
'

So... I just need a working command for PowerShell to be happy.

Jan Pralle
  • 35
  • 8
  • Please [edit] your question and show the `Invoke-RestMethod` statement that isn't working for you as well as the error(s) you're getting from that statement. – Ansgar Wiechers Apr 09 '19 at 11:11

1 Answers1

2
$body = @{
    persistent = @{
        "cluster.routing.allocation.disk.threshold_enabled" = $false
    }
} | ConvertTo-Json

Invoke-WebRequest -Uri "http://localhost:9200/_cluster/settings" -Method Put -Body $body -ContentType "application/json"

Try the above code. Maybe remove the "http://"-part but I don't think so.

Hope this helps!

Bernard Moeskops
  • 1,203
  • 1
  • 12
  • 16