Adding the offline convo i had with Corey M in private here since other people may end up having these questions/issue as well:
On Wed, 12 Oct 2011 12:13:06 -0500, Corey Minyard wrote: > On 10/12/2011 11:54 AM, [email protected] wrote: >> On Wed, 12 Oct 2011 10:02:16 -0500, Corey Minyard wrote: >>> I've also attached a >>> little program that does a get device id command every 5 seconds. >>> Run >>> it with "sample2.py smi 0" to talk to the local interface. >> >> So, i've gotten this to run actually (hurrah!) but i needed to >> comment out the line about enable_debug_malloc().. if i didn't, i >> would get a segfault.. can send you the core if you're interested in >> why.. i am runing this on a rhel6 system (but i've had this happen on >> rhel 4/rhel 5 systems as well).. i actually first came across the >> segfault with all the other sample code i've found, but i usually got >> 'open failed' if not a segfault (with the commenting of >> enable_debug_malloc() ) > I actually just fixed that bug (it was actually two different bugs > that happened to compensate for each other before), and I just did a > release (2.0.19) with the fix. Thanks, i'll give this new version a try.. i was using 2.0.18 and must have just gotten that ver at the last moment knowing my luck :) >> So my next question is, what's this do? seems to output a buncha >> lines every second (i see wait_io(1000) so assuming that's # of ms to >> sleep for).. clearly it's coming from the bmc, but no idea what it >> means just yet :) very cool though that it runs! :D > It should output a single line every 5 seconds. That's the response > data for the "get device id" IPMI command. Yup, my reasoning was wrong, i saw you were using wait_io to sleep for 5 seconds at a time, so yes the output is every 5 seconds not every second (my sense of time is off i guess). > The main loop should call the "to_mc" method on the main_handler.mc > variable. This causes the "mc_cb" method to be called in the handler > object. That calls mc.send_command(), which sends an IPMI command. > The mc_cmd_cb method is called when the response returns. There > isn't > any error checking in this, I should have added that. Yup i see that now, and it looks like you're using mc_cb to run the function mc.send_command(0, 6, 1, [], self).. this looks like your 'get device id' query is: 6 is the netfn, 1 is the command, and data (none in this case) would go in [].. i'll give this a try w/ my query (anyone interested in power data on the HP sl systems as well? :) Just not sure what actually calls mc_cb (i've come to realize the _cb stands for callback heh). I guess I'll need to re-read that event-driven section of the 'gentle introduction to ipmi' doc bundled with the distro (and on the web). On Wed, 12 Oct 2011 13:07:02 -0400, [email protected] wrote: > well thanks i started an offilne convo with you about this but i > guess > i'll stick to replying here.. so this looks example like what might > get > me going, just one last question, where in the code do you specify > the > netfn/cmd/data for the query? > > I see the mc_cmd_cb func with a netfn/cmd and response but i dont > see > where this gets called, or if this is the query path of the code or > just > handling the response? > > anyway thanks for the help so far, this looks very promising and may > be > just what i was looking for all along! > > On Wed, 12 Oct 2011 12:04:13 -0500, Corey Minyard wrote: >> On 10/12/2011 11:28 AM, [email protected] wrote: >>> Thanks, I've looked at the sample.py a few times already but i >>> couldn't get it to run in our environment (the GUI encumberance >>> keeps >>> it from running in our environment) and hence it was a little >>> difficult to get my head wrapped around the code itself if i >>> couldn't >>> see it in action. This is on top of there not seeming to be much >>> documentation on the different function calls, other than looking >>> at >>> the source code for the swig interface (the .i file) or the lib's c >>> code >>> >>> i'll take a look at the the program you attached too, but basically >>> what i'm trying to do is query power data against an HP sl-line of >>> systems that don't have full-blown iLO's (the cheaper SL systems >>> had a >>> less capable lo100, like the sl160z g6 or the sl165s g7) which >>> originally made power-monitoring difficult and limited via an HP >>> tool >>> that only runs locally. But I've discovered the utility they use >>> locally to query the data from the (sl6000/sl6500) chassis the >>> systems >>> are in, uses ipmi raw under the hood, and these ipmi raw queries >>> work >>> remotely against the bmc of the host as well. i was hoping to have >>> something that can frequently poll power usage out-of-band (since >>> the >>> readings appear to be instantaneous and not averaged over an >>> interval) >>> while we are doing benchmarking against new procs from AMD (hence i >>> don't want to run the utility HP provides locally since that will >>> take >>> away CPU time from the benchmarks). >>> >>> my C is really not that strong but i've getting a good grasp on >>> python lately (been using perl for a while now as well), hence i >>> was >>> trying to get more familiar with OO/python and use OpenIPMI, but >>> from >>> what i've seen, OpenIPMI seems to want to do all this leg work for >>> you >>> that i'm not sure i need, and i'm not sure how to just have it do >>> something low-level/simple like connect to a bmc, authenticate, >>> start >>> a session, and with the same session poll a raw cmd against the bmc >>> every few seconds (or more frequently depending on the resolution >>> of >>> the data being returned). >> The sample2.py code I sent in the previous email should show how to >> do this. >> >>> >>> the limited amount of example code i had see of OpenIPMI get >>> incredibly complex really fast (esp when GUI functionality is >>> entangled into the code IMO needlessly). i just want to do >>> something >>> simple like throw some raw hex queries (netfn/cmd/data) at a bmc >>> and >>> get the data back as quickly as possible.. hopefully w/o forking a >>> separate helper command to do it (e.g. ipmitool or ipmiutil).. and >>> i >>> was hoping OpenIPMI could spare me having to re-invent the lower >>> framework of crafting udp packets and stuffing them with >>> ipmi-compatible data just to do a simple ipmi-raw query :-\ but it >>> started to seem like OpenIPMI wasn't intended for this use, but >>> instead to help write more complex management software suites (with >>> OpenIPMI handling the complicated tasks). Hence my original >>> question >>> to this list if OpenIPMI is too powerful a tool for my simple needs >>> :) >> >> There is no GUI code entangled in the OpenIPMI python interface, nor >> in the sample.py script. It is fairly entangled with the openipmi >> GUI, obviously, perhaps you were looking there. >> >> OpenIPMI was intended to be able to do simple things, too, but it's >> a >> huge interface and there's not much documentation help for writing >> simple things. >> >>> >>> I was hoping someone had some simple sample code that took a >>> username/password/ip for the bmc, and i could hard-code the hex >>> queries into the code and adapt it to the rest of my needs. >> >> The "sample2.py" program I sent you will work for lan interfaces, >> too. Run it as: >> >> sample2.py lan -U <userid> -P <password> <ipaddress> >> >> You can obviously hard-code those values in the program, if you >> like. >> >> -corey >> >>> >>> On Wed, 12 Oct 2011 10:02:16 -0500, Corey Minyard wrote: >>>> On 10/11/2011 04:02 PM, [email protected] wrote: >>>>> So I have some ipmitool raw commands i run remotely against a >>>>> host's >>>>> bmc, and wanted to code them via the python bindings (so i can >>>>> more >>>>> frequent polling and then do further processing w/o forking >>>>> ipmitool >>>>> over and over). >>>>> >>>>> However the documentation is a bit sparse and i can't honestly >>>>> see how >>>>> do i construct some code to do this? >>>>> >>>>> So i have to ask, is emulating raw requests something viable >>>>> via >>>>> OpenIPMI? Is there any examples i can look at ? Even if it's >>>>> just in C, >>>>> i figure the python bindings are pretty thinly swig'ified, but >>>>> if i >>>>> could figure out if/how that's done, i'll tackle pythonifying >>>>> it >>>>> afterwards. >>>> >>>> Sure, that's easy. There is a file named "swig/python/sample.py" >>>> that has a sample of a python interface. I've also attached a >>>> little program that does a get device id command every 5 seconds. >>>> Run >>>> it with "sample2.py smi 0" to talk to the local interface. >>>> >>>> What are you trying to get, btw? OpenIPMI can do most of the >>>> interpretation work for you. >>>> >>>> -corey >>> > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure > contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and > makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Openipmi-developer mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/openipmi-developer ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Openipmi-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openipmi-developer
