Groovy web console

subscribe to the feed Subscribe
to this
site

task 2

Published 5 months ago by Gopal
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def COMMAND_RESULT = """define contactgroup{ contactgroup_name webio-admins
alias UIM:NAGIOS-TEST-WEBIO;
members emusic
}
define contactgroup{
contactgroup_name voice_ops
alias UIM:NAGIOS-TEST-WEBIO1;
members emusic,mkopitsch,gmohan
}"""
String com=COMMAND_RESULT.findAll(/(?<=UIM:).*/)
String or=com.replaceAll(";","")
String dm=or.replaceAll(" ","")
//String sp=dm.split(',')
int ln=dm.length()
println dm
println ln
//println or
def mem=COMMAND_RESULT.findAll(/(?<=members).*/)
//println mem
String co="NAGIOS-TEST-WEBIO1"
for(i=0;i<ln;i++){
   // println "bro"
    if(or[i].equalsIgnoreCase(co)){
    println "my"
   // def mem=COMMAND_RESULT.findAll(/(?<=members).*/)
          for(j=0;j<mem.size();j++){
                   if(mem[j].contains("afasiolo")){c
                    println " Gp"
                   break;
          }   else{
              mem[j].add("afasiolo");
             }
        }
    }
}
println mem
//println COMMAND_RESULT
//if(COMMAND_RESULT.contains('NAGIOS-TEST-WEBIO1;')){
  // println Gopal
//}