View previous topic :: View next topic |
Author |
Message |
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Fri Nov 03, 2017 5:48 pm Post subject: Compare files with different file name and size |
|
|
Hello!
Would like feedback on the best method to test the file size and contents for multiple files that have the same file name but have a date extension to differentiate them, for example: file1_20171103.xml, file2_20171103.xml, and file3_20171103.xml, and to alert when there are any differences.
At this moment have an RMA agent deployed on a Unix/Linux server.
Have been trying to use test methods Compare Files and Shell Script but haven't really gotten anywhere.
Any assistance is greatly appreciated! |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Fri Nov 03, 2017 6:57 pm Post subject: |
|
|
Please provide details
- HostMonitor version?
- RMA version?
- what exactly means trying to use test method Compare Files?
If you want to compare 3 files, then you need to setup 2 Compare Files test items.
E.g.
- one test to compare file1_%yyyymmdd%.xml and file2_%yyyymmdd%.xml
- another test to compare file1_%yyyymmdd%.xml and file3_%yyyymmdd%.xml
Have you enabled "Translate macros" option for both files?
Have you specified full path to the files?
What test status you see? Any error is Reply field of the test?
What exactly means trying to use test method Shell Script?
May we see your script?
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Tue Nov 07, 2017 3:23 pm Post subject: |
|
|
Hi Alex,
HostMonitor version: v. 10.54
RMA version: Linux 1.29
Translate macros have been enabled and full path specified.
With this particular case I would like to compare 2 files. If I specify the exact file name, the alert works, however in this case I would like to compare the files using a wildcard(*), for example:
/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml
/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml
but I get an RMA: 301 - File doesn't exist error.
Is there a correct way to specify the file name to compare? |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Tue Nov 07, 2017 4:55 pm Post subject: |
|
|
/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml ==
/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml
If wildcard will be resolved then program will compare the same file to itself so you have to specify file more correctly. If you don't know correct full name then you cannot compare
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Tue Nov 07, 2017 6:09 pm Post subject: |
|
|
Set up alert as alert when files are identical, compare size/contents
1st file: /home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml ==
2nd file: /home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_*.xml
and got RMA 301 error file doesn't exist. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Tue Nov 07, 2017 6:54 pm Post subject: |
|
|
I understand this.
What I am trying to say - even if we add support for wildcard (*) for Compare Files test, then test with settings you set will not work anyway because you want to compare file to itself (well, test will work and always will set "files identical" flag).
E.g. on_la_tv_programs_*.xml will be resolved to on_la_tv_programs_555.xml. What is the reason to compare on_la_tv_programs_555.xml and on_la_tv_programs_555.xml?
Its the same file.
If you want to compare 2 files, then you have to specify 2 different files using 2 different filenames.
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Fri Nov 10, 2017 11:55 am Post subject: |
|
|
Ok, let me phrase it this way. I would like to compare a range of files that have the same file name structure but differentiate slightly with an update value and date extension. For example:
$ /home/tlis/TLISpy/TLIS/xml
-rw-r--r--. 1 root root 584K Nov 8 09:03 on_la_tv_programs_parent_20171108.txt
-rw-r--r--. 1 root root 40K Nov 8 19:31 on_la_tv_programs-up1_parent_20171108.txt
-rw-r--r--. 1 root root 109K Nov 8 20:57 on_la_tv_programs-up2_parent_20171108.txt
-rw-r--r--. 1 root root 57K Nov 9 00:44 on_la_tv_programs-up3_parent_20171108.txt
What type of alert can I create that will notify me if any of these files are the same in terms of Contents and Size, and how do I configure the Test properties? |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Fri Nov 10, 2017 12:39 pm Post subject: |
|
|
HostMonitor does not offer alert that can compare files.
Alerts (actions)
http://www.ks-soft.net/hostmon.eng/index-actions.htm
There is Compare Files test method, but it cannot compare 4 files.
It can compare 2 files
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#filecmp
If you need to compare 4 files than you need to create 6 test items:
1) compare on_la_tv_programs_parent_%yyyymmdd%.txt and on_la_tv_programs-up1_parent_%yyyymmdd%.txt
2) compare on_la_tv_programs_parent_%yyyymmdd%.txt and on_la_tv_programs-up2_parent_%yyyymmdd%.txt
3) compare on_la_tv_programs_parent_%yyyymmdd%.txt and on_la_tv_programs-up3_parent_%yyyymmdd%.txt
4) compare on_la_tv_programs-up2_parent_%yyyymmdd%.txt and on_la_tv_programs-up1_parent_%yyyymmdd%.txt
5) compare on_la_tv_programs-up3_parent_%yyyymmdd%.txt and on_la_tv_programs-up1_parent_%yyyymmdd%.txt
6) compare on_la_tv_programs-up2_parent_%yyyymmdd%.txt and on_la_tv_programs-up3_parent_%yyyymmdd%.txt
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Fri Nov 10, 2017 1:00 pm Post subject: |
|
|
Configured Test method: Compare files to Alert when files are identical and disabled Translate macros.
1st file: /home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_parent_%yyyymmdd%.txt
2nd file:
/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs-up1_parent_%yyyymmdd%.txt
Getting Reply: RMA 301 File doesn't exist. |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Fri Nov 10, 2017 1:52 pm Post subject: |
|
|
>/home/tlis/TLISpy/TLIS/xml/on_la_tv_programs_parent_%yyyymmdd%.txt
>and disabled Translate macros
>Getting Reply: RMA 301 File doesn't exist.
You are using macro variables (%yyyymmdd%) and you disabled "Translate macros" option.
Please enable "Translate macros" option or do not use macros
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Mon Nov 13, 2017 1:41 pm Post subject: |
|
|
Thanks it's working now.
Anything we can do about error RMA 301 the size of the second file cannot exceed 8Mb? |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Mon Nov 13, 2017 2:01 pm Post subject: |
|
|
>Anything we can do about error RMA 301 the size of the second file cannot exceed 8Mb?
Use "files are different" or "files are identical" option instead of "1st file contains 2nd"
Regards
Alex |
|
Back to top |
|
|
jaimefiallos
Joined: 30 Oct 2017 Posts: 7
|
Posted: Mon Nov 13, 2017 4:45 pm Post subject: |
|
|
That would not work in this case since the purpose of the alert is to notify if the 2nd file has contents from the 1st. 2nd file should only have updated content.
Is there a way to increase or ignore this 8Mb threshold? |
|
Back to top |
|
|
KS-Soft
Joined: 03 Apr 2002 Posts: 12807 Location: USA
|
Posted: Tue Nov 14, 2017 1:56 pm Post subject: |
|
|
We have to change some code.
Please send your registration name (or order number) to support@ks-soft.net, we will see what can be done.
Also, please explain what exactly comparison do you need.
E.g.
if there are the following lines in File1:
AA
BB
CC
DD
and File2 looks like
BB
CC
DD
EE
then test status should be Ok?
if File2 looks like
BB
CC
DD
then test status should be Bad?
Regards
Alex |
|
Back to top |
|
|
|