Scheduled jobs - find/monitor failed hosts

Latest response

Hi

Regarding scheduled jobs.
What I would like is a way to send syslog messages if a scheduled job fails to our monitoring system. This isn´t supported today as I understand.
Is there a way to extract which hosts failed for a scheduled job?

The following hammer command just mention that some servers failed but do not mention which:

[root@server ~]# hammer job-invocation info --id 2528
ID: 2528
Description: Run SHB-RHEL-puppet-and-patch-script.sh
Status: failed
Success: 86
Failed: 5
Pending: 0
Total: 91
Start: 2020-03-26 02:10:19 +0100
Job Category: Commands
Hosts:
- server1.domain.se
- server2.domain.se
- server3.domain.se
and so on....

If you login to the GUI you can see which servers failed, but I want to do this using script.
Any suggestions?

It seems like a bad solution to have to check the output for each host in the job and try to figure it out that way when the Satellite seems to have the information somewhere:
MY_ID=1026; for host in hammer job-invocation info --id $MY_ID | grep "^ - " | awk '{print $2}'; do echo $host; hammer job-invocation output --id $MY_ID --host $host; echo; done

Responses