Re: Jenkins global metrics

2018-10-04 Thread gotviseryon
Sorry for the delayed response Rajendra.  Will try this and let you know.  
Got stuck with another issue.

On Friday, September 28, 2018 at 12:07:12 PM UTC-4, rajendraprasad reddy 
wrote:
>
> Following snippet can collect all jobs into a list,
>
> Just modify the script and please remove the filtering logic from previous 
> script,
>
> And add the following snippet, that's all you will get all the jobs.
>
> def jobsList=[];
>
> Jenkins.instance.projects.collect { 
>
> String currentJob=it.name; 
>
> jobsList.add(currentJob)
>
> }
>
> Thanks,
> Rajendra
>
> On Fri 28 Sep, 2018, 8:03 PM , > wrote:
>
>> Rajendra.  Thank you so much for the information.  It is very 
>> descriptive.  But, need some more help.  Sorry to bother, I'm new to 
>> Groovy.  You mentioned you are filtering the job name by 'Monitor'.  Just 
>> wanted to check how it works for this scenario
>>
>> I need details of all jobs, irrespective of which project/folder they 
>> belong to, from Saturday to Friday.  How does it work in this case?
>>
>> Also, I need this report to be emailed.  If you can suggest a method for 
>> that, will be helpful.  Thanks so much for the help.
>>
>> On Friday, September 28, 2018 at 3:00:14 AM UTC-4, rajendraprasad reddy 
>> wrote:
>>>
>>> Here is the Ggroovy Script:
>>> import javax.mail.*
>>> import javax.mail.internet.*
>>> import jenkins.model.*
>>> import java.text.SimpleDateFormat
>>> import java.util.*;
>>> import java.util.Calendar;
>>> import java.lang.System;
>>> import org.apache.tools.ant.Project
>>> import org.apache.tools.ant.ProjectHelper
>>>
>>> def env="Dev_Jenkins_Server";
>>> SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z 
>>> ");
>>> sdf.setTimeZone(TimeZone.getTimeZone("EST"));
>>> def  d=new Date();
>>> def oneHourPrior=new Date(System.currentTimeMillis() - 3600 * 1000);
>>> def currentTime=sdf.format(d);
>>> def monitoringStartTime=trim(oneHourPrior)
>>>
>>>
>>> def totalMonitoringJobs=0;
>>> def testSuiteIndex=0;
>>> def passedTestSuiteCount=0;
>>> def failedTestSuiteCount=0;
>>> def passedJobsList=[];
>>> def failedJobsList=[];
>>> def totalJobsList=[];
>>>
>>> println "Monitoring Start Time:"+monitoringStartTime ;
>>> println  "Monitoring Current Time:  "+currentTime;
>>>
>>> def matchedJobs = Jenkins.instance.items.findAll { job ->
>>> job.name =~ /Monitor/
>>> }
>>>
>>> println 
>>> "*"
>>>println "Total Monitoring Suites Count:"+matchedJobs.size();
>>>totalMonitoringJobs=matchedJobs.size();
>>>
>>> println "***Listing all Available 
>>> Monitoring Projects**"
>>> def index=0;
>>>  matchedJobs.each { job ->
>>>index=index+1;
>>> println index+". "+job.name;
>>> totalJobsList<>> }
>>> println 
>>> "*\n\n"
>>>
>>> println "Todays Execution Summary 
>>> Results***"
>>>  matchedJobs.each { job ->
>>>def numbuilds = job.builds.size()
>>>   if (numbuilds == 0) {
>>>println '  -> no build'
>>>return
>>>   }
>>>def lastbuild = job.builds[0]
>>>Calendar cal1 = Calendar.getInstance();
>>> Calendar cal2 = Calendar.getInstance();
>>> cal1.setTime(monitoringStartTime);
>>> cal2.setTime(lastbuild.getTime());
>>>
>>>
>>> if (cal2.after(cal1)) {
>>>testSuiteIndex=testSuiteIndex+1
>>> def rightPadding=50;
>>>
>>>
>>> String jobName= job.name;
>>> int requiredPadding=50-(jobName.size());
>>> while(requiredPadding>0){
>>>jobName=jobName+" "
>>>requiredPadding--;
>>> } 
>>>
>>> def jobInfo=jobName+'\tlastbuild: ' + lastbuild.displayName + ' = ' + 
>>> lastbuild.result + ', time: ' + lastbuild.getTime();
>>>
>>> String latestbuildStatus=lastbuild.result;
>>>  if( latestbuildStatus.equals("SUCCESS")){
>>>  passedTestSuiteCount=passedTestSuiteCount+1
>>>  //println "Found a Success Project"
>>>  jobInfo="\t\t"+ passedTestSuiteCount+" . "+jobInfo
>>> passedJobsList.add(jobInfo)
>>> }
>>>  if( latestbuildStatus.equals("FAILURE")){
>>>  failedTestSuiteCount=failedTestSuiteCount+1
>>>jobInfo="\t\t"+ failedTestSuiteCount+" . "+jobInfo
>>>  failedJobsList.add(jobInfo)
>>> }
>>> }
>>>
>>> }
>>>
>>> String passedJobsInfo= passedJobsList.join("\n")
>>> String failedJobsInfo= failedJobsList.join("\n")
>>>
>>> def jobsList ="";
>>> def jobIndex=0;
>>> totalJobsList.each{
>>>  jobIndex=jobIndex+1;
>>>  jobsList=jobIndex+". "+jobsList+it
>>>
>>> }
>>>
>>>
>>> String cumulativeStatus="PASS"
>>> if(failedJobsList.size()>0){
>>> cumulativeStatus="FAIL"
>>> }
>>>
>>>
>>> 

