Compare files with different file name and size

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Compare files with different file name and size

Post by jaimefiallos »

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!
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

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?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

/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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

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.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

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?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

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/mfra ... tm#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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

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.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

>/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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

Thanks it's working now.

Anything we can do about error RMA 301 the size of the second file cannot exceed 8Mb?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

>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
jaimefiallos
Posts: 7
Joined: Mon Oct 30, 2017 12:09 pm

Post by jaimefiallos »

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?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

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
Post Reply