@tmcdonald- That's really a very nice catch. I tested the script as a root user and over that the ssh-key had 600 permissions.
I created a new ssh-key for nagios user and made necessary changes in the script.
Now, it's working absolutely fine.
I am using Nagios XI in order to monitor many servers across our infrastructure. I have been getting email notifications successfully, but wish to configure SMS notifications in Nagios XI. The main problem is, SMS gateway is on another server and in order to send any SMS from Nagios server, I need t...