Hi!
I have a curl call which gets me the following output:
curl
http://hostname1.qa.com:8888/getlist
OUTPUT -
{
"token" = "201119041112";
"apps" = {
"PaymentApp" = "http://hostname1.qa.com:2333/cgi-bin/Jboss/PaymentApp-EMEA.woa/paymentInfo";
"OrderConsumer" = "http://hostname.qa2.com:2345/apps/orders";
...
};
}
Based on the curl call which is being made to a specific URL , I need to parse out URL entries which are of similar pattern as the URL to which the call was made (
http://hostname1.qa.com) -
I need to scrub out only entries which have hostname1 in them.
Then I need to populate a couple of properties files which look like this with the appname (e.g. PaymentApp) , URL(
http://hostname1.qa.com:2333), host(hostname1.qa.com) , port(e.g. 2333) , env (e.g. qa) information that I gathered from above -
file1 -
define service{
host_name $hostname
use generic-service
servicegroups preprod apps
service_description $appname
is_volatile 0
check_period 24x7
max_check_attempts 3
normal_check_interval 2
retry_check_interval 1
contact_groups admin
notification_interval 120
notification_period 24x7
notification_options w,u,c,r
process_perf_data 0
check_command url-check_$env_$port
}
file2 -
define command{
command_name url-check_$env_$port
command_line $USER1$/url-check -H $hostname -p $port -r added --regex=alive -t 4
}
The initial curl call can be part of the script itself.
Thanks,
Jack.
Moderator's Comments:
|
|
Please use [code] and [/code] tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks.
|
|