Menu

#30 topaschart cut error

v1.0 (example)
closed
nobody
None
5
2025-10-30
2024-05-06
No

There appears to be a bug in topaschart script within the topaschart_v7.tar file, where line 412 "cat $NET | cut -d , -f 1-2,$Frame1cols-$Frame2cols >$NETFR" line, is giving errors on both an AIX and a RHEL 7 box, causing it to create an completely empty .html file

On the AIX box it is giving the error of "cut: 0653-135 The list arguments following the f option are not correct." on a RHEL 7 box it give an error of "cut: invalid decreasing range" "Try 'cut --help' for more information."

I am not sure if this is exactly the same or a slightly different problem than what was reported in https://sourceforge.net/p/nmon/discussion/985541/thread/58244fa8/ back on June 15th 2016.
the beginning of that is similar however I am not a sed: file.. unknown command error on my RHEL 7 box but I am getting both a "ssed: couldn't open file /tmp/topaschart.sed.7582: No such file or directory" and a "rm: cannot remove ‘/tmp/topaschart.sed.7582’: No such file or directory." errors

sed: couldn't open file /tmp/topaschart.sed.7582

Unfortunately the box I am getting the topas charts from does not run nmon and is an appliance that we are not allowed to install stuff into, so I can't configure it to created n-mon files, so I am stuck with the topaschart files.

