How to add logs to oplog in job result ?

15 views
Skip to first unread message

hugo lassiege

unread,
May 23, 2013, 5:23:43 AM5/23/13
to gan...@googlegroups.com
Hi,

I'm using the REST API to launch ganeti commands and I'm trying to get some notifications about the job execution.

If I use the /jobs/ endpoint, I get some log (oplog) so that I know the status of the operation.
I also have some hook scripts.
Does anyone knows if I can add my own logs from those hooks in the oplog so that I can have my own notifications available from the REST endpoint ?

For example :

...
 "oplog": [
        [
            [
                1,
                [
                    1369303915,
                    484955
                ],
                "message",
                "My Own log written from the hook"
            ],
...

Thanks,
Hugo

Thomas Thrainer

unread,
May 23, 2013, 9:01:15 AM5/23/13
to gan...@googlegroups.com
Hi Hugo,

Ganeti does not include the output (neither stdout nor stderr) of hooks scrips to the log if the hook execution succeeds. And even if it would, I guess you couldn't make use of it, as the output appears on the master node (and thus in the job log) only as soon as the hooks script has finished execution.

Thomas
--
Thomas Thrainer | Software Engineer | thom...@google.com | 

Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Katherine Stephens

Hugo Lassiège

unread,
May 23, 2013, 9:30:39 AM5/23/13
to gan...@googlegroups.com
ok thanks.
Do you know if there is a best practice to retrieve the status of hook scripts ?
I guess I can write log files from hook script but I'm wondering if there is a better way.


2013/5/23 Thomas Thrainer <thom...@google.com>

Thomas Thrainer

unread,
May 23, 2013, 10:05:55 AM5/23/13
to gan...@googlegroups.com
Unfortunately, there's no support in Ganeti for this. As I mentioned, Ganeti only processes output of hook scripts when they are done.
So I guess log files are your best bet to get some status, but it will be a bit tricky to retrieve them, as the hook scripts are executed on the individual nodes. Maybe there are better solutions for your individual use case (like sending notification over the network, or similar things), but this heavily depends on how you indent to use RAPI/hook scripts.

If you feel that there should be better (or any) support in Ganeti for this, please feel free to file an issue.

Thanks,
Thomas

Guido Trotter

unread,
May 23, 2013, 10:33:52 AM5/23/13
to gan...@googlegroups.com
On Thu, May 23, 2013 at 4:05 PM, Thomas Thrainer <thom...@google.com> wrote:
Unfortunately, there's no support in Ganeti for this. As I mentioned, Ganeti only processes output of hook scripts when they are done.
So I guess log files are your best bet to get some status, but it will be a bit tricky to retrieve them, as the hook scripts are executed on the individual nodes. Maybe there are better solutions for your individual use case (like sending notification over the network, or similar things), but this heavily depends on how you indent to use RAPI/hook scripts.

If you feel that there should be better (or any) support in Ganeti for this, please feel free to file an issue.


Of course if you're willing to provide a design doc and/or code that'd be even better! :) :)

Thanks a lot,

Guido

Reply all
Reply to author
Forward
0 new messages