10 Replies Latest reply on May 1, 2019 6:55 AM by Bill Robinson

    BLCLI get server services

    Abigail O'Riordan
      Share:|

      Hello,

      I would like to get information about some services running in an specific server. That is, this info:

       

       

      I know about this post, where it explain how to get a value from the server Live information.

      Find virtual machines in BladeLogic Server Automation Version: 8.9.02.329

       

      There they use the path in bold. But I don't undestand the logic to get there.

       

      serverKey=`blcli Server getServerDBKeyByName ESTRC1WLAPP001`

      uri=`blcli GenericObject getRESTfulURI ${serverKey}`

      out2=`blcli Get "${uri}/Assets/SystemInfo/System/AssetAttributeValues/Model"`

        • 1. Re: BLCLI get server services
          Bill Robinson

          the services listing is populated by the 'winsvc' command:

          %nexec win12r2-893 winsvc -l

          STOPPED AeLookupSvc Application Experience,

          STOPPED ALG Application Layer Gateway Service,

          STOPPED AppIDSvc Application Identity,

          STOPPED Appinfo Application Information,

          STOPPED AppMgmt Application Management,

          STOPPED AppReadiness App Readiness,

          STOPPED AppXSvc AppX Deployment Service (AppXSVC),

          STOPPED AudioEndpointBuilder Windows Audio Endpoint Builder,

          STOPPED Audiosrv Windows Audio,

          RUNNING BFE Base Filtering Engine,

          STOPPED BITS Background Intelligent Transfer Service,

          1 of 1 people found this helpful
          • 2. Re: BLCLI get server services
            Abigail O'Riordan

            Thanks Bill R.,

             

            Obviously this is the easiest/fastest/simplest way.

            And thanks to NSH, I can grep the output:

             

            SERVER% nexec -i -e winsvc -l | grep -i "WinRM"

            RUNNING WinRM Windows Remote Management (WS-Management),

            1 of 1 people found this helpful
            • 3. Re: BLCLI get server services
              Greg Michael

              Since the winsvc command is an internal component to the RSCD agent, it is obviously not documented.  Beyond the -l switch that displays the Status, Service Name, and Display Name of services, are there any other switches that can be utilized?

               

              For example, if I wanted to use a different field separator to make it easier to parse the output, is there such an option?

              If I wanted to include other fields not normally displayed in the -l output, is there such an option?

               

              Thanks!

              • 4. Re: BLCLI get server services
                Bill Robinson

                you can list, start, stop. 

                win16-894% nexec -e winsvc -v -k W32Time 

                OK: Service stopped

                win16-894% nexec -e winsvc -v -s W32Time

                OK: Service started

                 

                you can't format the output differently w/ the command.  if you need to do that probably nexec'ing some powershell or cmd would do it.

                1 of 1 people found this helpful
                • 5. Re: BLCLI get server services
                  Greg Michael

                  Thanks Bill.  Is there a UNIX-based equivalent to winsvc?

                  • 6. Re: BLCLI get server services
                    Bill Robinson

                    for that there is a blcli call (or rest):

                    # blcli_execute Server getServerDBKeyByName blapp894.example.com

                    # blcli_storeenv serverKey

                    # blcli_execute GenericObject getRESTfulURI ${serverKey}

                    # blcli_storeenv uri

                    #blcli_execute Get "${uri}/Assets/BMC_UnixDaemons/" | xmllint --format -

                     

                     

                    <?xml version="1.0" encoding="UTF-8"?>
                    <RESTXMLResponse>
                      <AssetChildrenResponse>
                        <AssetChildren>
                          <Assets totalCount="9">
                            <Asset name="initd:blappserv" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blappserv" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:blappserv" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blappserv/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[2(S99),3(S99),4(S99),5(S99)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:blappserv" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blappserv/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:blprocserv" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blprocserv" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:blprocserv" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blprocserv/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[2(K05),3(K05),4(K05),5(K05)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:blprocserv" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blprocserv/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:blpxe" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blpxe" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:blpxe" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blpxe/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[2(K05),3(K05),4(K05),5(K05)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:blpxe" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:blpxe/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:bltftp" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:bltftp" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:bltftp" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:bltftp/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[2(K05),3(K05),4(K05),5(K05)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:bltftp" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:bltftp/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:netconsole" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:netconsole" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:netconsole" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:netconsole/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[0(K50),1(K50),2(K50),3(K50),4(K50),5(K50),6(K50)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:netconsole" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:netconsole/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:network" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:network" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:network" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:network/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[0(K90),1(K90),2(S10),3(S10),4(S10),5(S10),6(K90)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:network" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:network/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:rhnsd" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rhnsd" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:rhnsd" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rhnsd/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[0(K03),1(K03),2(S97),3(S97),4(S97),5(S97),6(K03)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:rhnsd" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rhnsd/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="initd:rscd" type="BMC_UnixDaemon" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rscd" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="4">
                                <AssetAttributeValue name="Dependencies" type="List [String]" value=""/>
                                <AssetAttributeValue name="Name" type="String" value="initd:rscd" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rscd/AssetAttributeValues/Name"/>
                                <AssetAttributeValue name="Run Levels" type="List [String]" value="[2(S90),3(S90),4(S90),5(S90)]"/>
                                <AssetAttributeValue name="Path" type="String" value="/initd:rscd" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/initd:rscd/AssetAttributeValues/Path"/>
                              </AssetAttributeValues>
                            </Asset>
                            <Asset name="Open Connections" type="BMC_UnixListeners" description="" version="89030000" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/Open Connections" modelType="GENERIC_OBJECT" modelTypeId="6030">
                              <AssetAttributeValues totalCount="2">
                                <AssetAttributeValue name="Path" type="String" value="/Open Connections" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/Open Connections/AssetAttributeValues/Path"/>
                                <AssetAttributeValue name="Name" type="String" value="Open Connections" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/Open Connections/AssetAttributeValues/Name"/>
                              </AssetAttributeValues>
                            </Asset>
                          </Assets>
                          <AssetAttributeValues totalCount="2">
                            <AssetAttributeValue name="Path" type="String" value="/" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/AssetAttributeValues/Path"/>
                            <AssetAttributeValue name="Name" type="String" value="BMC_UnixDaemons" uri="/id/SystemObject/Server/59cd4431-484a-444e-8124-ebcc71975175/Assets/BMC_UnixDaemons/AssetAttributeValues/Name"/>
                          </AssetAttributeValues>
                        </AssetChildren>
                      </AssetChildrenResponse>
                    </RESTXMLResponse>
                    

                     

                    that gives you what the 'Daemons' object.  now, for redhat for example, we don't show systemd services.  in that case i'd just nexec whatever lists out the services on the target - 'chkconfig' or 'systemctl', etc.

                    1 of 1 people found this helpful
                    • 7. Re: BLCLI get server services
                      Greg Michael

                      Any idea why system services are not visible?  I would not have realized that looking at the services/daemons list in TSSA.

                      • 8. Re: BLCLI get server services
                        Bill Robinson

                        for redhat 7 ? 

                        what do you mean by 'system services' ? can you provide an example ?

                        • 9. Re: BLCLI get server services
                          Greg Michael

                          So, looking at a RHEL 6 server compared against a RHEL 7 Daemons list, the RHEL 7 has 6 initd daemons listed, whereas the RHEL 6 box has significantly more.  Is this simply an enhancement that has yet to be implemented, or is this a shortcoming of Live Browsing?

                          • 10. Re: BLCLI get server services
                            Bill Robinson

                            right - in rhel 7 they changed init systems to 'systemd'.  the 'daemons' object only works w/ the sysv init services.  right now to get the systemd list you'd need to make an extended object that runs something like:

                             

                            nexec -i -l ??TARGET.NAME?? sh -c "systemctl list-unit-files --type=service --no-pager --no-legend"