Help with relevance clause

(imported topic written by SystemAdmin)

Hi,

I’m trying to author a fixlet that will execute an installation package for an application, if that application is not installed on the target system. We’re dealing with a variety of operating systems, and I’m currently looking at Linux.

As far as I can figure, the best way to determine if the package is installed is by looking at the output of ‘rpm’. I’m not sure how to express this as a relevance clause in the fixlet. The condition would need to be something like:

the exit code of “rpm -qa | grep ourapp” is 0

Does anybody have any advice as to how this could be achieved? Is there a better way to do it? Can anybody point me to some relevant documentation?

Thanks in advance,

Lachlan Hillman.

(imported comment written by Lee Wei)

We have most of the documentation relating to the Relevance Language here:

https://www.ibm.com/developerworks/mydeveloperworks/wikis/home?lang=en#/wiki/Tivoli%20Endpoint%20Manager/page/Fixlet%20Authoring

There is a Linux Inspector Guide which will have some of the inspectors, “objects” that you need on Linux.

The RPM inspector will provide some of the things you need.

By way of examples:

Q: names of packages of rpm

A: redhat-logos

A: basesystem

A: glibc

:

:

Q: names whose (it as lowercase contains “bes”) of packages of rpm

A: BESAgent

Q: exists packages whose (name of it as lowercase contains “besagent”) of rpm

A: True

These commands can be tested from the QnA utility that comes with all the Agents. On Linux, it is located at:

/opt/BESClient/bin

http://support.bigfix.com/cgi-bin/kbdirect.pl?id=347

Lee Wei

(imported comment written by SystemAdmin)

Thanks very much for the help. That is extremely helpful.

Another quick question, and I couldn’t seem to find anything on the Wiki, what’s the best way to distribute the installation package file to the endpoint systems? Currently I’m just adding the file to a CustomSite in the TEM console, which is distributing it to the endpoints, then I’m executing it. Is this how it should be done?

Also, is there some sort of macro or variable that points to the directory which contains the files that have been downloaded from a particular site? I’m currently just referencing it manually (/var/opt/BESClient/__BESData/CustomSite_XXX/) in the action script which I suspect is not the right way to do it.

Thanks. :slight_smile:

(imported comment written by C8GH_Prabhu_Missier)

adding my thoughts on this

On Windows we check for the existence of registry keys and also the existence of running services/applications. Linux should have inspectors to do the same.

For your 2nd query you need to obtain a masthead and create an external site probably under the specific domain where your application fits in.

(imported comment written by Lee Wei)

LachlanH

…what’s the best way to distribute the installation package file to the endpoint systems?

The best way is to create a Fixlet to distribute an installation package for you. A wizard is an automated Fixlet creation tool, which is what we have and what we can use for Linux.

In the TEM Console, go to the domain “All Content”, then folder Wizards -> RPM Patching -> RPM Deployment Wizard.

If you don’t have that, it is because you have not subscribed to the “Linux RPM Patching site”. The resulting Fixlet is a good example on how to distribute an RPM package.

(imported comment written by Lee Wei)

LachlanH

…is there some sort of macro or variable that points to the directory which contains the files that have been downloaded from a particular site? I’m currently just referencing it manually (/var/opt/BESClient/__BESData/CustomSite_XXX/) in the action script which I suspect is not the right way to do it.

Within an ActionScript, the brackets {} can use used to dynamically replace content.

Your folder can be dynamically generated using something like:

{client folder of site whose (name of it starts with “XXX”)}

Lee Wei

(imported comment written by SystemAdmin)

Hi,

Thanks everyone for the help.

I have a couple more questions:

  1. How can I subscribe to the “Linux RPM Patching” site? I’ve found the guide which explains how to use it, but not a download link for the masthead.

  2. I can’t seem to get the folder for my custom site in ActionScript. I tried what you suggested, slightly modified:

client folder of site whose (name of it as lowercase contains “xxx”)

but it didn’t seem to work. I get:

Singular expression refers to nonexistent object.

However if I search for the BES Support site:

client folder of site whose (name of it as lowercase contains “bes”)

I get the result I want. (The folder for my custom site

does

exist at the same level as the BES support site folder.)

Thanks,

Lachlan Hillman.

(imported comment written by Lee Wei)

LachlanH

  1. How can I subscribe to the “Linux RPM Patching” site? I’ve found the guide which explains how to use it, but not a download link for the masthead.

In version 8.0 and above, the site subscriptions are enabled by the licensing team at the backend. So contact the Licensing team to have this enabled base on your authorization.

(imported comment written by Lee Wei)

LachlanH

  1. I can’t seem to get the folder for my custom site in ActionScript.

Try using the relevance below to list the sites subscribed by the Client.

names of sites

(imported comment written by SystemAdmin)

Thanks for your help.

names of sites

produces the following:

Q: names of sites

A: BES Support

A:

A: actionsite

T: 105

Apparently my custom site doesn’t have a name. In the console my custom site is listed with the name I expect it to have.

The following will give me the folder I need:

client folder of site whose (name of it is “”)

