Event Handler with out sudo
Posted: Tue Jul 11, 2017 2:28 am
Team,
recently we have purchased the license, but we are unable to find the option to create new post in the customer support forum. Is there any process to link the the ID with my license.
we are configuring event handler to restart an application using a script at the client end..
the script has to be run as a service user and we don't have the prviledge of sudo acess for nagios user to switch to the serviceuser. We have used expect option in client side script as an option.
1. In the Nagios CCM > Commands
created a "commands" named "applicaiton_start"
command line "$USER1$/application_start $SERVICESTATE$ $HOSTADDRESS$"
2. In nagios server created the below execution file
/usr/local/nagios/libexec/application_start
content for CRITICAL case set as below
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -c application_start
3. On client side
/usr/local/nagios/etc/nrpe.cfg
command[application_start]=/bin/bash /usr/local/nagios/etc/applicationstart.sh
4. Content of applicationstart.sh is as below
I am able to run the below script as nagios user and the service is getting started as serviceuser. But when we run the command from nagios server script is not getting triggered.
#!/usr/bin/expect -f
set timeout 180
spawn ssh -l serviceuser va1313.xyz.com
#expect "(yes/no)?"
#send "yes\r"
expect "assword:"
send "abc@20\r"
expect "$"
#send "bash /usr/local/nagios/etc/application.sh\r"
send "cd /apps/service/dev/bin/\r"
expect "$"
send "nohup java -Xms512m -Xmx1536m -jar commission-service*.jar --spring.data.mongodb.uri=mongodb://appuser:[email protected]:27099/S......
expect "$"
Thank you
recently we have purchased the license, but we are unable to find the option to create new post in the customer support forum. Is there any process to link the the ID with my license.
we are configuring event handler to restart an application using a script at the client end..
the script has to be run as a service user and we don't have the prviledge of sudo acess for nagios user to switch to the serviceuser. We have used expect option in client side script as an option.
1. In the Nagios CCM > Commands
created a "commands" named "applicaiton_start"
command line "$USER1$/application_start $SERVICESTATE$ $HOSTADDRESS$"
2. In nagios server created the below execution file
/usr/local/nagios/libexec/application_start
content for CRITICAL case set as below
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -c application_start
3. On client side
/usr/local/nagios/etc/nrpe.cfg
command[application_start]=/bin/bash /usr/local/nagios/etc/applicationstart.sh
4. Content of applicationstart.sh is as below
I am able to run the below script as nagios user and the service is getting started as serviceuser. But when we run the command from nagios server script is not getting triggered.
#!/usr/bin/expect -f
set timeout 180
spawn ssh -l serviceuser va1313.xyz.com
#expect "(yes/no)?"
#send "yes\r"
expect "assword:"
send "abc@20\r"
expect "$"
#send "bash /usr/local/nagios/etc/application.sh\r"
send "cd /apps/service/dev/bin/\r"
expect "$"
send "nohup java -Xms512m -Xmx1536m -jar commission-service*.jar --spring.data.mongodb.uri=mongodb://appuser:[email protected]:27099/S......
expect "$"
Thank you