11 Replies Latest reply on Jul 19, 2017 7:34 AM by nitin muchate

    Collect Information from Linux system

    nitin muchate
      Share This:

      Hi,

       

      I want to collect data from .txt file which is kept on linux system.

      for example: i want to see the average cpu & ram utilised of linux box during Morning 10.00 AM to evening 5.00 PM. for that i am executing script to collect that information & store it on local linux system in ABC.txt format.

       

      now using Operational rule i want to read/ collect all data which is kept on linux system (.txt file) & want to show it in custom inventory.

       

      let me know how to achieve this scenario.

       

      Regards

      Nitin

        • 1. Re: Collect Information from Linux system
          nitin muchate

          I mean i just want to collect the data which is stored in text format on client device (Linux system) & need to populate in Inventory (Custom)

           

          Regards

          Nitin

          • 2. Re: Collect Information from Linux system
            Steve Gibbs

            You may want to follow the example I used to get NIC Cards.  The concept is the same.  You will need to use the STEP to use Regular Expression to collect this data.

             

            How to Collect the Physical Network Adapter HardwareID using Op Rule

             

            Hope this helps,

             

            Steve

            • 3. Re: Collect Information from Linux system
              nitin muchate

              Hi Steve,

               

              i have used two steps

               

              but getting error message... i have test file kept on root directory of linux system (/test.txt)1.PNG2.PNG

               

              2017/07/14 22:13:28 Linux data      I   [4131863440] Execution Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/14 22:13:28 Linux data     T   File to analyse: /test.txt

              2017/07/14 22:13:28 Linux data     T   Creating the file copy test.txt.copy...

              2017/07/14 22:13:28 Linux data      ERR [4131863440] Execution Phase: Step 0: custominvfindregexinfile.chl failed with error : _DB_STEPERROR_BADATTRSNUMBER_

              2017/07/14 22:13:29 Linux data      I   [4131863440] Undo Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/14 22:13:29 Linux data      I   [4131863440] Undo Phase: Step 0: custominvfindregexinfile.chl ended

              2017/07/14 22:13:29 Linux data      I   [4131863440] Undo Phase: Step 1: custinvupdate.chl starting

              2017/07/14 22:13:29 Linux data      I   [4131863440] Undo Phase: Step 1: custinvupdate.chl ended

              2017/07/14 22:13:29 Linux data      I   [4131863440] Cleanup Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/14 22:13:29 Linux data      I   [4131863440] Cleanup Phase: Step 0: custominvfindregexinfile.chl ended

              2017/07/14 22:13:29 Linux data      I   [4131863440] Cleanup Phase: Step 1: custinvupdate.chl starting

              2017/07/14 22:13:29 Linux data      I   [4131863440] Cleanup Phase: Step 1: custinvupdate.chl ended

              2017/07/15 00:41:30 Linux data      I   [3626015632] Verification Phase: Step 0: Skipping phase for custominvfindregexinfile.chl

              2017/07/15 00:41:30 Linux data      I   [3626015632] Verification Phase: Step 1: Skipping phase for custinvupdate.chl

              2017/07/15 00:41:30 Linux data      I   [4131863440] Execution Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/15 00:41:31 Linux data     T   File to analyse: /test.text

              2017/07/15 00:41:31 Linux data      ERR [4131863440] Execution Phase: Step 0: custominvfindregexinfile.chl failed with error : _DB_STEPERROR_FILENOTFOUND_

              2017/07/15 00:41:31 Linux data      I   [4131863440] Undo Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/15 00:41:31 Linux data      I   [4131863440] Undo Phase: Step 0: custominvfindregexinfile.chl ended

              2017/07/15 00:41:31 Linux data      I   [4131863440] Undo Phase: Step 1: custinvupdate.chl starting

              2017/07/15 00:41:31 Linux data      I   [4131863440] Undo Phase: Step 1: custinvupdate.chl ended

              2017/07/15 00:41:31 Linux data      I   [4131863440] Cleanup Phase: Step 0: custominvfindregexinfile.chl starting

              2017/07/15 00:41:31 Linux data      I   [4131863440] Cleanup Phase: Step 0: custominvfindregexinfile.chl ended

              2017/07/15 00:41:31 Linux data      I   [4131863440] Cleanup Phase: Step 1: custinvupdate.chl starting

              2017/07/15 00:41:31 Linux data      I   [4131863440] Cleanup Phase: Step 1: custinvupdate.chl ended

              • 4. Re: Collect Information from Linux system
                Steve Gibbs

                The first step is configured wrong.  Those default values are required to be changed to match the text file you want added to custom inventory.  I always use this website to assist me in making my RegEx rules:

                https://regex101.com/

                 

                If you want help, please attach the file that is generated that you want parsed.  Will ALL output files be consistent or will some have more data than others?

                • 5. Re: Collect Information from Linux system
                  nitin muchate

                  Hi Steve,

                   

                  The output file is a simple text file which contains CPU Usage max, CPU usage Average, Memory usage max & Memory usage average.

                  i have attached the same here. and we have to achive it on linux system.... client is having only linux system.

                   

                  Regards

                  Nitin MuchateCapture.PNG

                  • 6. Re: Collect Information from Linux system
                    Steve Gibbs

                    Nitin Muchate,

                     

                    I do not see anything but a screenshot, no attached file. I could try to recreate it that file but to be sure I do it correctly the actual output file would be much better.  Could you email it to me? Steve.Gibbs@rightstar.com

                     

                    I will provide solution to your request within 24 hours of receiving file.

                     

                    Thanks,

                     

                    Steve

                    • 7. Re: Collect Information from Linux system
                      Steve Gibbs

                      Nitin Muchate,

                       

                      Okay, Is this what you want?

                       

                       

                      I have created the Op Rule and a Report...  I have attached to this post.

                       

                      You may want to modify rule to delete previous entries unless you want to keep trend values.

                      • 8. Re: Collect Information from Linux system
                        nitin muchate

                        Thanks Steve,

                         

                        Yes you have done exact what we require..

                        Thank you very much for your kind support ..

                         

                         

                        Regards

                        Nitin

                        • 9. Re: Collect Information from Linux system
                          nitin muchate

                          Hi Steve,

                           

                          if same thing want to do on windows system, then what need to be change. i have tested same OR only changed file path as C:\Test.* but getting error message that OR failed.

                           

                          Regards

                          Nitin

                          • 10. Re: Collect Information from Linux system
                            Steve Gibbs

                            Nitin,

                             

                            You need to be sure that the file on Linux is exactly the same file on Windows...  RegEx is absolute in parsing values.  The reason I used a wild card is because on one post you said the file name is test.txt and another was test.text...  I played it safe!

                            • 11. Re: Collect Information from Linux system
                              nitin muchate

                              Hello Steve,

                               

                              the file is exactly the same which is kept on linux server. but still facing issue ... i will troubleshoot more & let you know my findings.

                               

                              Regards

                              Nitin