Any idea what’s going on?

Thanks,

Lachlan Hillman.

(imported comment written by Lee Wei)

No idea what is going on.

Why don’t you create another custom site to see if this happens again.

If so, we can file a bug. What language environment are you in?

(imported comment written by SystemAdmin)

Lee Wei

No idea what is going on.
Why don’t you create another custom site to see if this happens again.
If so, we can file a bug. What language environment are you in?

Created another custom site with a different (longer) name. No luck. The agent is downloading the file I added to the site, but I’m getting the same list of sites (with the one empty name), and the folder query I did before is still returning the original custom site.

I’m in an English (Australia) language environment, in Windows where the BES server is running. The locale of the Linux system running the agent is en_US.

(imported comment written by SystemAdmin)

I have fixed the problem. It was user error, of course. I wasn’t running qna in the correct way (my BESClientConfigPath variable was not being set correctly).

Thanks for your help, Lee Wei.

(imported comment written by SystemAdmin)

I have another question for you. I’m trying to write a rather complex relevance clause, and brackets don’t seem to matter when it comes to conditionals. (i.e.

not this or (this and that)

)

Does the relevance language take brackets into account when it comes to conditionals? Is there some other way to do it?

Thanks,

Lachlan Hillman.

(imported comment written by Lee Wei)

Yes, the parentheses are important for order of processing.

q: true or (true and false)

A: True

q: (true or true) and false

A: False

For the relevance language, there is a concept of using order of processing to deal with errors:

(False) AND () = False

(True) AND () =

() AND (True/False) =

(True) OR () = True

() OR (True/False) =

(False) OR () =

(imported comment written by SystemAdmin)

That’s very helpful Lee Wei, thank you.

Here’s the relevance clause I’m trying to use:

(name of operating system does not contain “AIX”) or (not exists products whose (name of it is “OURPRODUCT”) of object repository)

This will evaluate to ‘true’ for an AIX machine that doesn’t have our product installed, but not for Red Hat machine. If the relevance clause is:

(name of operating system does not contain “AIX”)

Then the Red Hat machine shows up, as it should. This tells me that the first part of the conditional will evaluate to ‘true’ on Red Hat, which would equate (presumably) to the

(True) OR () = True

case you mentioned, but it’s not working on Red Hat. On Red Hat, QNA gives me:

E: The operator “object repository” is not defined.

Any idea what’s wrong, and how I can work around it?

Thanks,

Lachlan Hillman.

(imported comment written by Lee Wei)

You are getting the error because the Object Repository inspector does not exists on TEM Clients other than on AIX.

I don’t know what you intent to return from non-AIX computers, but here is something to try:

if (name of operating system does not contain “AIX”) then (true) else (not exists products whose (name of it is “OURPRODUCT”) of object repository)

In this case, the Object Repository clause will not be evaluated if non-AIX.

If you change the then-else clauses, the key is to make sure that both of them return the same datatype. In the example above, they are both Boolean.

Lee Wei

(imported comment written by SystemAdmin)

Lee Wei

For the relevance language, there is a concept of using order of processing to deal with errors:

(False) AND () = False
(True) AND () =
() AND (True/False) =
(True) OR () = True
() OR (True/False) =
(False) OR () =

There is a subtlety to this idea of dealing with errors using order of processing that lee way is talking about, which is causing your problem

In the cases Lee Wei mentioned, an is what you might call a run time error in another language. Basically the relevance expression is syntactically correct, though it may not work when its actually run. For example:

Q: (true) or (name of file “asdasdasd” = “test”)

A: True

T: 57.312 ms

Q: (false) or (name of file “asdasdasd” = “test”)

E: Singular expression refers to nonexistent object.

File “asdasdasd” doesn’t exist anywhere, so trying get its name will return an error. However using order of operations, the relevance engine will evaluate the first part of the expression and says “(true or (anything)) is always true, so dont even bother looking at the rest”

However there are some errors that would be what you might call a compilation error. The first thing the relevance engine does is parse the expression to make sure it makes sense. If it doesn’t it will throw an error before it even starts to process the specific sub expressions:

Q: (true) or (this_inspector_doesn’t_exist)

E: The operator “this_inspector_doesn’t_exist” is not defined.

In your case the “object repository” inspector doesnt exist on some OSes, so they will not parse correctly and just error out.

Lee Wei’s if/then/else trick will take care of this. I just found it fun to explain it all for some reason…

-Zak

(imported comment written by SystemAdmin)

Thanks very much Lee and Zak, that was very helpful (and solved my problems).

I have another question. Is there any way to give control of certain parameters (that are used in the execution of the fixlet) to administrators without requiring them to alter the fixlet action script?

For example, the fixlet I’m using executes a script that it needs to pass a hostname. Obviously this hostname will differ for each customer. How can I ‘set’ this hostname somewhere in the console without having to modify the fixlet?

Thanks,

Lachlan Hillman.

(imported comment written by Lee Wei)

Lachlan,

Can you please post the question to a new thread?

Thanks,

Lee Wei