Quantcast
Channel: Symantec Connect - ブログエントリ
Viewing all articles
Browse latest Browse all 5094

Make better filters: frontend (desktop/laptop) and backend (servers)

$
0
0
OS filtering

If you want to add two filters, to separate all the front end computers (desktops/laptops) from the back end computers (servers), follow these steps.

Step 1.

Create two extra values for "$filOsType" that aren't used yet. I chose 0800 and 0801.

Step 2.

Look in <SEPM Home>\Php\Include\Util\util.php.

Change lines 2637 - 2638 reading:

&& $filOsType!="0300"&& $filOsType!="0301"&& $filOsType!="0302"&& $filOsType!="0303"&& $filOsType!="0304"&& $filOsType!="0305"&& $filOsType!="0306"&& $filOsType!="0307"
	)){ die_elegantly("filOsType: $filOsType"); }

into:

&& $filOsType!="0300"&& $filOsType!="0301"&& $filOsType!="0302"&& $filOsType!="0303"&& $filOsType!="0304"&& $filOsType!="0305"&& $filOsType!="0306"&& $filOsType!="0307"&& $filOsType!="0800"&& $filOsType!="0801"
	)){ die_elegantly("filOsType: $filOsType"); }

Which makes the two extra options 0800 and 0801 available.

Step 3.

In <SEPM Home>\Php\Include\Common\Filter.php,

insert two new lines after line 348:

		$Ar['0000']=I18nInventory::translateInventory("DBDATA_OS_TYPE_0000");

resulting in:

		$Ar['0000']=I18nInventory::translateInventory("DBDATA_OS_TYPE_0000");
		$Ar['0800']=I18nInventory::translateInventory("DBDATA_OS_TYPE_0800");//All Windows Servers and Linux platform (backend)
		$Ar['0801']=I18nInventory::translateInventory("DBDATA_OS_TYPE_0801");//All Windows Client computers and Mac platform (frontend)

Step 4.

To prevent error in reporting.log reading "Value [a large number] out of range for destination", change file

<SEPM Home>\Include\Inventory\InventoryQueries.php

lines 889 from:

where SA.R_OS_TYPE=0 AND ".$where."  and SA.DELETED='0' and (SA.IS_NPVDI_CLIENT = 0 OR SA.STATUS = 1)

into:

where SA.R_OS_TYPE=0x0 AND ".$where."  and SA.DELETED='0' and (SA.IS_NPVDI_CLIENT = 0 OR SA.STATUS = 1)

or, in other words: change the value to compare the R_OS_TYPE with, from "0" to "0x0" (this means that it is not a decimal number, but a hexadecimal number).

And the same change in line 1024, from:

where SA.R_OS_TYPE=0 AND ".$where."  and SA.DELETED='0' and (SA.IS_NPVDI_CLIENT = 0 OR SA.STATUS = 1) ";//Defect 2236431: the where clause should be the same as function getComputerStatusLogQuery2.

to:

where SA.R_OS_TYPE=0x0 AND ".$where."  and SA.DELETED='0' and (SA.IS_NPVDI_CLIENT = 0 OR SA.STATUS = 1) ";//Defect 2236431: the where clause should be the same as function getComputerStatusLogQuery2.

Step 5.

Look in file <SEPM Home>\Php\Include\Util\UtilClass.php

Repair the two filters for Windows Server 2012 (isWindowsServer2012Condition) and Windows 8 (isWindows8Condition) and add the new filters.