Re: Jenkins global metrics

2018-10-01 Thread Pavel Novák
Hi, for that probably the best fits custom pipeline script
I have the similar
- reading total number of builds and the builds in the given period

Feel free to customize it or use as starting point if interested) - in 
attachment 

Dne středa 26. září 2018 21:29:23 UTC+2 gotvi...@gmail.com napsal(a):
>
> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6bd6b942-9f06-4960-8dd2-d3efb82a50a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


build stat.txt.groovy
Description: Binary data


Re: Jenkins global metrics

2018-09-28 Thread RAJENDRA PRASAD
Following snippet can collect all jobs into a list,

Just modify the script and please remove the filtering logic from
previous script,

And add the following snippet, that's all you will get all the jobs.

def jobsList=[];

Jenkins.instance.projects.collect {

String currentJob=it.name;

jobsList.add(currentJob)

}

Thanks,
Rajendra

On Fri 28 Sep, 2018, 8:03 PM ,  wrote:

> Rajendra.  Thank you so much for the information.  It is very
> descriptive.  But, need some more help.  Sorry to bother, I'm new to
> Groovy.  You mentioned you are filtering the job name by 'Monitor'.  Just
> wanted to check how it works for this scenario
>
> I need details of all jobs, irrespective of which project/folder they
> belong to, from Saturday to Friday.  How does it work in this case?
>
> Also, I need this report to be emailed.  If you can suggest a method for
> that, will be helpful.  Thanks so much for the help.
>
> On Friday, September 28, 2018 at 3:00:14 AM UTC-4, rajendraprasad reddy
> wrote:
>>
>> Here is the Ggroovy Script:
>> import javax.mail.*
>> import javax.mail.internet.*
>> import jenkins.model.*
>> import java.text.SimpleDateFormat
>> import java.util.*;
>> import java.util.Calendar;
>> import java.lang.System;
>> import org.apache.tools.ant.Project
>> import org.apache.tools.ant.ProjectHelper
>>
>> def env="Dev_Jenkins_Server";
>> SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z ");
>> sdf.setTimeZone(TimeZone.getTimeZone("EST"));
>> def  d=new Date();
>> def oneHourPrior=new Date(System.currentTimeMillis() - 3600 * 1000);
>> def currentTime=sdf.format(d);
>> def monitoringStartTime=trim(oneHourPrior)
>>
>>
>> def totalMonitoringJobs=0;
>> def testSuiteIndex=0;
>> def passedTestSuiteCount=0;
>> def failedTestSuiteCount=0;
>> def passedJobsList=[];
>> def failedJobsList=[];
>> def totalJobsList=[];
>>
>> println "Monitoring Start Time:"+monitoringStartTime ;
>> println  "Monitoring Current Time:  "+currentTime;
>>
>> def matchedJobs = Jenkins.instance.items.findAll { job ->
>> job.name =~ /Monitor/
>> }
>>
>> println
>> "*"
>>println "Total Monitoring Suites Count:"+matchedJobs.size();
>>totalMonitoringJobs=matchedJobs.size();
>>
>> println "***Listing all Available
>> Monitoring Projects**"
>> def index=0;
>>  matchedJobs.each { job ->
>>index=index+1;
>> println index+". "+job.name;
>> totalJobsList<> }
>> println
>> "*\n\n"
>>
>> println "Todays Execution Summary
>> Results***"
>>  matchedJobs.each { job ->
>>def numbuilds = job.builds.size()
>>   if (numbuilds == 0) {
>>println '  -> no build'
>>return
>>   }
>>def lastbuild = job.builds[0]
>>Calendar cal1 = Calendar.getInstance();
>> Calendar cal2 = Calendar.getInstance();
>> cal1.setTime(monitoringStartTime);
>> cal2.setTime(lastbuild.getTime());
>>
>>
>> if (cal2.after(cal1)) {
>>testSuiteIndex=testSuiteIndex+1
>> def rightPadding=50;
>>
>>
>> String jobName= job.name;
>> int requiredPadding=50-(jobName.size());
>> while(requiredPadding>0){
>>jobName=jobName+" "
>>requiredPadding--;
>> }
>>
>> def jobInfo=jobName+'\tlastbuild: ' + lastbuild.displayName + ' = ' +
>> lastbuild.result + ', time: ' + lastbuild.getTime();
>>
>> String latestbuildStatus=lastbuild.result;
>>  if( latestbuildStatus.equals("SUCCESS")){
>>  passedTestSuiteCount=passedTestSuiteCount+1
>>  //println "Found a Success Project"
>>  jobInfo="\t\t"+ passedTestSuiteCount+" . "+jobInfo
>> passedJobsList.add(jobInfo)
>> }
>>  if( latestbuildStatus.equals("FAILURE")){
>>  failedTestSuiteCount=failedTestSuiteCount+1
>>jobInfo="\t\t"+ failedTestSuiteCount+" . "+jobInfo
>>  failedJobsList.add(jobInfo)
>> }
>> }
>>
>> }
>>
>> String passedJobsInfo= passedJobsList.join("\n")
>> String failedJobsInfo= failedJobsList.join("\n")
>>
>> def jobsList ="";
>> def jobIndex=0;
>> totalJobsList.each{
>>  jobIndex=jobIndex+1;
>>  jobsList=jobIndex+". "+jobsList+it
>>
>> }
>>
>>
>> String cumulativeStatus="PASS"
>> if(failedJobsList.size()>0){
>> cumulativeStatus="FAIL"
>> }
>>
>>
>> String  emailBody="""
>>  ***Todays Cumulative Test Execution
>> Summary Report*
>>  \tMonitoring Start Time:\t\t${monitoringStartTime}
>>  \tReport Genretated Time:\t${currentTime}
>>  \tTotal Monitoring Jobs Count Scheduled to run in Monitoring
>> Window:  ${totalMonitoringJobs}
>>  \tTotal Jobs Executed Today(As 

Re: Jenkins global metrics

2018-09-28 Thread RAJENDRA PRASAD
Hi ,
Happy to help you,
If you need all the jobs ( instead of filtered ones based in job name) ,
small chance needs to done in script, I can can update the script send you
tomorrow, today I am fully tired, if it is utter udgent, let me know I can
work today itself.

Regarding email, I am using ant script for sending email, that also I can
explain you, using Jenkins you can install ant plugin and trigger the ant
build.xml via groovy.

Also are you using Microsoft exchange server for for email service in your
company or Gmail ?

Let me know will send you a small script to a send email via ant within
groovy script.

Thanks,
Rajendra

On Fri 28 Sep, 2018, 8:03 PM ,  wrote:

> Rajendra.  Thank you so much for the information.  It is very
> descriptive.  But, need some more help.  Sorry to bother, I'm new to
> Groovy.  You mentioned you are filtering the job name by 'Monitor'.  Just
> wanted to check how it works for this scenario
>
> I need details of all jobs, irrespective of which project/folder they
> belong to, from Saturday to Friday.  How does it work in this case?
>
> Also, I need this report to be emailed.  If you can suggest a method for
> that, will be helpful.  Thanks so much for the help.
>
> On Friday, September 28, 2018 at 3:00:14 AM UTC-4, rajendraprasad reddy
> wrote:
>>
>> Here is the Ggroovy Script:
>> import javax.mail.*
>> import javax.mail.internet.*
>> import jenkins.model.*
>> import java.text.SimpleDateFormat
>> import java.util.*;
>> import java.util.Calendar;
>> import java.lang.System;
>> import org.apache.tools.ant.Project
>> import org.apache.tools.ant.ProjectHelper
>>
>> def env="Dev_Jenkins_Server";
>> SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z ");
>> sdf.setTimeZone(TimeZone.getTimeZone("EST"));
>> def  d=new Date();
>> def oneHourPrior=new Date(System.currentTimeMillis() - 3600 * 1000);
>> def currentTime=sdf.format(d);
>> def monitoringStartTime=trim(oneHourPrior)
>>
>>
>> def totalMonitoringJobs=0;
>> def testSuiteIndex=0;
>> def passedTestSuiteCount=0;
>> def failedTestSuiteCount=0;
>> def passedJobsList=[];
>> def failedJobsList=[];
>> def totalJobsList=[];
>>
>> println "Monitoring Start Time:"+monitoringStartTime ;
>> println  "Monitoring Current Time:  "+currentTime;
>>
>> def matchedJobs = Jenkins.instance.items.findAll { job ->
>> job.name =~ /Monitor/
>> }
>>
>> println
>> "*"
>>println "Total Monitoring Suites Count:"+matchedJobs.size();
>>totalMonitoringJobs=matchedJobs.size();
>>
>> println "***Listing all Available
>> Monitoring Projects**"
>> def index=0;
>>  matchedJobs.each { job ->
>>index=index+1;
>> println index+". "+job.name;
>> totalJobsList<> }
>> println
>> "*\n\n"
>>
>> println "Todays Execution Summary
>> Results***"
>>  matchedJobs.each { job ->
>>def numbuilds = job.builds.size()
>>   if (numbuilds == 0) {
>>println '  -> no build'
>>return
>>   }
>>def lastbuild = job.builds[0]
>>Calendar cal1 = Calendar.getInstance();
>> Calendar cal2 = Calendar.getInstance();
>> cal1.setTime(monitoringStartTime);
>> cal2.setTime(lastbuild.getTime());
>>
>>
>> if (cal2.after(cal1)) {
>>testSuiteIndex=testSuiteIndex+1
>> def rightPadding=50;
>>
>>
>> String jobName= job.name;
>> int requiredPadding=50-(jobName.size());
>> while(requiredPadding>0){
>>jobName=jobName+" "
>>requiredPadding--;
>> }
>>
>> def jobInfo=jobName+'\tlastbuild: ' + lastbuild.displayName + ' = ' +
>> lastbuild.result + ', time: ' + lastbuild.getTime();
>>
>> String latestbuildStatus=lastbuild.result;
>>  if( latestbuildStatus.equals("SUCCESS")){
>>  passedTestSuiteCount=passedTestSuiteCount+1
>>  //println "Found a Success Project"
>>  jobInfo="\t\t"+ passedTestSuiteCount+" . "+jobInfo
>> passedJobsList.add(jobInfo)
>> }
>>  if( latestbuildStatus.equals("FAILURE")){
>>  failedTestSuiteCount=failedTestSuiteCount+1
>>jobInfo="\t\t"+ failedTestSuiteCount+" . "+jobInfo
>>  failedJobsList.add(jobInfo)
>> }
>> }
>>
>> }
>>
>> String passedJobsInfo= passedJobsList.join("\n")
>> String failedJobsInfo= failedJobsList.join("\n")
>>
>> def jobsList ="";
>> def jobIndex=0;
>> totalJobsList.each{
>>  jobIndex=jobIndex+1;
>>  jobsList=jobIndex+". "+jobsList+it
>>
>> }
>>
>>
>> String cumulativeStatus="PASS"
>> if(failedJobsList.size()>0){
>> cumulativeStatus="FAIL"
>> }
>>
>>
>> String  emailBody="""
>>  ***Todays Cumulative 

