I’m attempting to write a combined analysis that queries the rpm database and pkgdb for the version info of a given application. What I have works moderately well, but was wondering if there were room for improvement… The reason I say moderately well (and recognize the room for improvement) is because none of the Solaris boxes are returning information - I get a result of “” and the tool tip says that “The operator RPM is not defined” while on a few (but not all) Red Hat boxes I get a result of “” with a tool tip of “The operator PKGDB is not defined”.
Here’s the relevance I’m using:
if (exists rpm) then ((names of it, versions of it) of packages whose (name of it contains “httpd”) of rpm) else if (exists pkgdb) then (((names of it, versions of it) of pkginfo whose (name it contains “SUNWapch2”) of pkgdb)) else (“fubar”)
if (name of operating system contains “Linux”) then ((names of it, versions of it) of packages whose (name of it contains “httpd”) of rpm) else if (name of operating system contains “SunOS”) then (((names of it, versions of it) of pkginfos whose (name it contains “SUNWapch2”) of pkgdb)) else (“fubar”)
Then the hosts that were returning results start to error out with an “Incompatible Types” error. Also, if you’re wondering why I chose “Linux” and not “Red Hat” as the qualifier in the first half of the relevance, it’s because we also have some Fedora boxes that I’m wanting to keep tabs on as well as the RHEL boxes…
I had no idea there was a “nothings” operator… so that helped! Getting closer!
When I try this relevance:
if (name of operating system contains “Linux”) then ((names of it, versions of it) of packages whose (name of it contains “httpd”) of rpm) else if (name of operating system contains “SunOS”) then (((names of it, versions of it) of pkginfos whose (name it contains “SUNWapch2”) of pkgdb)) else nothings
The Solaris boxes now return a “” result with a message of “The operator “name” is not defined”. Also, on some of the RHEL boxes, I now get a return of “” with a message of “Singular expression refers to nonexistent object”.
Solaris is a typo: “name of it” rather than “name it”
On Linux, see if that “error” is because those boxes don’t have “rpm”. That is, create a test analysis of “exists rpm” and see if the boxes that return “false” are the same ones that return the error. Basically, you have to figure out what the “nonexistent” item is… your query is asking those boxes for “something” and the agent is telling you that thing isn’t there.