Topic
  • 22 replies
  • Latest Post - ‏2013-01-21T18:51:20Z by SarahGalvan
SarahGalvan
SarahGalvan
18 Posts

Pinned topic Retrieving Packages with Session Relevance

‏2012-10-22T15:40:43Z |
Is it possible to retrieve the package names/versions of RedHat (or other distribs) packages with Session Relevance?
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-10-23T18:47:33Z  
    I have tried the following on linux (RH6, Ubuntu 10.x) computers without result:

    (names of items 0 of it, values of results(item 0 of it, item 1 of it)) of (bes computers whose (operating system of it as lowercase starts with "linux"), bes properties whose (name of it ends with "Package List"))
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-05T16:23:54Z  
    I have tried the following on linux (RH6, Ubuntu 10.x) computers without result:

    (names of items 0 of it, values of results(item 0 of it, item 1 of it)) of (bes computers whose (operating system of it as lowercase starts with "linux"), bes properties whose (name of it ends with "Package List"))
    With Lifecycle's Analysises enabled I have had great luck with getting package names using the following:

    
    ( values of (results of it) ) of bes properties whose ( name of it = 
    "Packages Installed - Linux" )
    


    BUT how do I get the version information for each package?
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-05T17:55:28Z  
    With Lifecycle's Analysises enabled I have had great luck with getting package names using the following:

    <pre class="jive-pre"> ( values of (results of it) ) of bes properties whose ( name of it = "Packages Installed - Linux" ) </pre>

    BUT how do I get the version information for each package?
    Hi Sarah,

    Session Relevance is reporting on data already collected by the TEM Clients.
    "Packages Installed - Linux" is a property of the "Application Information (Linux)" analysis from the "BES Inventory and License" site.

    The Client Relevance is the following and it apparently is not retrieving the version information.
    if not exists rpm then "<no rpm database>" else unique values of names of packages of rpm

    So we will have to first create a property using Client Relevance to extract the data, before we can use Session Relevance to report on it.

    The Client Relevance can be something like:
    
    
    
    if not exists rpm then 
    "<no rpm database>" 
    
    else unique values of (name of it & 
    "|" & version of it as string) of packages of rpm
    


    After clients report theirs values, you can use the Session Relevance as you had.

    
    ( values of (results of it) ) of bes properties whose ( name of it = 
    "Packages Installed with Version- Linux" )
    


    Lee Wei
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-05T18:30:28Z  
    • Lee Wei
    • ‏2012-11-05T17:55:28Z
    Hi Sarah,

    Session Relevance is reporting on data already collected by the TEM Clients.
    "Packages Installed - Linux" is a property of the "Application Information (Linux)" analysis from the "BES Inventory and License" site.

    The Client Relevance is the following and it apparently is not retrieving the version information.
    if not exists rpm then "<no rpm database>" else unique values of names of packages of rpm

    So we will have to first create a property using Client Relevance to extract the data, before we can use Session Relevance to report on it.

    The Client Relevance can be something like:
    <pre class="jive-pre"> if not exists rpm then "<no rpm database>" else unique values of (name of it & "|" & version of it as string) of packages of rpm </pre>

    After clients report theirs values, you can use the Session Relevance as you had.

    <pre class="jive-pre"> ( values of (results of it) ) of bes properties whose ( name of it = "Packages Installed with Version- Linux" ) </pre>

    Lee Wei
    So the property you are describing has to be created manually? There is no analysis precanned to retrieve this information available for any TEM product?

    Thank you for the response, by the way. You have no idea how long I have been trying to figure this out.
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-06T02:08:24Z  
    So the property you are describing has to be created manually? There is no analysis precanned to retrieve this information available for any TEM product?

    Thank you for the response, by the way. You have no idea how long I have been trying to figure this out.
    Sorry to hear that you had been searching a while for an answer!

    It is actually quite easy to create a property if have not tried one before.

    • If you are a Console Admin
    • Use TEM Console menu Tools --> Manage Properties
    • Then click the "Add New" button

    You can give the property the name I suggested above and paste in the Client Relevance code.

    I don't know of a TEM solution that will make this any easier than to just create it ourselves.

    Lee Wei
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-10T01:01:55Z  
    • Lee Wei
    • ‏2012-11-06T02:08:24Z
    Sorry to hear that you had been searching a while for an answer!

    It is actually quite easy to create a property if have not tried one before.

    • If you are a Console Admin
    • Use TEM Console menu Tools --> Manage Properties
    • Then click the "Add New" button

    You can give the property the name I suggested above and paste in the Client Relevance code.

    I don't know of a TEM solution that will make this any easier than to just create it ourselves.

    Lee Wei
    I followed your instructions, but <not reported> appears under its entry in Custom Properties. I have sent refreshes and waited days.
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-12T14:40:53Z  
    I followed your instructions, but <not reported> appears under its entry in Custom Properties. I have sent refreshes and waited days.
    I assume that this is because the client has not checked-in (the checked-in stamp confirms this). I turned on the machine and am clicking "send refresh" in hopes it will update. I'll wait a bit and if nothing else works will bug the forum again.

    http://www-01.ibm.com/support/docview.wss?uid=swg21505835
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-12T18:17:42Z  
    I assume that this is because the client has not checked-in (the checked-in stamp confirms this). I turned on the machine and am clicking "send refresh" in hopes it will update. I'll wait a bit and if nothing else works will bug the forum again.

    http://www-01.ibm.com/support/docview.wss?uid=swg21505835
    That particular problem is solved. Is there a way to get them back as more than one value? so I can reference the name by item 0 and the version by item 1?
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2012-11-12T19:00:17Z  
    That particular problem is solved. Is there a way to get them back as more than one value? so I can reference the name by item 0 and the version by item 1?
    Here is an example statement that you might be able to use:

    
    (  name of computer of it, preceding texts of firsts 
    "|" of values of it, following texts of firsts 
    "|" of values of it ) of results from (bes computers whose (operating system of it as lowercase starts with 
    "linux")) of (bes properties whose (name of it = 
    "Packages Installed with Version- Linux"))
    
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-07T16:58:24Z  
    • Lee Wei
    • ‏2012-11-12T19:00:17Z
    Here is an example statement that you might be able to use:

    <pre class="jive-pre"> ( name of computer of it, preceding texts of firsts "|" of values of it, following texts of firsts "|" of values of it ) of results from (bes computers whose (operating system of it as lowercase starts with "linux")) of (bes properties whose (name of it = "Packages Installed with Version- Linux")) </pre>
    This worked fantastically! I need to perform some optimization and only send these queries when I know in advance that the queried computer most likely has an RPM database.

    At the time of the query, I have the OS property value (e.g. Linux Red Hat Enterprise Server 6.3 ...) available for my consideration. If I could get a list of possible OS values (not from what's on the network, but some kind of master list if it exists) I could only query if it matches one that I know to be RPM based.

    Does a master list of OS property values exist?
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-07T19:35:59Z  
    This worked fantastically! I need to perform some optimization and only send these queries when I know in advance that the queried computer most likely has an RPM database.

    At the time of the query, I have the OS property value (e.g. Linux Red Hat Enterprise Server 6.3 ...) available for my consideration. If I could get a list of possible OS values (not from what's on the network, but some kind of master list if it exists) I could only query if it matches one that I know to be RPM based.

    Does a master list of OS property values exist?
    We don't have a master list of all possible OS values.
    However, you can generate one for your environment using the following Session Relevance.

    
    unique values of values of results of bes property whose (name of it = 
    "OS" and reserved flag of it)
    


    For Linux only values:

    
    unique values whose (it as lowercase contains 
    "linux") of values of results of bes property whose (name of it = 
    "OS" and reserved flag of it)
    


    Lee Wei
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-14T19:02:17Z  
    • Lee Wei
    • ‏2013-01-07T19:35:59Z
    We don't have a master list of all possible OS values.
    However, you can generate one for your environment using the following Session Relevance.

    <pre class="jive-pre"> unique values of values of results of bes property whose (name of it = "OS" and reserved flag of it) </pre>

    For Linux only values:

    <pre class="jive-pre"> unique values whose (it as lowercase contains "linux") of values of results of bes property whose (name of it = "OS" and reserved flag of it) </pre>

    Lee Wei
    I appreciate all the help you've been providing! You have no idea how useful it has been. I imagine this will be a great resource for other people walking in my shoes.

    How would I do the same for apt based distros like Debian (and family)?
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-14T19:43:57Z  
    I appreciate all the help you've been providing! You have no idea how useful it has been. I imagine this will be a great resource for other people walking in my shoes.

    How would I do the same for apt based distros like Debian (and family)?
    Regarding Debian, you can use the Relevance that shows all the operating systems, and look for the ones belonging to Debian.
    Then replace "linux" with something unique to Debian.

    Lee Wei
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-14T21:30:13Z  
    • Lee Wei
    • ‏2013-01-14T19:43:57Z
    Regarding Debian, you can use the Relevance that shows all the operating systems, and look for the ones belonging to Debian.
    Then replace "linux" with something unique to Debian.

    Lee Wei
    Sorry, I should have been more specific. I meant package retrieval.
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-14T23:58:55Z  
    Sorry, I should have been more specific. I meant package retrieval.
    The equivalent RPM inspector for Debian is "debianpackage".
    So an example would be:

    
    
    
    if not exists debianpackage then 
    "<no debian package database>" 
    
    else unique values of ( name of it & 
    "|" & (
    
    if (exists version of it) then (version of it as string) 
    
    else (
    "No version info")) ) of packages of debianpackages
    
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-15T18:05:36Z  
    • Lee Wei
    • ‏2013-01-14T23:58:55Z
    The equivalent RPM inspector for Debian is "debianpackage".
    So an example would be:

    <pre class="jive-pre"> if not exists debianpackage then "<no debian package database>" else unique values of ( name of it & "|" & ( if (exists version of it) then (version of it as string) else ( "No version info")) ) of packages of debianpackages </pre>
    Thanks for the response! Unfortunately your code (verbatim) doesn't seem to work on operating systems without Debian packages.

    > The operator "debianpackage" is not defined.

    Is there a way to check for the availability of the operator WITHOUT consulting the OS string?
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-15T18:29:27Z  
    Thanks for the response! Unfortunately your code (verbatim) doesn't seem to work on operating systems without Debian packages.

    > The operator "debianpackage" is not defined.

    Is there a way to check for the availability of the operator WITHOUT consulting the OS string?
    You are right that the the inspector DebianPackage does not exist on other OSes.
    So we should use the operating system string to run only on systems that are Ubu/Debian distros.
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-15T18:47:03Z  
    • Lee Wei
    • ‏2013-01-15T18:29:27Z
    You are right that the the inspector DebianPackage does not exist on other OSes.
    So we should use the operating system string to run only on systems that are Ubu/Debian distros.
    Is there any way to check if an operator exists?

    As I said, as a design requirement I need to at all costs avoid using lists that need to be updated/maintained (like OS strings as new ones are encountered or created). Some level is required, of course, but if there is a way to check if an operator exists or some sneaky way to go about it, then that'd be highly preferred.
  • Lee Wei
    Lee Wei
    599 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-15T19:26:19Z  
    Is there any way to check if an operator exists?

    As I said, as a design requirement I need to at all costs avoid using lists that need to be updated/maintained (like OS strings as new ones are encountered or created). Some level is required, of course, but if there is a way to check if an operator exists or some sneaky way to go about it, then that'd be highly preferred.
    Sorry that there is no way to check for the existence of an operator that I know of.
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-16T20:57:14Z  
    • Lee Wei
    • ‏2013-01-15T19:26:19Z
    Sorry that there is no way to check for the existence of an operator that I know of.
    Perhaps I can do this through checking file existence. For example, if /etc/apt exists or something similar for rpms. Maybe the rpm binary.
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-17T20:19:42Z  
    Perhaps I can do this through checking file existence. For example, if /etc/apt exists or something similar for rpms. Maybe the rpm binary.
    Are you sure there is no way of getting a list of inspectors?

    Is there a list of OSes supported by these inspectors? I can't just look at what's on my network as that isn't the target. It will end up on several networks of unknown OSes. Hence trying to avoid listing OSes, if there is not actually a list of them.

    Thank you.
  • SarahGalvan
    SarahGalvan
    18 Posts

    Re: Retrieving Packages with Session Relevance

    ‏2013-01-21T18:51:20Z  
    Are you sure there is no way of getting a list of inspectors?

    Is there a list of OSes supported by these inspectors? I can't just look at what's on my network as that isn't the target. It will end up on several networks of unknown OSes. Hence trying to avoid listing OSes, if there is not actually a list of them.

    Thank you.
    Is this in the spirit of what you were recommending?

    
    
    
    if not (name of operating system as lowercase starts with 
    "linux") then 
    "<unsupported>" 
    
    else 
    
    if (operating system as lowercase contains 
    "Debian" or operating system as lowercase contains 
    "Ubuntu") then unique values of (name of it & 
    "|" & (
    
    if (exists version of it) then (version of it as string) 
    
    else (
    "No version info"))) of packages of debianpackages 
    
    else 
    
    if (exists rpm) then unique values of (name of it & 
    "|" & version of it as string) of packages of rpm 
    
    else 
    "<unsupported>"