So find in lines 34 - 52 reading:

        private $isWindowsServer2012Condition = " ((((SA.R_OS_TYPE & 0x00FFFF00)=0x00060200) OR ((SA.R_OS_TYPE & 0x00FFFF00)=0x00060300)) AND (
                                                   ((SA.R_OS_TYPE & 0xFF000000) 
                                                   in (0x4F000000, 0x07000000, 0x0D000000, 0x24000000, 0x28000000, 
                                                       0x50000000, 0x08000000, 0x0C000000, 0x27000000, 0x25000000,
														0x32000000, 0x0A000000, 0x29000000, 0x0F000000, 0x26000000,
														0x3B000000, 0x3C000000, 0x3D000000, 0x3E000000, 0x22000000,
														0x1E000000, 0x1F000000, 0x4C000000, 0x4D000000, 0x36000000,
														0x33000000, 0x37000000, 0x18000000, 0x23000000, 0x21000000,
														0x09000000, 0x3F000000, 0x38000000, 0x24000000, 0x28000000,		
														0x34000000, 0x35000000, 0x17000000, 0x14000000, 0x60000000,
														0x15000000, 0x5F000000, 0x16000000, 0x11000000)
                                            	    )))";

        private $isWindows8Condition = " (((SA.R_OS_TYPE & 0x00FFFF00)=0x00060200) OR ((SA.R_OS_TYPE & 0x00FFFF00)=0x00060300)
		                                    AND (((SA.R_OS_TYPE & 0xFF000000) in
										(0x04000000, 0x46000000, 0x54000000, 0x48000000, 0x0E000000,0x02000000,
											0x43000000, 0x05000000, 0x03000000, 0x44000000, 0x1A000000, 0x30000000,
											0x45000000, 0x31000000, 0x67000000,0x0B000000, 0x42000000, 0x2F000000,
											0x01000000, 0x47000000,0x1C000000,  0x65000000, 0x4A000000, 0x1B000000) )))";

and replace the lines with:

		private $isWindowsServer2008Condition = " ( (SA.R_OS_TYPE & 0x02FFFE00) = 0x02060000 ) ";

		private $isWindowsServer2012Condition = " ( (SA.R_OS_TYPE &	0x02FFFE00) = 0x02060200 ) ";

		private $isWindows8Condition = "
			( (SA.R_OS_TYPE &	0xFFFFFE00)
			  in (				0x04060200, 0x46060200, 0x54060200, 0x48060200, 0x0E060200, 0x02060200,
								0x43060200, 0x05060200, 0x03060200, 0x44060200, 0x1A060200, 0x30060200,
								0x45060200, 0x31060200, 0x67060200, 0x0B060200, 0x42060200, 0x2F060200,
								0x01060200, 0x47060200, 0x1C060200, 0x65060200, 0x4A060200, 0x1B060200
					)
			) ";

		// Empty, 0, so Linux OR
		// Linux platform OR
		// ( Windows server bit AND
		//   not Mac platform )
		private $isAnyBackEndCondition = "
			(	(SA.R_OS_TYPE = 0x0) OR
			  ( (SA.R_OS_TYPE & 0xF0FF0000)  = 0x20000000 ) OR
			  ( ( (SA.R_OS_TYPE & 0x02000000) != 0x0 ) AND
				( (SA.R_OS_TYPE & 0xFFFF0000) != 0x100A0000 )
			  )
			) ";
		
		// Not empty, 0, so no Linux AND
		// Not Linux platform AND
		// ( Mac platform OR
		//   No Windows server bit)
		private $isAnyFrontEndCondition = "
			(   (SA.R_OS_TYPE != 0x0) AND
			  ( (SA.R_OS_TYPE & 0xF0FF0000) != 0x20000000 ) AND
			  ( ( (SA.R_OS_TYPE & 0xFFFF0000)  = 0x100A0000 ) OR
				( (SA.R_OS_TYPE & 0x02000000)  = 0x0 )
			  )
			) ";

Furthermore a bit cosmetic change: move the syntax for '9999' or 'Windows Server 2008' to calling the function that you just defined.

Replace line 559 reading:

$queryOsType = " (((SA.R_OS_TYPE & 0x00FFF000)=0x060000) AND (((SA.R_OS_TYPE & 0x0F000000) = 0x02000000) OR ((SA.R_OS_TYPE & 0x0F000000) = 0x03000000) OR ((SA.R_OS_TYPE & 0xF000000) = 0xA000000) OR ((SA.R_OS_TYPE & 0xF000000) = 0x7000000) OR ((SA.R_OS_TYPE & 0xF000000) = 0x8000000) OR ((SA.R_OS_TYPE & 0xFF000000) = 0x24000000)))";

into:

$queryOsType = $this->isWindowsServer2008Condition;

And finally add the two new filter as extra cases, just before the default case. So change lines 639 - 641:

				break;
								
			default :

into:

				break;

			//Extra filters
			case '0800' : // All Windows Servers and Linux platform (backend)
				$queryOsType = $this->isAnyBackEndCondition;
				break;
			case '0801' : // All Windows Client computers and Mac platform (frontend)
				$queryOsType = $this->isAnyFrontEndCondition;
				break;

			default :

Viewing all articles
Browse latest Browse all 5094

Trending Articles