[Spacewalk-list] Retrieve uptime via the API

Jesus M. Rodriguez jmrodri at gmail.com
Sat Jul 25 20:27:20 UTC 2009


On Fri, Jul 24, 2009 at 11:28 PM, Justin Sherrill<jsherril at redhat.com> wrote:
> Brandon Galbraith wrote:
>> Luis,
>>
>> If someone responds offlist, or you find out, could you let me know? I'm
>> looking for a solution to this as well.
>>
>> Thanks!
>> -brandon
>>
>> On Fri, Jul 24, 2009 at 11:24 AM, Luis Garcia <luis.garciavega at gmail.com
>> <mailto:luis.garciavega at gmail.com>> wrote:
>>
>>     Hiya Spacewalkers,
>>
>>     Is there a way, via the api, to retrieve the uptime of a particular
>>     system?  I've searched the system,  system.config, system.custominfo
>>     and system.search documentation,  but I wasn't able to find anything.
>>
>>     I don't need a fancy date or anything. just the numbers of days up
>>     would work.
>>
>>     Reading the comments on the backend/server/handlers/xmlrpc/queue.py
>>     file, it seems like the system sends the uptime to the spacewalk
>>     server, and then the server calculates the actual date and time of the
>>     last reboot.
>>
>>     Any Ideas?
>>
>>     Thanks,
>>     ~Luis
>>
>>     _______________________________________________
>>     Spacewalk-list mailing list
>>     Spacewalk-list at redhat.com <mailto:Spacewalk-list at redhat.com>
>>     https://www.redhat.com/mailman/listinfo/spacewalk-list
>>
>>
>>
>>
>> --
>> Brandon Galbraith
>> Mobile: 630.400.6992
>> FNAL: 630.840.2141
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
> Looking through the spacewalk api docs located here:
> https://fedorahosted.org/spacewalk/wiki/ApiDocs
>
> I don't see see that information listed.  I'll see if i can get it into
> the 0.6 api additions though.  We'd probably just add something like
> 'last_boot' to the system.getDetails()  call.
>
> I went ahead and added that work task to this list (search for last_boot):
> https://fedorahosted.org/spacewalk/wiki/ApiAdditions
>
> Cheers!
>
> -Justin
>
> --
> Justin Sherrill, RHCA          1801 Varsity Drive.
> Software Engineer                Raleigh, NC 27603
> Red Hat, Inc.
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-li


In the meantime you might be able to run a script on the server that
calls uptime or something like that
with the system.scheduleScriptRun command.

http://www.redhat.com/spacewalk/documentation/api/0.5/handlers/SystemHandler.html#scheduleScriptRun

Then get results of the script passing in the id from the above function.

http://www.redhat.com/spacewalk/documentation/api/0.5/handlers/SystemHandler.html#getScriptResults

Not as elegant as a getDetails on the server, but could get you where
you want to go.

Sincerely,
jesus




More information about the Spacewalk-list mailing list