I would like to write a bash script (that would be better if the script is in python) which executes a Perl
script ( https://github.com/MangeshBiradar/Check_mk/blob/master/check_jenkins_jobs.pl) within it. It is the output that Perl
script outputs:
CRITICAL ~ First_run ~ Build stability: 3 out of the last 4 builds failed. ~ 25
CRITICAL ~ Mangesh_Testing ~ Build stability: All recent builds failed. ~ 0
CRITICAL ~ MKS_Integrity ~ Build stability: All recent builds failed. ~ 0
OK ~ MKS_TEST ~ Build stability: No recent builds failed. ~ 100
CRITICAL ~ Rest_api_testing ~ ~ no score
CRITICAL ~ Second_job ~ ~ no score
OK ~ Team_test ~ Build stability: No recent builds failed. ~ 100
OK ~ test ~ Build stability: No recent builds failed. ~ 100
CRITICAL ~ TEST_1 ~ Build stability: 2 out of the last 3 builds failed. ~ 33
OK ~ Update_Outlook ~ Build stability: No recent builds failed. ~ 100
Now I have a task to be added into that bash/python
script is to parse the Perl
script output. According to the first field(CRITICAL, OK) in the parsed output I would like to return an appropriate value for CRITICAL return 2, for OK return 0 etc.
What are some ways I can achieve this?