x
login Signup

How to get the list of ElectricCommander jobs running more than 12 hours with email notification?

I want to know the ElectricCommander jobs which are running more than 12 hours. Can you suggest how can I do that so that I can send myself a email notification?

avatar image By nturba 30 asked Dec 05 at 08:50 PM
more ▼
(comments are locked)
10|750 characters needed characters left

1 answer: sort voted first

Approach that worked for me.

I created scheduled procedure that checks jobs status.

I added step into procedure with following with following command that uses ec-perl shell:

 use strict;
 use warnings;
 use XML::Simple;
 use XML::XPath;
 use Data::Dumper;
 use ElectricCommander;
 
 my $ec = new ElectricCommander({debug =>1});
 $ec->login('admin','changeme');
 
 my $content = $ec->findObjects({
         objectType => 'job',
         filter=>[
                                         {
                                                 propertyName => 'elapsedTime',
                                                 operator => "greaterThan",
                                                 operand1 => "43200000"
                                         },
                 ]
 });
 # print Dumper $content->{_xml};
 
 my $property_to_set="Jobs with more than 12 hours: ";
 
 foreach my $node ($content->findnodes("//jobName")->get_nodelist)
 {
    print "Job is: " .  $node->string_value . " ...\n";
    $property_to_set .= ", ". $node->string_value;
 }
 $ec->setProperty({propertyName => "/myJob/table_html", value => "$property_to_set"}); 

Where "operand1" value is the time of the job in ms.

Also, i added On Completion Email Notifier in procedure that sends information gathered in step.

alt text

As the result, each time procedure runs it sends me similar notification:

alt text

screenshot-6.png (15.2 kB)
screenshot-8-1.png (11.8 kB)
avatar image By nturba 30 answered Dec 06 at 11:49 AM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.