I need to pass arguments to script sh, the variables that I need to pass are "host" and "message" only, I dont need anything other.
any idea how to do it?
Thanks
Alert Method: execute scrip (Arguments)
Alert Method: execute scrip (Arguments)
You do not have the required permissions to view the files attached to this post.
Re: Alert Method: execute scrip (Arguments)
Can you show us the "auto.sh" script? Normally, you would just type in the arguments in the "Arguments" text-box. Here's a simple example:
My script: /usr/local/nagioslogserver/scripts/myscript3.sh
My Alert (with 2 arguments added):
The args.txt file that was created after running the alert:
My script: /usr/local/nagioslogserver/scripts/myscript3.sh
Code: Select all
#!/bin/bash
echo "Host is $1
Message is $2" >> /tmp/args.txtCode: Select all
[root@localhost tmp]# cat args.txt
Host is myhost
Message is testYou do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Alert Method: execute scrip (Arguments)
hi lmiltchev,
thank you, it worked!!
I think it was not working for me because I was runing the script sh in another folder....
but do you know how to pass el "host" and the "message"?
I need to pass the host that ran the alert and the message sended to Nagios Log Server in the script in the arguments, in the same alert. To run the script with the arguments.
Thanks regards!
thank you, it worked!!
I think it was not working for me because I was runing the script sh in another folder....
but do you know how to pass el "host" and the "message"?
I need to pass the host that ran the alert and the message sended to Nagios Log Server in the script in the arguments, in the same alert. To run the script with the arguments.
Thanks regards!
You do not have the required permissions to view the files attached to this post.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Alert Method: execute scrip (Arguments)
Unfortunately, this is not possible as the alert is based on a count of logs... the results could contain 10,000 different hosts and messagesfscinfra wrote:but do you know how to pass el "host" and the "message"?
Re: Alert Method: execute scrip (Arguments)
hi,
I dont know to pass the arguments. But I only want to pass a only host, beacuse I will configure a alert in a determined host.
I dont know to pass the arguments. But I only want to pass a only host, beacuse I will configure a alert in a determined host.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Alert Method: execute scrip (Arguments)
Unfortunately, this is not possible.
Re: Alert Method: execute scrip (Arguments)
Hi,
mmm ok Thanks
for you help.
mmm ok Thanks