<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Varun, thanks so much for your response.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I see that I can add to SensorTypeCodes in intel-ipmi-oem/include/sdrutils.hpp and that it will be used to match against the dbus sensor path.  How though do
 you recommend assigning the sensor event type to the sensor?  getSensorEventTypeFromPath() is currently hardcoded to “threshold” and I don’t see how I could determine it from the sensor path (the way they are currently implemented.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’d like my new sensors to be readable so I’m planning on adding a "xyz.openbmc_project.Sensor.Value” interface.  Also, I’d like phosphor-sel-logger to be able
 to match on changes to be able to automatically generate events so that I don’t need to embed IPMI specific information into the dbus-sensors module.  I think I need a dbus interface akin to "xyz.openbmc_project.Sensor.Threshold.Warning" that would instead
 be my assertion and deassertion event masks.  Do these interfaces and properties look reasonable?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">xyz.openbmc_project.Sensor.Discrete.Assertion<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">.AssertionAlarmMask<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">xyz.openbmc_project.Sensor.Discrete.Deassertion<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">.DeassertionAlarmMask<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">As always, if I’m re-inventing the wheel here and there’s an example that already exists that I can follow, please point me in the right direction.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Varun Sampat [mailto:varunsampat@gmail.com]
<br>
<b>Sent:</b> Friday, July 17, 2020 10:11 AM<br>
<b>To:</b> Patrick Voelker<br>
<b>Cc:</b> OpenBMC (openbmc@lists.ozlabs.org)<br>
<b>Subject:</b> Re: Discrete sensors for host error monitor signals<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi Patrick<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Though we don't use host-error-monitor at Twitter, we do have a number of discrete sensors implemented. I can provide some details that can hopefully help get you started.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I should mention though, the below steps are only applicable if you're using 'dbus-sensors' for your sensors and the phosphor-sel-logger.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">1. Include the 'intel-ipmi-oem' recipe in your package<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">2. In the 'intel-ipmi-oem' recipe, in the file called sdrutils.hpp, you will find a bunch of enumerated entries for different (threshold based) sensor types such as voltage, current etc. You can add discrete sensor type you want here, for
 example for CATERRs it probably would be of the type "processor" (0x07)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">3. You don't  necessarily need to add the discrete sensor to entity-manager (you can if you like). Instead, under dbu-sensors you need to create a service and add an interface for your sensor. We have implemented by adding code in dbus-sensors
 that has a list of event-only sensors and our code loops through and adds all of them. However to start out, you can just do it for a single discrete sensor by doing the following:<o:p></o:p></p>
</div>
<div style="margin-left:30.0pt">
<p class="MsoNormal">a. create a file (say processorerror.cpp) along the same lines as one of the existing sensor types<o:p></o:p></p>
</div>
<div style="margin-left:30.0pt">
<p class="MsoNormal">b. request a service name using "request->name"<o:p></o:p></p>
</div>
<div style="margin-left:30.0pt">
<p class="MsoNormal">c. register your object path and interface <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">The above file would essentially do nothing other than just create a dbus sensor.<o:p></o:p></p>
</div>
<div style="margin-left:30.0pt">
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">4. Create entries in the CMakeLists.txt file in dbus-sensors to build your .cpp file and make sure it corresponds with the sensor type you created in intel-ipmi-oem in step 2.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">5. Once the above step is done, if you build an image, you should see the sensor you created (say something like "/xyz/openbmc_project/sensors/processor/Processor_Error" ) if you do "ipmitool sdr elist all". The sensor will be created with
 a dynamically assigned sensor number just like all the threshold based sensors. However, instead of displaying a value like it would for a threshold sensor it will say "Event-Only". At this point your discrete sensor is created but doesn't really do anything<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">6. Now, in order to generate a SEL, we use the IpmiSelAdd method that is present in the sel-logger service:<o:p></o:p></p>
</div>
<div>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"># busctl introspect  xyz.openbmc_project.Logging.IPMI /xyz/openbmc_project/Logging/IPMI</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">NAME                                TYPE      SIGNATURE RESULT/VALUE FLAGS</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">org.freedesktop.DBus.Introspectable</span></b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> interface -         -       
     -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.Introspect                         method    -         s            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">org.freedesktop.DBus.Peer          </span></b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> interface -         -       
     -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.GetMachineId                       method    -         s            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.Ping                               method    -         -            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">org.freedesktop.DBus.Properties    </span></b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> interface -         -       
     -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.Get                                method    ss        v            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.GetAll                             method    s         a{sv}        -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.Set                                method    ssv       -            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.PropertiesChanged                  signal    sa{sv}as  -            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">xyz.openbmc_project.Logging.IPMI   </span></b><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> interface -         -       
     -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.IpmiSelAdd                         method    ssaybq    q            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">.IpmiSelAddOem                      method    sayy      q            -</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">As you can see above, the IpmiSelAdd method takes 6 arguments, 'ssaybq' as described in
<a href="https://dbus.freedesktop.org/doc/dbus-specification.html#type-system" target="_blank">
https://dbus.freedesktop.org/doc/dbus-specification.html#type-system.<br>
</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Looking at the code in phosphor-sel-logger where the IpmiSelAdd method is registered, we can see what the ssaybq arguments correspond to:<o:p></o:p></p>
</div>
<div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">ifaceAddSel->register_method(</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">       
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#B42419;background:#EEEEEE">"IpmiSelAdd"</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">, [](</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">const</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">
 std::string &message, </span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">const</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> std::string &path,</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">                        
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">const</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> std::vector<</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">uint8_t</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">>
 &selData,</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">                         </span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">const</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">bool</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> &assert,
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">const</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#2FB41D;background:#EEEEEE">uint16_t</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE"> &genId) {</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Based on this, we can directly call the method using busctl to test if a SEL is created for the discrete sensor. For example, for the sensor we created in step 5, we could do the following to generate a SEL:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="background:#EEEEEE">busctl call xyz.openbmc_project.Logging.IPMI /xyz/openbmc_project/Logging/IPMI xyz.openbmc_project.Logging.IPMI IpmiSelAdd ssaybq <message string> <sensor object path, i.e "/xyz/openbmc_project/sensors/processor/Processor_Error"> 
 <number of bytes in the event data vector, which in this case would be 3>  <event data vector>  < assert/de-assert yes/no>  <generator id, 0x0020 for bmc></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="background:white">(the first 4 arguments after 'call' are the service, object, interface and the method)</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">To give you an example, here is what the above command looks like for a discrete sensor for a power button press:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Command:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="background:#EEEEEE"># busctl call xyz.openbmc_project.Logging.IPMI /xyz/openbmc_project/Logging/IPMI xyz.openbmc_project.Logging.IPMI IpmiSelAdd ssaybq "SEL Entry" "/xyz/openbmc_project/sensors/pwr_button/POWER_BUTTON" 3 {0x00,0x01,0x00}
 yes 0x20</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Sel generated:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="background:#EEEEEE">f | 07/17/20 | 16:49:01 UTC | Button POWER BUTTON | Power Button pressed | Asserted</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">7. If you have a service that triggers on an event, you could directly call the above command to generate a SEL in your service file. For example, we have a gpio service that triggers on certain events and we directly call the above command
 from the service file. In other cases we call a method to generate the SEL in code in the event "handler" function. This might be more relevant for our host-error-monitor case. Here is an example from our code for how we call the IpmiSelAdd method:<o:p></o:p></p>
</div>
<div>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">sdbusplus::message::message writeSEL = conn->new_method_call(</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">            ipmiSelService, ipmiSelPath, ipmiSelAddInterface,
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#B42419;background:#EEEEEE">"IpmiSelAdd"</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">);</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">        writeSEL.append(ipmiSelAddMessage, dbusPath, eventData, assert, genId);</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;min-height:13px"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p> </o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">       
</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:#C1651C;background:#EEEEEE">try</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">        {</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt"><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">            conn->call(writeSEL);</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal">
<span style="font-size:8.5pt;font-family:"Menlo","serif";color:black;background:#EEEEEE">        }</span><span style="font-size:8.5pt;font-family:"Menlo","serif";color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Here, conn is the "shared_ptr". The other arguments are pretty much the same as described in the busctl command in #6.  Not sure how this would work with host-error-monitor but you can try it with the relevant shared_ptr in host_error_monitor.cpp
 and it might possibly work.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Hope this helps.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-Varun <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Jul 14, 2020 at 3:07 PM Patrick Voelker <<a href="mailto:Patrick_Voelker@phoenix.com" target="_blank">Patrick_Voelker@phoenix.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi, I’d like to log IPMI SEL events for changes in the signals monitored by OpenBMC/host-error-monitor.  I don’t have much experience with OpenBMC’s sensors yet so I’m not sure
 what the best approach is and am looking for some guidance.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I haven’t found a good example yet of a IPMI discrete sensor and I don’t want to put IPMI specific information into host-error-monitor to directly add SEL events via phosphor-sel-logger.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Here’s my understanding thus far :<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">* A module needs to instantiate dbus sensors representing the signals being monitored.  This could be done in host-error-monitor or duplicate some of the functionality in dbus-sensors. 
 Is there a benefit to extending one over the other?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">* One or more IPMI SDRs should be created for the IPMI sensors needed to group all the necessary discrete offsets.  If I’m using entity-manager in my build, is that where I would
 define this sensor?  If not, is there some other way to accomplish this?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">* phosphor-sel-logger then needs to monitor (match) dbus discrete sensor property changes to create appropriate IPMI and redfish logs for the events as they occur.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Does that sound about right? Thanks in advance for your help.<o:p></o:p></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</body>
</html>