Re: Jenkins global metrics

2018-09-28 Thread gthosani1
I have used autojenkins, it’s command line and api is neat to expose job 
details 

Sent from my iPhone

> On Sep 27, 2018, at 11:59 PM, RAJENDRA PRASAD  
> wrote:
> 
> Here is the Ggroovy Script:
> import javax.mail.*
> import javax.mail.internet.*
> import jenkins.model.*
> import java.text.SimpleDateFormat
> import java.util.*;
> import java.util.Calendar;
> import java.lang.System;
> import org.apache.tools.ant.Project
> import org.apache.tools.ant.ProjectHelper
> 
> def env="Dev_Jenkins_Server";
> SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z ");
> sdf.setTimeZone(TimeZone.getTimeZone("EST"));
> def  d=new Date();
> def oneHourPrior=new Date(System.currentTimeMillis() - 3600 * 1000);
> def currentTime=sdf.format(d);
> def monitoringStartTime=trim(oneHourPrior)
> 
> 
> def totalMonitoringJobs=0;
> def testSuiteIndex=0;
> def passedTestSuiteCount=0;
> def failedTestSuiteCount=0;
> def passedJobsList=[];
> def failedJobsList=[];
> def totalJobsList=[];
> 
> println "Monitoring Start Time:"+monitoringStartTime ;
> println  "Monitoring Current Time:  "+currentTime;
> 
> def matchedJobs = Jenkins.instance.items.findAll { job ->
>   job.name =~ /Monitor/
> }
> 
> println 
> "*"
>println "Total Monitoring Suites Count:"+matchedJobs.size();
>totalMonitoringJobs=matchedJobs.size();
> 
> println "***Listing all Available Monitoring 
> Projects**"
> def index=0;
>  matchedJobs.each { job ->
>index=index+1;
>   println index+". "+job.name;
> totalJobsList<   }
> println 
> "*\n\n"
> 
> println "Todays Execution Summary 
> Results***"
>  matchedJobs.each { job ->
>def numbuilds = job.builds.size()
>   if (numbuilds == 0) {
>println '  -> no build'
>return
>   }
>def lastbuild = job.builds[0]
>Calendar cal1 = Calendar.getInstance();
> Calendar cal2 = Calendar.getInstance();
> cal1.setTime(monitoringStartTime);
> cal2.setTime(lastbuild.getTime());
> 
> 
> if (cal2.after(cal1)) {
>testSuiteIndex=testSuiteIndex+1
> def rightPadding=50;
> 
> 
> String jobName= job.name;
> int requiredPadding=50-(jobName.size());
> while(requiredPadding>0){
>jobName=jobName+" "
>requiredPadding--;
> } 
> 
> def jobInfo=jobName+'\tlastbuild: ' + lastbuild.displayName + ' = ' + 
> lastbuild.result + ', time: ' + lastbuild.getTime();
> 
> String latestbuildStatus=lastbuild.result;
>  if( latestbuildStatus.equals("SUCCESS")){
>  passedTestSuiteCount=passedTestSuiteCount+1
>  //println "Found a Success Project"
>  jobInfo="\t\t"+ passedTestSuiteCount+" . "+jobInfo
> passedJobsList.add(jobInfo)
> }
>  if( latestbuildStatus.equals("FAILURE")){
>  failedTestSuiteCount=failedTestSuiteCount+1
>jobInfo="\t\t"+ failedTestSuiteCount+" . "+jobInfo
>  failedJobsList.add(jobInfo)
> }
> }
> 
> }
> 
> String passedJobsInfo= passedJobsList.join("\n")
> String failedJobsInfo= failedJobsList.join("\n")
> 
> def jobsList ="";
> def jobIndex=0;
> totalJobsList.each{
>  jobIndex=jobIndex+1;
>  jobsList=jobIndex+". "+jobsList+it
> 
> }
> 
> 
> String cumulativeStatus="PASS"
> if(failedJobsList.size()>0){
> cumulativeStatus="FAIL"
> }
> 
> 
> String  emailBody=""" 
>  ***Todays Cumulative Test Execution Summary 
> Report*
>  \tMonitoring Start Time:\t\t${monitoringStartTime} 
>  \tReport Genretated Time:\t${currentTime}
>  \tTotal Monitoring Jobs Count Scheduled to run in Monitoring Window:  
> ${totalMonitoringJobs}
>  \tTotal Jobs Executed Today(As of Now): ${testSuiteIndex}
>  \tTotal Jobs Passed Today(As of Now):${passedJobsList.size()}
>  \tTotal Jobs Failed Today:(As of Now): ${failedJobsList.size()}
>  \tCumulative Result: ${cumulativeStatus}
> 
> ***"""+"\n\n\t->Failed
>  Jobs Count: ${failedJobsList.size()} 
> \n"+failedJobsInfo+"\n\n\t->Passed Jobs Count: 
> ${passedJobsList.size()}\n"+passedJobsInfo+"\n\n"
> 
> println emailBody;
> String subject="${env} Jenkins Server:[ ${cumulativeStatus}]  ${currentTime}: 
>  Cumulative Test Execution Summary Report";
> 
>  public static Date trim(Date date) {
> Calendar calendar = Calendar.getInstance();
> calendar.setTime(date);
> calendar.add(Calendar.SECOND, 0);
> calendar.add(Calendar.MINUTE, -60);
> 

Re: Jenkins global metrics

2018-09-28 Thread gotviseryon
Rajendra.  Thank you so much for the information.  It is very descriptive.  
But, need some more help.  Sorry to bother, I'm new to Groovy.  You 
mentioned you are filtering the job name by 'Monitor'.  Just wanted to 
check how it works for this scenario

I need details of all jobs, irrespective of which project/folder they 
belong to, from Saturday to Friday.  How does it work in this case?

Also, I need this report to be emailed.  If you can suggest a method for 
that, will be helpful.  Thanks so much for the help.

On Friday, September 28, 2018 at 3:00:14 AM UTC-4, rajendraprasad reddy 
wrote:
>
> Here is the Ggroovy Script:
> import javax.mail.*
> import javax.mail.internet.*
> import jenkins.model.*
> import java.text.SimpleDateFormat
> import java.util.*;
> import java.util.Calendar;
> import java.lang.System;
> import org.apache.tools.ant.Project
> import org.apache.tools.ant.ProjectHelper
>
> def env="Dev_Jenkins_Server";
> SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z ");
> sdf.setTimeZone(TimeZone.getTimeZone("EST"));
> def  d=new Date();
> def oneHourPrior=new Date(System.currentTimeMillis() - 3600 * 1000);
> def currentTime=sdf.format(d);
> def monitoringStartTime=trim(oneHourPrior)
>
>
> def totalMonitoringJobs=0;
> def testSuiteIndex=0;
> def passedTestSuiteCount=0;
> def failedTestSuiteCount=0;
> def passedJobsList=[];
> def failedJobsList=[];
> def totalJobsList=[];
>
> println "Monitoring Start Time:"+monitoringStartTime ;
> println  "Monitoring Current Time:  "+currentTime;
>
> def matchedJobs = Jenkins.instance.items.findAll { job ->
> job.name =~ /Monitor/
> }
>
> println 
> "*"
>println "Total Monitoring Suites Count:"+matchedJobs.size();
>totalMonitoringJobs=matchedJobs.size();
>
> println "***Listing all Available 
> Monitoring Projects**"
> def index=0;
>  matchedJobs.each { job ->
>index=index+1;
> println index+". "+job.name;
> totalJobsList< }
> println 
> "*\n\n"
>
> println "Todays Execution Summary 
> Results***"
>  matchedJobs.each { job ->
>def numbuilds = job.builds.size()
>   if (numbuilds == 0) {
>println '  -> no build'
>return
>   }
>def lastbuild = job.builds[0]
>Calendar cal1 = Calendar.getInstance();
> Calendar cal2 = Calendar.getInstance();
> cal1.setTime(monitoringStartTime);
> cal2.setTime(lastbuild.getTime());
>
>
> if (cal2.after(cal1)) {
>testSuiteIndex=testSuiteIndex+1
> def rightPadding=50;
>
>
> String jobName= job.name;
> int requiredPadding=50-(jobName.size());
> while(requiredPadding>0){
>jobName=jobName+" "
>requiredPadding--;
> } 
>
> def jobInfo=jobName+'\tlastbuild: ' + lastbuild.displayName + ' = ' + 
> lastbuild.result + ', time: ' + lastbuild.getTime();
>
> String latestbuildStatus=lastbuild.result;
>  if( latestbuildStatus.equals("SUCCESS")){
>  passedTestSuiteCount=passedTestSuiteCount+1
>  //println "Found a Success Project"
>  jobInfo="\t\t"+ passedTestSuiteCount+" . "+jobInfo
> passedJobsList.add(jobInfo)
> }
>  if( latestbuildStatus.equals("FAILURE")){
>  failedTestSuiteCount=failedTestSuiteCount+1
>jobInfo="\t\t"+ failedTestSuiteCount+" . "+jobInfo
>  failedJobsList.add(jobInfo)
> }
> }
>
> }
>
> String passedJobsInfo= passedJobsList.join("\n")
> String failedJobsInfo= failedJobsList.join("\n")
>
> def jobsList ="";
> def jobIndex=0;
> totalJobsList.each{
>  jobIndex=jobIndex+1;
>  jobsList=jobIndex+". "+jobsList+it
>
> }
>
>
> String cumulativeStatus="PASS"
> if(failedJobsList.size()>0){
> cumulativeStatus="FAIL"
> }
>
>
> String  emailBody=""" 
>  ***Todays Cumulative Test Execution 
> Summary Report*
>  \tMonitoring Start Time:\t\t${monitoringStartTime} 
>  \tReport Genretated Time:\t${currentTime}
>  \tTotal Monitoring Jobs Count Scheduled to run in Monitoring Window:  
> ${totalMonitoringJobs}
>  \tTotal Jobs Executed Today(As of Now): ${testSuiteIndex}
>  \tTotal Jobs Passed Today(As of Now):${passedJobsList.size()}
>  \tTotal Jobs Failed Today:(As of Now): ${failedJobsList.size()}
>  \tCumulative Result: ${cumulativeStatus}
> 
> ***"""+"\n\n\t->Failed
>  
> Jobs Count: ${failedJobsList.size()} 
> \n"+failedJobsInfo+"\n\n\t->Passed Jobs Count: 
> ${passedJobsList.size()}\n"+passedJobsInfo+"\n\n"
>
> println emailBody;

Re: Jenkins global metrics

2018-09-27 Thread RAJENDRA PRASAD
I am on the way to office , after reaching to office I can provide you
sample groovy script and required configuration I can share with you.
With that info you can implement in time.

Thanks,
rajendra

On 28-Sep-2018 8:21 AM,  wrote:

Hi Rajendra.  Thank you so much for this news.  Would really appreciate
help on implementing this.  Could you please guide me through?


On Thursday, September 27, 2018 at 9:44:16 PM UTC-4, rajendraprasad reddy
wrote:

> Hi ,
> I did similar implementation for monitoring my Jenkins instance. But I
> never used a plugin to do that , instead of plugins I used groovy script to
> prepare mail body content and sending this mail body to intended recipient
> list.
> Using groovy it is possible to get any information of Jenkins using
> Jenkins API calls.
>
> Let me know you need further help in implementing this procedure.
>
> Thanks,
> Rajendra
>
> On Thu 27 Sep, 2018, 5:58 PM ,  wrote:
>
>> Any help on this.  Little urgent.
>>
>> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com
>> wrote:
>>>
>>> I'm looking to generate a report, as a job, which will provide the
>>> global metrics of my Jenkins instance.  I need details in the report like
>>> (1) How many jobs ran? (2) # of failed and successful jobs and every
>>> possible metrics possible in one report.  I need to send this report every
>>> week to my management, so would like to know if it's possible to schedule a
>>> job to run this report every Friday and send the metrics by email to my
>>> managers?  I found these two plugins - '*Global Build Status*' and '*Build
>>> Metrics*'.  But not able to use these as part of a job, download the
>>> report or email a link to the report or nothing of that sort.  Please help.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-use...@googlegroups.com.
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/42f25477-6bdc-485e-95a9-466833637c9f%40googlegroups.com

.

For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAMrg02TcYSkBMq9AyUxtN1Moom1YORctehDMpvjX%2Bg9FuZ_TNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Hi Rajendra.  Thank you so much for this news.  Would really appreciate 
help on implementing this.  Could you please guide me through?

On Thursday, September 27, 2018 at 9:44:16 PM UTC-4, rajendraprasad reddy 
wrote:
>
> Hi ,
> I did similar implementation for monitoring my Jenkins instance. But I 
> never used a plugin to do that , instead of plugins I used groovy script to 
> prepare mail body content and sending this mail body to intended recipient 
> list.
> Using groovy it is possible to get any information of Jenkins using 
> Jenkins API calls.
>
> Let me know you need further help in implementing this procedure.
>
> Thanks,
> Rajendra
>
> On Thu 27 Sep, 2018, 5:58 PM , > wrote:
>
>> Any help on this.  Little urgent.
>>
>> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com 
>> wrote:
>>>
>>> I'm looking to generate a report, as a job, which will provide the 
>>> global metrics of my Jenkins instance.  I need details in the report like 
>>> (1) How many jobs ran? (2) # of failed and successful jobs and every 
>>> possible metrics possible in one report.  I need to send this report every 
>>> week to my management, so would like to know if it's possible to schedule a 
>>> job to run this report every Friday and send the metrics by email to my 
>>> managers?  I found these two plugins - '*Global Build Status*' and '*Build 
>>> Metrics*'.  But not able to use these as part of a job, download the 
>>> report or email a link to the report or nothing of that sort.  Please help.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/42f25477-6bdc-485e-95a9-466833637c9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread RAJENDRA PRASAD
Hi ,
I did similar implementation for monitoring my Jenkins instance. But I
never used a plugin to do that , instead of plugins I used groovy script to
prepare mail body content and sending this mail body to intended recipient
list.
Using groovy it is possible to get any information of Jenkins using Jenkins
API calls.

Let me know you need further help in implementing this procedure.

Thanks,
Rajendra

On Thu 27 Sep, 2018, 5:58 PM ,  wrote:

> Any help on this.  Little urgent.
>
> On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com
> wrote:
>>
>> I'm looking to generate a report, as a job, which will provide the global
>> metrics of my Jenkins instance.  I need details in the report like (1) How
>> many jobs ran? (2) # of failed and successful jobs and every possible
>> metrics possible in one report.  I need to send this report every week to
>> my management, so would like to know if it's possible to schedule a job to
>> run this report every Friday and send the metrics by email to my managers?
>> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.
>> But not able to use these as part of a job, download the report or email a
>> link to the report or nothing of that sort.  Please help.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAMrg02Qhh814e4bQxug25kefhxeE-OOWoWB-kOgKA%2BgYQi5%3Dbw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Thanks a lot Vishal.  Will explore this.

On Thursday, September 27, 2018 at 1:12:48 PM UTC-4, Vishal Raina wrote:
>
> We have been exploring Hygiene it not only helps with Jenkins metrics and 
> also acts as a central dashboard for all your CI/CD tool set.
> Take a look at here https://github.com/Hygieia/Hygieia.
>
> HTH
>
> On Wednesday, September 26, 2018 at 12:29:23 PM UTC-7, gotvi...@gmail.com 
> wrote:
>>
>> I'm looking to generate a report, as a job, which will provide the global 
>> metrics of my Jenkins instance.  I need details in the report like (1) How 
>> many jobs ran? (2) # of failed and successful jobs and every possible 
>> metrics possible in one report.  I need to send this report every week to 
>> my management, so would like to know if it's possible to schedule a job to 
>> run this report every Friday and send the metrics by email to my managers?  
>> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
>> But not able to use these as part of a job, download the report or email a 
>> link to the report or nothing of that sort.  Please help.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5b78d0f4-f2d2-4382-aaa8-95c7576d5d4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread Vishal Raina
We have been exploring Hygiene it not only helps with Jenkins metrics and 
also acts as a central dashboard for all your CI/CD tool set.
Take a look at here https://github.com/Hygieia/Hygieia.

HTH

On Wednesday, September 26, 2018 at 12:29:23 PM UTC-7, gotvi...@gmail.com 
wrote:
>
> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ea6759eb-5eca-4242-9037-5bd390d79c66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Thanks for the info Tyler.

On Thursday, September 27, 2018 at 10:46:20 AM UTC-4, R Tyler Croy wrote:
>
> (replies inline) 
>
> On Wed, 26 Sep 2018, gotvi...@gmail.com  wrote: 
>
> > I'm looking to generate a report, as a job, which will provide the 
> global 
> > metrics of my Jenkins instance.  I need details in the report like (1) 
> How 
> > many jobs ran? (2) # of failed and successful jobs and every possible 
> > metrics possible in one report.  I need to send this report every week 
> to 
> > my management, so would like to know if it's possible to schedule a job 
> to 
> > run this report every Friday and send the metrics by email to my 
> managers?   
> > I found these two plugins - '*Global Build Status*' and '*Build 
> Metrics*'.   
> > But not able to use these as part of a job, download the report or email 
> a 
> > link to the report or nothing of that sort.  Please help. 
>
>
> I personally use Datadog and their plugin integration to get such metrics 
> out 
> of our Jenkins instances. You can certainly script such metrics gathering 
> in 
> Jenkins, but there's nothing ready-made out of the box. 
>
>
>
> Cheers 
>
> -- 
> GitHub:  https://github.com/rtyler 
> Twitter: https://twitter.com/agentdero 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e6cb6873-445c-4851-a0c3-91ec65ce4771%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins global metrics

2018-09-27 Thread R. Tyler Croy
(replies inline)

On Wed, 26 Sep 2018, gotviser...@gmail.com wrote:

> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.


I personally use Datadog and their plugin integration to get such metrics out
of our Jenkins instances. You can certainly script such metrics gathering in
Jenkins, but there's nothing ready-made out of the box.



Cheers

--
GitHub:  https://github.com/rtyler
Twitter: https://twitter.com/agentdero

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/20180927144554.GA16966%40grape.brokenco.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Jenkins global metrics

2018-09-27 Thread gotviseryon
Any help on this.  Little urgent.

On Wednesday, September 26, 2018 at 3:29:23 PM UTC-4, gotvi...@gmail.com 
wrote:
>
> I'm looking to generate a report, as a job, which will provide the global 
> metrics of my Jenkins instance.  I need details in the report like (1) How 
> many jobs ran? (2) # of failed and successful jobs and every possible 
> metrics possible in one report.  I need to send this report every week to 
> my management, so would like to know if it's possible to schedule a job to 
> run this report every Friday and send the metrics by email to my managers?  
> I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
> But not able to use these as part of a job, download the report or email a 
> link to the report or nothing of that sort.  Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b90c4f44-cae0-4c29-bdb1-2d9ceb0e1736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins global metrics

2018-09-26 Thread gotviseryon
I'm looking to generate a report, as a job, which will provide the global 
metrics of my Jenkins instance.  I need details in the report like (1) How 
many jobs ran? (2) # of failed and successful jobs and every possible 
metrics possible in one report.  I need to send this report every week to 
my management, so would like to know if it's possible to schedule a job to 
run this report every Friday and send the metrics by email to my managers?  
I found these two plugins - '*Global Build Status*' and '*Build Metrics*'.  
But not able to use these as part of a job, download the report or email a 
link to the report or nothing of that sort.  Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3262ec9d-3f0b-47fa-bdbd-182b05b5c871%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.