nagios-jenkins-plugin icon indicating copy to clipboard operation
nagios-jenkins-plugin copied to clipboard

reconsider job_name "syntax" for icinga2 and foldered Jobs

Open donfranio opened this issue 7 years ago • 0 comments

Hi,

atm ( after Pullrequest #21 ) you can configure icinga2 with something like

object CheckCommand "jenkins-job-check-anon" {
     import "ipv4-or-ipv6"
     command = [ CustomPluginDir + "/check_jenkins_job_extended.pl" ]
     arguments = {
         "url" = {
             skip_key = true
             value = "$url$"
             order = 1
         }
         "job_name" = {
             skip_key = true
             value = "$job_name$"
             order = 2
         }
         "concurrent_fails_threshold" = {
             skip_key = true
             value = "$concurrent_fails_threshold$"
             order = 3
         }
        <asf>

and

apply Service for (jenkins_job => config in host.vars.jenkins_jobs_anon) {
     import "generic-service"
     check_command = "jenkins-job-check-anon"
     action_url = config.url+"/job/"+config.job_path
     vars += config
}

with

object Host {
    ...
    vars.jenkins_jobs_anon [ "Jenkins: jobname" ] = {
        url="https://jenkins.domain.tld",
        job_name="folder/jobname",
        concurrent_fails_threshold = 1,
        job_path="folder/job/jobname"
    }
}

... in a very nice and generic way (only have to add a jenkins-job-line for every job directly to the host).

But if the plugin is changed to require the exact path-part of the URL leading to the Jenkins-Job itself (e.g. folder/job/jobname) instead of folder/jobname, one could also create the action_url more nicely, right? e.g.

    vars.jenkins_jobs_anon [ "Jenkins: jobname" ] = {
        url="https://jenkins.domain.tld",
        job_name="folder/job/jobname",
        concurrent_fails_threshold = 1,
    }

in the Host-Object (saving one parameter) and

     action_url = config.url+"/"+config.job_path

this should also work for multiple folder-Levels, not?

What's your opinion about that?

cheers

donfranio avatar Mar 01 '17 14:03 donfranio