Discussion

  • Nigel Griffiths

    Nigel Griffiths - 2024-05-06

    nmon is a default install with AIX and has been for more than a decade.
    So I have no idea how you are running AIX with no nmon install.
    Is this some ancient AIX level - thstmight explain the problem?

    As topaschart was working when released, the problem might be a new format with new AIX versions. Or you have mangled the file, sorry :-) Have you more than one problem file?
    Either way can you send me the topas file with the issues
    Cheers, nigelargriffiths@hotmail.com

     
    • Alexander Kohr

      Alexander Kohr - 2024-05-06

      Well it might be installed but we are not supposed to make the box do anything other than backup and set up printers. I will followup with the vendor on if we can start running collections that way as well, as the vendor is telling us it is not there software and it is either our disks or something else that we need to look into. hence me trying to analyze the topas files.
      I just securely sent you an example file.

      Additional Details. while the script still does not run correctly when I comment out line 412, the specific error goes away.

      This problem also appears with version 5 of topaschart as well as it also give the same cut error for line 412 is identical and produces the same errors. I know it is line 412 because when I comment it out the cut error goes away.

      I was doing a little more debugging and echo a bunch of variable to standard error and I see the script greps for "^LAN," in the $INPUT file, to eventually write to $NET and maybe the file format has been switched from a text file to a binary as when I grep the original topas file or the file that is the INPUT files (/tmp/topaschart.input.#....) for just LAN both return "Binary file" Filename "matches" Instead of data being sent into the the topaschart.net file which ends up being zero lines/k in size.

      debug checking parameters
      INPUT = /tmp/topaschart.input.10692
      post sed ... ORGINAL to INPUT
      INPUT - /tmp/topaschart.input.10692
      NET = /tmp/topaschart.net.10692
      integer columns = 0
      integer nets = 0
      integer KBcols = 2
      DEBUG integer Frame1cols = 3
      integer Frame2cols = 2
      cut: invalid decreasing range
      Try 'cut --help' for more information.

      ~/topaschart.folder]$ grep LAN /tmp/topaschart.input.10692
      Binary file /tmp/topaschart.input.10692 matches

      ~/topaschart.folder]$ wc -l /tmp/topaschart.net.10692
      0 /tmp/topaschart.net.10692

       
  • Nigel Griffiths

    Nigel Griffiths - 2024-05-06

    OK I ran the
    topasout -a yourfile.topas
    and the
    topaschart yourfile.topas.csv yourfile.html
    and it worked fine and the .html file displays the graphs correctly. Attached.
    I did this on AIX 7.2.5.

    Long shot - what does: which cut return?
    I am thinking that your $PATH is using open source (Linux) cut command.

     
    • Alexander Kohr

      Alexander Kohr - 2024-05-07

      Please remove this attachement from this case. I securely sent it to you, so that I didn't have to sanitize it for public view.

       
    • Alexander Kohr

      Alexander Kohr - 2024-05-07

      Okay based on your post I think the problems are user errors based on me not tripping the usage information or finding documentation making it clear as to how to use the program. I was unfortunetally running topas chart directly on the topasrec outputted .topas file not knowing I needed to do a topasout -a yourfile.topas to create a yourfile.topas.csv file. Base on this newfound knowledge when I converted the file on my aix box using topasout and run on the yourfile.topas.out it not suprising works without any cut errors on both my AIX and my linux box.

      Here are a few possible ways it might be clear to an end user that doesn't currently trip the usage issue to help them with this situation.

      1. Possible very early in the script test to see if the file is a binary file or not possibly using "file" command on the the input file and parse the output either looking for stuff that makes it clear the file not a binary files.
        Maybe have it accept the file as okay if after the colon it finds the exact phrase of "commands test" or "ASCII text." Or maybe have it reject the file if it finds the exact phrase of "data" or "ASCII text"
        regardless of which logic is used, have it tell the end users that the file is not of the correct format and output the Usage information that comes out when you run a bare topaschart or topas chart with a bad value.

      These are the outputs of my file on my .topas and topas.csv
      outputs of file myfilename.topas files.
      AIX:
      myfilename.topas: data or International Language text
      RHEL 7:
      myfilename.topas: data
      Outputs of file myfilename.topas.csv
      AIX:
      myfilename.topas.csv: commands text
      RHEL 7:
      myfilename.topas.csv: ASCII text

      1. Get a little more fancy with the previous and if the file type is binary, check if topasout exists on the box (e.g. for power linux and AIX boxes), and have it run topasout on the input file to make a .csv version of it replacing INPUT with that file and continue. If topas out does not exist, then error out that the files is not of the correct format and either tell them how explicitly in one line how to correct it or output the usage block.
      2. Add some documentation to both the start of the file basically explaining what the usage says about wanting a .csv file.

      3. Possibly add a topaschart_readme file to the tarball, explaining how to use the program and that it expects a topas csv file that can be ceated using topasout - yourfilename to create a usable yourfile.topas.csv

      4. Add some usage inforamtion to the sourceforge pages about how to use topaschart and what is expected.

      5. Regardles of the above due some data sanity checking mid script, or instance that the .topaschart.net.# topaschar.info.#,topaschart.netfr.#, topaschart.netkb.# and topaschart.tmp.# files are not empty/zero k in size. If they are zero k in size put up an error message that the input file apears to not be a properly formated topas.csv file and output the usage information to try to help the user.

      Not that it is needed but here is the output of the commands you wanted me to run.
      which cut
      /usr/bin/cut

      ls -al /usr/bin/cut
      -r-xr-xr-x 1 bin bin 7045 Jun 01 2015 /usr/bin/cut

      lslpp -w /usr/bin/cut
      File Fileset Type


      /usr/bin/cut bos.rte.edit File

      for the RHEL 7 linux box I attempted to run this on after AIX failed.
      ]$ which cut
      /usr/bin/cut

      ]$ ls -al /usr/bin/cut
      -rwxr-xr-x 1 root root 41584 Jul 21 2020 /usr/bin/cut

      ]$ yum provides cut
      ... {Removed for brevity yum updating caches}....

      coreutils-8.22-11.el7.x86_64 : A set of basic GNU tools commonly used in shell scripts
      Repo : rhel-7-server-rpms
      Matched from:
      Filename : /bin/cut

      ...{removed other core-utils versions for brevity No other packages available to the system provides cut}

      coreutils-8.22-24.el7_9.2.x86_64 : A set of basic GNU tools commonly used in shell scripts
      Repo : installed
      Matched from:
      Filename : /usr/bin/cut

       
  • Alexander Kohr

    Alexander Kohr - 2024-05-07

    As an aside, I think that topas chart v7 might be identifying itself as version 5 insteady of version 7 based on "export topaschart_version=5"

     
  • Nigel Griffiths

    Nigel Griffiths - 2024-05-07

    File deleted.
    I don't consider nmon files as a security problem - it is just performance data.
    But sorry if it caused you to worry.

    I think the topaschart web pages explains the process in sufficient detail.
    See https://nmon.sourceforge.io/pmwiki.php?n=Site.TOPASchart
    I cleaned it up a little (corrected the file name extensions) and put the topasout -a in bold.
    I will fix the version number on the next update.

    Thanks for your ideas above but I think that is overkill.

    Thank you for using topaschart

     
    • Alexander Kohr

      Alexander Kohr - 2024-05-07

      I don't know how I overlooked the bold type in the page you referenced, https://nmon.sourceforge.io/pmwiki.php?n=Site.TOPASchart, however I did. As I mentioned above, I don't think I am the first person to fall victim to trying to pump the binary file in, so it really may not be overkill to check for an reject binary files. Since this was our first time using this, I have created some internal documentation on using this so for my team this hopefully won't be a problem again.

       
    • Alexander Kohr

      Alexander Kohr - 2024-05-07

      Aslso thank you for making topaschart, its output is helpful for investigating issues that happened in the past.

       
  • Nigel Griffiths

    Nigel Griffiths - 2025-10-30
    • status: open --> closed
     
  • Nigel Griffiths

    Nigel Griffiths - 2025-10-30

    Improved the documentation.

     

Log in to post a comment.

MongoDB Logo MongoDB