12 Replies Latest reply on Mar 4, 2015 2:08 PM by Bill Robinson

    Compliance Rule Question

    Andreas Khan



      I'm trying to work out whether its possible to create a test under compliance in a component template that will check for the existence of a particular string in a configuration file.  I've added the conf file and conf file entry as parts to the template but there doesn't seem any way to check if the file or file entry contains a string.


      Any suggestions on how this may be best approached?



        • 1. Re: Compliance Rule Question

          One way to do it will be to create "Extended Object" as "Local Configuration Object",

          Execute a grep command as part of EO and create a compliance rule based on that command output.


          Sample command for reference : 

          count=`grep <string> <filename> | wc -l`;echo "count $count"

          • 2. Re: Compliance Rule Question
            Bill Robinson

            you can use the 'File' type (not configuration file) and the 'contains' operator.  if you use a 'config file' type you would do like:


            for each Configuration File Entry:some file//**

            if name = xxx

            then value1 contains yyy

            or value2 contains yyy




            or something like that.


            the 'contains' w/ the 'file' object type seems much easier.

            • 3. Re: Compliance Rule Question
              Joe Piotrowski

              Screenshots or more details make it easier for people to make recommendations.

              • 4. Re: Compliance Rule Question
                richard mcleod

                Try something like this

                First thing to do is live browse a server, view the conf file, note the columns (they might be Name, Value 1, Value 2, etc...)


                Note the columns of Name and the string you're looking for


                What I usually do for this is:



                config file entry//<name> exists


                config file entry//<name>.valueX as string equals <string>

                1 of 1 people found this helpful
                • 5. Re: Compliance Rule Question
                  Monoj Padhy

                  Bill and richard have already answered. Hope that will solve your problem. If you still face any problem then provide additional details as below.

                  which string you are trying to search in the configuration file?

                  file format of config file ?

                  what all combination you have tried so far ?

                  what is causing issue for you. any screen shot or rule would be helpful in understanding the issue here.

                  • 6. Re: Compliance Rule Question
                    Andreas Khan

                    Thanks All for the input.  Using the file type instead of configuration file type as Bill suggested solved the problem.


                    I have a related but new problem that I was wondering if I could get some similar advice for:  Basically I want to loop through Solaris Packages using the contains operator with a partial string - I've selected what looks like the correct properties to use [  "Solaris Package:*".Name   ] contains  - when tested against any string no results are yielded in the left or right hand side when running a test in discovery.  Any help appreciated

                    • 7. Re: Compliance Rule Question
                      Bill Robinson

                      foreach Solaris Package/*

                      if name contains xxx





                      • 8. Re: Compliance Rule Question
                        Andreas Khan

                        thx Bill - one detail I omitted is that I was trying to do this part in the discovery of the template.  foreach doesn't seem an option here?  is that correct

                        • 9. Re: Compliance Rule Question
                          Andreas Khan

                          Bill - the suggestion kind of works in compliance, other than the Solaris Package prop seem to just return the equivalent of pkginfo -c system.  we don't see any application packages in the returned results.  is that expected?

                          • 10. Re: Compliance Rule Question
                            Bill Robinson

                            what do you mean by 'application packages' ?

                            • 11. Re: Compliance Rule Question
                              Andreas Khan

                              I mean package category - the Solaris package info only seems to return packaging info with a category of SYSTEM which is equivalent of a  pkginfo -c system

                              • 12. Re: Compliance Rule Question
                                Bill Robinson

                                if i do a snapshot of the Packages object i see packages from other categories than 'system'.


                                pkglist is the csv export from my snapshot

                                grep -v "\"system\"" pkglist.csv

                                Configuration Manager Snapshot Export


                                Date: Mar 4, 2015

                                Snapshot Name: pkglist snap (jump01-82) - 2015/03/04 14:50:28-0500

                                Host: jump01-82

                                Object: Solaris Packages, Packages


                                Object Type,Name,Description,Version,Vendor,Category,Install Date,Size,


                                "Solaris Package List","PackagesSolaris Packages","","","","","","",

                                "Solaris Package","SUNWPython","The Python interpreter, libraries and utilities","2.3.3,REV=","Oracle Corporation","GNOME2,application,JDS3","2014/02/25 17:34","55 KB",

                                "Solaris Package","SUNWbdb","Database (sun-private shared component)","4.2.52,REV=1.0.12","Sun Microsystems, Inc.","application","2014/02/25 17:35","1 KB",

                                "Solaris Package","SUNWbdbj","Database (sun-private shared component)","4.2.52,REV=1.0.12","Sun Microsystems, Inc.","application","2014/02/25 17:35","1 KB",

                                "Solaris Package","SUNWctpls","This package contains the layout interface for language engines.","1.5,REV=2004.","Sun Microsystems, Inc.","CTL,system","2014/02/25 17:33","58 B",

                                "Solaris Package","SUNWwbapi","Solaris WBEM API","2.6,REV=2005.","Oracle Corporation","application","2014/02/25 17:34","1 KB",


                                and in the rules i can do this: