Unify multiple OS checks into one Analyses

(imported topic written by SystemAdmin)

I am trying to create an analyses that will check if a server is monitored by HPOV, SCOM or not monitored. I have this spread across Windows servers, Red Hat servers, and SunOS servers. This is my analysis:

if ((name of operating system as lowercase starts with 
"win2") AND (exists service 
"HealthService")) THEN 
"SCOM" ELSE 

if ((name of operating system as lowercase starts with 
"Linux Red") AND (exists 

package 
"HPOvCtrl" of rpm)) then 
"HPOV" 

if ((name of operating systems as lowercase starts with 
"SunOS") AND (exist pkginfo 
"HPovCtrl" of pkgdb)) then 
"HPOV" 

else 
"Not Monitored"

I’ve also tried:

if (((name of it as lowercase starts with 
"Win2"  as lowercase ) of operating system) AND (exists service 
"HealthService")) THEN 
"SCOM" ELSE 

if (((name of it as lowercase starts with 
"Linux Red"  as lowercase ) of operating system) AND (exists 

package 
"HPOvCtrl" of rpm)) THEN 
"HPOV" ELSE 

if (((name of it as lowercase starts with 
"Linux Red"  as lowercase ) of operating system) AND (exist pkginfo 
"HPovCtrl" of pkgdb)) THEN 
"HPOV" ELSE 
"Not Monitored"

The problem comes in with the operating system qualifier, it doesn’t seem to be working. It seems to ignore that part and attempts to check rpm and pckginfo It tries to check the relevance.

Any help would be appreciated.

(imported comment written by SystemAdmin)

OK We figured out the problem.

So anyone else trying to search for this here’s what happened:

The way I had it, it had to evaluate both the OS check and the monitoring check separately for TEM to evaluate the phrase. If it cannot evaluate both, an error spits out. So I have to do: if then if then else else

Like this:

if (name of operating system contains "Win2") then if (exists service "HealthService") then "SCOM" ELSE "Not Monitored" ELSE if (name of operating system contains "Linux") then if (exists package "HPOvCtrl" of rpm) then "HPOV" ELSE "Not Monitored" ELSE if (name of operating system contains "SunOS") then if (exist pkginfo "HPovCtrl" of pkgdb) then "HPOV" ELSE "Not Monitored" ELSE "Not Monitored"

It’s not pretty, but it certainly works.