We are using a Search Head cluster
When the CPU and Memory of servers goes high we restart the cluster and the cluster comes back to normal.
I wrote a shell script with 2 lines.
sudo -u splunk /opt/splunk/bin/splunk rolling-restart shcluster-members
when the alert in SH is triggered it is failing as splunk username and passwd needs to be passed to the script manually.
Is there any way I can pass username and password for Splunk in the script to get triggered as per alert.