[Spacewalk-list] Retrieve uptime via the API

Justin Sherrill jsherril at redhat.com
Mon Aug 3 21:03:54 UTC 2009


Luis Garcia wrote:
> Cool. Thanks for getting that added.  For now, I used python to call
> ssh and ran the results through awk. Nothing fancy, and no doubt
> error-prone, but it got the job done.  Grabbing  the info directly
> from a spacewalk will be much more convenient.

Hey Luis,

Just checked in the code for this:

http://git.fedorahosted.org/git/spacewalk.git/?p=spacewalk.git;a=commit;h=2bc9f8a0024f8d4f9cdd7595e9f19f6502a09eae

Should be in spacewalk 0.6

Cheers!
-Justin


> 
> 
> On Sat, Jul 25, 2009 at 3:27 PM, Jesus M. Rodriguez<jmrodri at gmail.com> wrote:
>> 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
>>
>> _______________________________________________
>> Spacewalk-list mailing list
>> Spacewalk-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/spacewalk-list
>>
> 
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list


-- 
Justin Sherrill, RHCA          1801 Varsity Drive.
Software Engineer                Raleigh, NC 27603
Red Hat, Inc.




More information about the Spacewalk-list mailing list