Skip to main content

No SNMP, no log files. How to monitor ?

Thread needs solution

Hi,

we are backing up an ESXi server and the AMS console is installed in a Linux VM.

Until version 11.7 Acronis products have SNMP support. In 12 o 12.5 there are no SNMP support. Why an enterprise product doesn't have SNMP support ?

In version 12 we are reading the file /var/lib/Acronis/AMS/client-activity.0.log to monitor our backup tasks. In 12.5 the file is empty.

How to get the task activity log ? Can be enabled as log file ? How ?

Thanks

Josep

 

0 Users found this helpful
frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

The support for SNMP notifications (internal ID: ABR-126696) is currently planned for Acronis Backup 12.5 Update 1 which is planne for the end of summer this year. This functionality will be the same as it was in 11.7.

Update: possible solution to track activities can be found in my below comment in this thread.

Thank you.

Hi,

what we must do in the meantime ?

Are there some text log files that can be monitored like the client-activity.0.log in version 12 ?

Josep

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

I'm checking with developers on possible solutions for the task you described. Currently the activities are stored in Management Server database and there is no simply way to parse through this DB via some text parser, but we want to create Python scripts to simplify the process. Once I get more details I'll update the thread.

Thank you.

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Here are the additional details: the information about executed activities and their status can be retrieved via "acropsh" utility with "dmldump" function. You can do the following:

1) Create a text file with name 'spec' file with the following contents (all bolded lines) in it and save:

{
    'pattern': [
      ('^Is', 'string', 'Tol::History::Plain::Activity'),
      ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
      ('.State', 'dword', 5),
    ],
    'options': [
      ('.Mask.Period', 'nil', None),
      ('.Mask.Details.BackupPlanName', 'nil', None),
      ('.Mask.Details.MachineName', 'nil', None),
      ('.Mask.CompletionResult', 'nil', None),
    ]

2) Run "acropsh" tool in C:\Program Files\Acronis\PyShell\bin\ folder on AMS machine and issue the below commands for various results:

NOTE: <LOGIN> and <PASSWORD> values are required only if acropsh is connecting to remote AMS service. If AMS is running on the same machine, then these parameters may not be used.

Download all activities at once:

$> acropsh -m dmldump -s ams <LOGIN> <PASSWORD> -vf <path to 'spec' file>

Monitor all completed activities as soon as they are finished (they will appear on the screen):

$> acropsh -m dmldump -s ams <LOGIN> <PASSWORD> -vf <path to 'spec' file> -dw news

The output will look as follows:

<report id='855E01DD-8772-14DF-6611-765C31933ED4' action='1'>
[
    ('.CompletionResult', 'error', ('Success', 'AQ==')),
    ('.Details.BackupPlanName', 'string', 'Files/folders to C:\\'),
    ('.Details.MachineName', 'string', 'WIN-MBEI40US3K2'),
    ('.DmlTimeStamp', 'sqword', 197),
    ('.ID', 'guid', '8CD52186-06C6-4E40-B645-DE1C594518FB'),
    ('.ID^PrimaryKey', 'nil', None),
    ('.ID^Type', 'string', 'Tol::History::Plain::Activity'),
    ('.Period.CreationTime', 'sqword', 1496948402),
    ('.Period.FinishTime', 'sqword', 1496948412),
    ('.Period.StartTime', 'sqword', 1496948402),
    ('.State', 'dword', 5),
    ('^Is', 'string', 'Tol::History::Plain::Activity'),
    ('^Source', 'string', '20BF7F12-5E33-40AA-9458-DC8BFFE1E10D'),
]
</report>

Where,

CompletionResult - the result of activity execution (success/error)
Details.BackupPlanName - name of the backup plan
Details.MachineName - name of the backed up machine
Period.XXXX - the time of activity creation/start and completion in unix timestamp format

Please let me know if you need some additional details (clarify which ones you miss) - the dmldump function is quite powerful and can get all possible data from AMS on demand.
 

Thank you.

Hi Vasily,

setting up a root cron job like :

@reboot /bin/sleep 60; sudo /usr/sbin/acropsh -m dmldump -s ams -vf /<path to spec>/spec -dw news > /var/log/AcronisAMS.log&

writes automatically a log file with the new activities . But the multiline format is dificult to parse for our system.

There are any chance to change the output format to resemble more a log file ?

Ex: timestamp+Job name+activity+result (in the same line)

Thanks

Josep

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

As far as I've confirmed with our developers, this output format cannot be changed unfortunately, so these outputs should be parsed separately to get the form you need (for example via grep + awk).

Thank you.

@Vasily Semyonov  can you please provide new FTP credentials to download the "spec" file? the details in this thread do not work. I need to integrate Acronis 12.5 with N-Able for remote monitoring, is this the preferred method? how far off in SNMP that you mentioned would be in Update 1?

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Since FTP links will be expiring, I'll leave the contents of the "spec" file here. You can create an empty text file, then put the below contents (all bolded lines) in it and save:

{
    'pattern': [
      ('^Is', 'string', 'Tol::History::Plain::Activity'),
      ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
      ('.State', 'dword', 5),
    ],
    'options': [
      ('.Mask.Period', 'nil', None),
      ('.Mask.Details.BackupPlanName', 'nil', None),
      ('.Mask.Details.MachineName', 'nil', None),
      ('.Mask.CompletionResult', 'nil', None),
    ]

What concerns enabling SNMP notifications in Acronis Backup 12.5 (internal ID ABR-126696) - it's currently planned for the beginning-middle of the next year (Update 3 or 4). Sorry for not bringing good news here :(

Thank you.

@Vasily Semyonov, appreciate the prompt reply, this is working and we are getting some output however it is a historic output therefore the returned information appears to be getting increasingly longer.

Are there any variables/switches we can use to only return the latest job status? or can we limit the scope using the spec file, i.e limit the scope to the last 1 hour? and then we can run the script hourly.

for example, can we limit the Mark.Period?

Mask.Period, 'sqword',60 - i tried a few combinations however doesn't seem to be changing the output.

{
    'pattern': [
      ('^Is', 'string', 'Tol::History::Plain::Activity'),
      ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
      ('.State', 'dword', 5),
    ],
    'options': [
      ('.Mask.Period', 'nil', None),
      ('.Mask.Details.BackupPlanName', 'nil', None),
      ('.Mask.Details.MachineName', 'nil', None),
      ('.Mask.CompletionResult', 'nil', None),
    ]

appreciate any further support you can offer.

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Please find below a script which prints the results of activities for the past 1 hour (there are also comments present which should let you adjust the outputs to your needs). Save the bolded text into a *.py file and execute it via "acropsh" utility, for example: acropsh print_last_activities.py

import acrort
import time
import datetime

spec = acrort.dml.ViewSpec(
    pattern=acrort.plain.Unit(
        flat=[
            ('^Is', 'string', 'Tol::History::Plain::Activity'),
            ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
            ('.State', 'dword', 5),
            ('.Period.FinishTime', 'sqword', 0),
            # This value is unix timestamp
            # We want to get objects, where FinishTime is greater than (current time - 1 hour)
            ('.Period.FinishTime^Greater', 'sqword', int(time.time()) - 3600), 
        ]
    ),
    options=acrort.plain.Unit(
        flat=[
            ('.Mask.Period', 'nil', None),
            ('.Mask.Details.BackupPlanName', 'nil', None),
            ('.Mask.Details.MachineName', 'nil', None),
            ('.Mask.CompletionResult', 'nil', None),
        ]
    )
)

conn = acrort.connectivity.Connection('ams') # Second parameter can be tuple with login/passowrd: Connection('ams', ('user', 'password'))

objects = conn.dml.select(spec)
for obj in objects:
    print('Machine name:', obj.Details.MachineName.ref)
    print('Backup plan name:', obj.Details.BackupPlanName.ref)
    print('Finish time:', datetime.datetime.fromtimestamp(obj.Period.FinishTime.ref))
    print('CompletionResult:', obj.CompletionResult.ref, end='\n\n')
    # Or you can print whole object:
    # print(obj)

Thank you.

Hi Vasily.

 

I'm struggling to get it to run, see error below, are you able to advise what the issue is? with the copy/paste I had to fix some indentations but other than that it looks like it should work.

C:\>acropsh pythin.py
Traceback (most recent call last):
  File "pythin.py", line 29, in <module>
    objects = conn.dml.select(spec)
acrort.Exception: Error 0xf90004: Dml::AsyncServer::State::JobPool
| line: 0x20f14f64de1eccac
| file: k:\7641\enterprise\common\dml\messaging\async_server.cpp:242
| function: Dml::Messaging::AsyncServer::State::State
| $module: management_server_vsa64_7641
|
| error 0x1350001: bad spec! unsupported trait 'Greater' on filter 'FinishTime',
 origin: k:\7641\enterprise\pybind\runtime\src\dml.cpp:772
| line: 0x22c440d1af43f2e3
| file: k:\7641\enterprise\common\tol\tm_supp\convert.cpp:1004
| function: Tol::ViewSpecToQueryArgs
| $module: management_server_vsa64_7641

C:\>

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

We're reviewing the script with our developers and I'll update the thread (likely tomorrow during the day) once we manage to get it corrected.

Thank you.

Hi Vasily,

 

one of my collegues made some changes, programmed some error checking and we removed the greater than x-time, rather we only print the last values for the latest job.

 

it works great and is clean output, if you want i can share on monday once cleaned up.

 

can you confirm what product versions will work with the script? Is it limited to 12.5?

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Thank you for the update. The "greater" parameter was supposed to limit the output down to "last hour" events, and we planned to adjust the script to give these outputs. If you can share the script your colleague created, that would be great so that we can validate if it's really returning the "last result" values and not something else.

The script will work for Acronis Backup 12 and above versions (not for 11.7).

Thank you.

Hi,

Short question, can this script which generate an Output also be run on a Linux machine where the arconis Agent is installed? Normally it should be possible to collect all the activitys from the AMS remotely from another Client.

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Yes, the script is OS independent - it's executed by "acropsh" tool, which is available on both Linux and Windows versions of Acronis Management Server. In Linux it's placed under /usr/sbin/ directory so you should be able to run it without specifying the full path.

Thank you.

In reply to by truwrikodrorow…

Hi,

 

Thanks for your answer.

 

I checked on a Linux machine were the Agent that the acropsh is available. So then i can collect with your script all the activitys from the Acronis Management Server or can your script only directly run on the Acronis Management Server?

We would like to execute it not directly on the Management Server.

 

Hi Vasily,

 

really appreciate your support and yes, I would still like the alternative of printing last hour as then I will have more control over the output. For N-Central dashboard/integration, we only need to poll it and return last job results. so in effect last hour or parsing the last jobs results from the job history and printing that also works for our use case. ill share the script now as there is interest on the forum but I would still like to get your further improved script for further testing from your team. 

The only changes made was, we put the error checking in, as after removing the time value it was getting stuck on a job name "value does not exist" and was stopping at that point, the error checking just allowed it to skip over that.

Additionally a change was made to only print the last set of the output.

This is the output you get.

C:\acropsh\lastjob.py
Machine name: ICT101-AV.DOMAIN.COM
Backup plan name: Entire machine to \\10.100.100.25\ict101\Acronis
Finish time: 2017-08-30 18:57:32
CompletionResult: Success

 

This is the modified script below.
____________________________________________________________

import acrort
import time
import datetime

spec = acrort.dml.ViewSpec(
     pattern=acrort.plain.Unit(
         flat=[
             ('^Is', 'string', 'Tol::History::Plain::Activity'),
             ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
             ('.State', 'dword', 5),
          ]
     ),
     options=acrort.plain.Unit(
         flat=[
             ('.Mask.Period', 'nil', None),
             ('.Mask.Details.BackupPlanName', 'nil', None),
             ('.Mask.Details.MachineName', 'nil', None),
             ('.Mask.CompletionResult', 'nil', None),
         ]
     )
 )

conn = acrort.connectivity.Connection('ams')

objects = conn.dml.select(spec)

only_last  = True

if only_last == True:
     obj = objects[-1]
     try:
         print('Machine name:', obj.Details.MachineName.ref)
     except:
         print('Machine name error')
     try:
         print('Backup plan name:', obj.Details.BackupPlanName.ref)
     except:
         print('Backup plan name error')
     try:
         print('Finish time:', datetime.datetime.fromtimestamp(obj.Period.FinishTime.ref))
     except:
         print('Finish time error')
     try:
         print('CompletionResult:', obj.CompletionResult.ref, end='\n\n')
     except:
         print('CompletionResult error')
else:
    for key, obj in enumerate(objects):
         print(key)
         #if key == 8:
         #   import pdb; pdb.set_trace()
         try:
             print('Machine name:', obj.Details.MachineName.ref)
         except:
             print('Machine name error')
         try:
             print('Backup plan name:', obj.Details.BackupPlanName.ref)
         except:
             print('Backup plan name error')
         try:
             print('Finish time:', datetime.datetime.fromtimestamp(obj.Period.FinishTime.ref))
         except:
             print('Finish time error')
         try:
             print('CompletionResult:', obj.CompletionResult.ref, end='\n\n')
         except:
             print('CompletionResult error')

 

Hi,

Can you send me the ftp link with user and Password. the above link seems not be worked.

 

br

Michael

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

I've consulted with our developers and found that the current version of "acropsh" tool allows executing scripts which can be run only locally, since remote connection capability (which was enabled once and then disabled) was considered as a potential security breach. Therefore you'll need an SSH client to connect to your AMS machine in order to run the "acropsh" tool with scripts.

The "spec" file contents (which was on FTP) are available in plain text in my comment above. I've posted them here to avoid problems in future, since FTP links will be expiring.

Thank you.

In reply to by truwrikodrorow…

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Rhys, thank you for the update - we will review your script and I'll advise accordingly if there are any potential issues with it.

Thank you.

Hi Vasily,

 

Anyway can you send me the script part in which the remote connection was built in?

 

Thanks you,

 

br

Michael 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

It's not possible I'm afraid, since the "acropsh" is dependent on particular builds of Acronis Backup and the change I mentioned was made a very long time ago, so the version where it was possible won't work with the current Acronis Backup 12.5 builds.

Can you please clarify the scenario where you would need to run acropsh remotely? For reporting purposes you can for example schedule its execution on AMS side which will generate the outputs on some shared resource (as an alternative to remote connection).

Thank you.

In reply to by truwrikodrorow…

Hi,

Ok Thanks,

I execute the script local on the AMS but it is only Show me only one old backup plan. We have configured about 30 plans. Do i have to modify the script or use Special Options?

image

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

If you're using the script posted by Rhys above, then it's correct output, as it shows the result of only 1 last activity. The script which will allow to track the activities for some pre-defined period (for last X hours/days for example) is being prepared on our side, and I'll post it here once we get it.

If you're using "acropsh -m dmldump -s ams <LOGIN> <PASSWORD> -vf <PATH_TO_SPEC_FILE>" command, then it will dump _all_ activities ever executed (e.g. historical activities as desribed in my above comment).

Thank you.

Hi,

Thx, but is still strange...

 

The backup of the hg-rhevm runs at latest on 31.August 2017. on 3am in the morning. The Output from the script Show the backup of 2017-03-06

image

br

Michael

Hi Vasily.

 

This is the cleaned up version of the script with comments. it also allows you to print all output or just last job assuming jobs are listed in time date order. if we can combine this with your ability to limit scope by time its a good combo and flexible for all users.

_______________________________________________

import acrort
#import time
import datetime
import sys

def main(cmd_argv=None):
    """
    Main function called by running this script from the console.
   
    Setting the only_last variable to True prints only the last item in the
    conn.dml.select(spec) list.  Setting to False prints out all the items in
    the conn.dml.select(spec) list.
   
    This assumes that the list conn.dml.select(spec) is already date sorted
    and therfore the last item is the latest.
   
    Use the command line argument 'all' to output all items, e.g.:
    C:\>acropsh python.py all
    Where 'python.py' is the file name of this script.
   
    """
   
    only_last  = True
    # If the command line argument "all" is used then all items are printed out.
    try:
        if str(cmd_argv) == "all":
            only_last = False
    except:
        pass

    spec = acrort.dml.ViewSpec(
        pattern=acrort.plain.Unit(
            flat=[
                ('^Is', 'string', 'Tol::History::Plain::Activity'),
                ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
                ('.State', 'dword', 5),
                ('.Period.FinishTime', 'sqword', 0),
                # This line currently stops the script with with error message:
                # "... unsupported trait 'Greater' on filter ..."
                # This value is unix timestamp
                # We want to get objects, where FinishTime is greater than (current time - 1 hour)
                #('.Period.FinishTime^Greater', 'sqword', int(time.time()) - 3600),
            ]
        ),
        options=acrort.plain.Unit(
            flat=[
                ('.Mask.Period', 'nil', None),
                ('.Mask.Details.BackupPlanName', 'nil', None),
                ('.Mask.Details.MachineName', 'nil', None),
                ('.Mask.CompletionResult', 'nil', None),
            ]
        )
    )
    conn = acrort.connectivity.Connection('ams')
    objects = conn.dml.select(spec)
   
    # Output the full list or only the last item.
    if only_last:
        obj = objects[-1]
        output(obj)
    else:
        for obj in objects:
            output(obj)

def output(obj):
    """
    Prints the data to the console.
   
    Due to occasional missing variable within obj, passing each into a try to
    prevent exception error stopping the function.
   
    """
   
    try:
        print('Machine name:', obj.Details.MachineName.ref)
    except:
        print('Machine name error:', sys.exc_info()[0])
    try:
        print('Backup plan name:', obj.Details.BackupPlanName.ref)
    except:
        print('Backup plan name error:', sys.exc_info()[0])
    try:
        print('Finish time:', datetime.datetime.fromtimestamp(obj.Period.FinishTime.ref))
    except:
        print('Finish time error:', sys.exc_info()[0])
    try:
        print('CompletionResult:', obj.CompletionResult.ref, end='\n\n')
    except:
        print('CompletionResult error:', sys.exc_info()[0])

if __name__ == "__main__":
    # If you call this script from the command line (the shell) it will
    # run the 'main' function
    # Passes only the first argument from the command line into the function.
    if len(sys.argv) > 1:
        main(sys.argv[1])
    else:
        main()

 

 

Hi,

 

I tried again to get the last Events from the last hour and i also tried the new script with the "ALL" function.

 

We started a backup i finish on September 01 on 10:23AM.

image

Ten minutes later we execute the script on the MgmtServer.

 

It still Shows an more then 4month old backup Job.

image

 

If i execute the script with the ALL Option it prints out about 100 backup Job also very old from the past (11.5 and 11.7 Version). But never the actual Jobs from the last day since we are using the Acronis 12.5 Version.

 

Could it be that the acropsh try to connect internally in a wrong database?

 

br

Michael

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

There is always a single AMS database used, so connection to "outdated" DB is likely not the case. Can you please post the exact script you're using? I'm still unsure which script you refer to.

Thank you.

Hi,

 

Find it below...

Could it be that the timestamp formats given older data back to the Output?

This is really strange becasue the all script Options Shows about 100 backups older from May of this year.

But never the backup Jobs form the last days or the backup Jobs from today.  So the script is working itself to generate Output but not the actual Jobs.

 

import acrort
#import time
import datetime
import sys

def main(cmd_argv=None):
 """
     Main function called by running this script from the console.
   
     Setting the only_last variable to True prints only the last item in the
     conn.dml.select(spec) list.  Setting to False prints out all the items in
     the conn.dml.select(spec) list.
   
     This assumes that the list conn.dml.select(spec) is already date sorted
     and therfore the last item is the latest.
   
     Use the command line argument 'all' to output all items, e.g.:
     C:\>acropsh python.py all
     Where 'python.py' is the file name of this script.
   
 """
   
 only_last = True
 # If the command line argument "all" is used then all items are printed out.
 try:
  if str(cmd_argv) == "all":
   only_last = False
 except:
  pass

 spec = acrort.dml.ViewSpec(
         pattern=acrort.plain.Unit(
             flat=[
                 ('^Is', 'string', 'Tol::History::Plain::Activity'),
                 ('.Details.CommandID', 'guid', 'D332948D-A7A9-4E07-B76C-253DCF6E17FB'),
                 ('.State', 'dword', 5),
                 ('.Period.FinishTime', 'sqword', 0),
                 # This line currently stops the script with with error message:
                 # "... unsupported trait 'Greater' on filter ..."
                 # This value is unix timestamp
                 # We want to get objects, where FinishTime is greater than (current time - 1 hour)
                 #('.Period.FinishTime^Greater', 'sqword', int(time.time()) - 3600),
             ]
         ),
         options=acrort.plain.Unit(
             flat=[
                 ('.Mask.Period', 'nil', None),
                 ('.Mask.Details.BackupPlanName', 'nil', None),
                 ('.Mask.Details.MachineName', 'nil', None),
                 ('.Mask.CompletionResult', 'nil', None),
             ]
         )
     )
 
 conn = acrort.connectivity.Connection('ams')
 objects = conn.dml.select(spec)
   
     # Output the full list or only the last item.
 
 if only_last:

  obj = objects[-1]
  output(obj)
 else:
  for obj in objects:
   output(obj)

def output(obj):
 """
     Prints the data to the console.
   
     Due to occasional missing variable within obj, passing each into a try to
     prevent exception error stopping the function.
   
 """
  

 try:
  print('Machine name:', obj.Details.MachineName.ref)
 except:
  
  print('Machine name error:', sys.exc_info()[0])

 try:
  print('Backup plan name:', obj.Details.BackupPlanName.ref)
 except:
  print('Backup plan name error:', sys.exc_info()[0])
 try:
  print('Finish time:', datetime.datetime.fromtimestamp(obj.Period.FinishTime.ref))
 except:
  print('Finish time error:', sys.exc_info()[0])
 try:
  print('CompletionResult:', obj.CompletionResult.ref, end='\n\n')
 except:
  print('CompletionResult error:', sys.exc_info()[0])

if __name__ == "__main__":
     # If you call this script from the command line (the shell) it will
     # run the 'main' function
     # Passes only the first argument from the command line into the function.
     if len(sys.argv) > 1:
         main(sys.argv[1])
     else:
         main()

 

 

 

 

 

 

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

I've checked your script on my test environment and it properly generates the output showing the result of the most recent completed job (or all jobs if "all" parameter is specified), so indeed the issue could be related to some specifics of your AMS installation (may be upgrade from 11.7 is causing the problem). To analyze I'll need to check Acronis system report captured from the AMS system (see https://kb.acronis.com/content/58301 - collecting info from Management Server). I'll send you an FTP link in a private message where you can upload the data for analysis.

Thank you.

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

The link should be already in your message box: please check at https://forum.acronis.com/user .

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

Please find below the script which produces the list of activities completed within the last hour (the period is adjustable). This script does not depend on the AMS database location (so the problem reported by Michael should no longer be present) and retrieves data directly through RestAPI interface by interacting with "Acronis TaskManager" component responsible for activities execution.

I've also uploaded it to the following FTP (found how to make the link expire in 3 months, rather than in 45 days so it should be ok for now): https://access.acronis.com/t/epu78deo   LINK UPDATED (start it as usual, for example: "acropsh print_last_hour_activities.py > output.txt" ).

# Script start

 

import requests
import dateutil.parser

from datetime import datetime, timedelta

# We can't filter out activities by direct 'finish_time' filter in url, because it is not supported.
# To workaround it, request 100 most recent activities and throw away old objects manually
r = requests.get('http://127.0.0.1:30677/api/task_manager/v1/activities?state=completed&t…-
253DCF6E17FB&order=completed_at.desc&limit=100')
if r.status_code != requests.codes.ok:
    print(r.text)
else:
    activities = r.json()['items']
    last_hour = datetime.utcnow() - timedelta(hours=1) # The "hours" parameter defines the period for tracking activities
    for activity in activities:
        finish_time = dateutil.parser.parse(activity.get('finishTime')).replace(tzinfo=None)
        if finish_time < last_hour:
            continue

        print('Machine name:', activity.get('agentName'))
        print('Backup plan name:', activity.get('details', {}).get('BackupPlanName'))
        print('Start time:', activity.get('startTime'))
        print('Finish time:', activity.get('finishTime'))
        print('CompletionResult:', activity.get('status'), end='\n\n')

# Script end

Note: the full list of activity parameters which can be added to "print" outputs (such as 'startTime', 'finishTime', etc. bolded above) can be checked right from Acronis Backup web console UI if you select activity->Details->check "All Properties". This would allow you to print errors details as well:

AvailableFields.PNG

Thank you.

Hi,

Thanks for this script!

One question to it, is it possible that you can give me an option to set the timeframe in minutes, instead of hours: last_hour = datetime.utcnow() - timedelta(hours=1)

 

br

Michael

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Michael,

In this string you can also use "minutes" parameter, for example

 last_hour = datetime.utcnow() - timedelta(minutes=1440)

...will give you the list for the past 1 day = 24 h = 1440 minutes.

Thank you.

Hi Vasily!

Is it possible to access the api from another host - localhost is windows and scripting would be easier on another linux box.

 

Thank you,

Günhter

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

It's not possible to run this script remotely, since the function (requests.get) used in it is accessible only from AMS side, so you cannot run "acropsh" on another remote machine and connect to AMS. There are also other technical restrictions for doing so - see my comments above. In other words you should run the "acropsh" utility always on AMS machine.

Thank you.

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi,

SNMP support is currently planned only for the end of this year (internal feature ID: ABR-83030), so I'm afraid it's still a long way to go.

Thank you.

Hi Vasily,

 

From the phyton script you provide us the activieties will be queried. We have seen that the Alert are different from the activities on a backup plan.

Is there a way to query the Alerts too?

 

We found that the REST Interface also offers a possibility to query the active alerts by analyzing the Web Gui. The Web Gui uses the following Request:

 

http://localhost:9877/am/api/1/playbook/call/active_alerts3?limit=5&client_id=1&tenant=00000000-0000-0000-0000-000000000000&tenant_locator=%2F00000000-0000-0000-0000-000000000000%2F

 

  1. Do you have any documentation about this request and the parameters that can be used for this request ?

 

  1. Can we query all active alerts by using this request?

 

  1. What Is the value of the ‘limit’ parameter to use if we want all active alerts ?

 

So please provide us some hints to also query the Alerts which can be shown in the WebGui.

 

 

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi Michael,

We have created a Python script which will list all the active alerts - please see attached. The example output from this script would be as shown below. Note that the exact text of the alert cannot be retrieved this way so you'll have to rely on the bolded line to get the alert type.

The example below is from alert thrown while cancelling backup task which backs up C:\Program Files (x86) Files\ + C:\\Program Files (x86) Explorer\ folders contensts into c:\Backups\ folder on machine named "Hostname".

[

('.DmlTimeStamp', 'sqword', 1),

('.ID', 'guid', '2EDEE7BE-BC2E-4A6D-BF8B-4EAF363C1F37'),

('.ID^PrimaryKey', 'nil', None),

('.ID^Type', 'string', 'Alerts::Object'),

('.Meta.ActivityID', 'guid', '966F77F2-2228-4401-B26B-58CE4EBD9DC9'),

('.Meta.BackupLocations', 'array', [

#0

[

('.DisplayName', 'string', 'HostName: C:\\Backups\\'),

('.Type', 'string', 'local_folder'),

],

###

]),

('.Meta.BackupLocations^IsContainer', 'string', 'vector'),

('.Meta.BackupSources', 'array', [

#0

[

('', 'string', 'C:\\Program Files (x86) Files\\'),

],

#1

[

('', 'string', 'C:\\Program Files (x86) Explorer\\'),

],

###

]),

('.Meta.BackupSources^IsContainer', 'string', 'vector'),

('.Meta.BackupSourcesType', 'dword', 1),

('.Meta.FinishTime', 'sqword', 1519810390),

('.Meta.InstanceID', 'guid', '70308B16-C110-4726-946E-AF2F2977B626'),

('.Meta.MachineName', 'string', 'HostName'),

('.Meta.PlanID', 'guid', '54609C73-AF92-4A1C-AF97-F0007CA66F4A'),

('.Meta.PlanName', 'string', 'Files/folders to Hostname: C:\\Backups\\'),

('.Meta.StartTime', 'sqword', 1519810337),

('.Meta.Time', 'sqword', 1519810390),

('.Severity', 'dword', 1),

('.SourceTimeStamp', 'sqword', 529),

('.Tenant.ID', 'string', '00000000-0000-0000-0000-000000000000'),

('.Tenant.Locator', 'string', '/00000000-0000-0000-0000-000000000000/'),

('.Type', 'string', 'BackupCanceled'),

('^Is', 'string', 'Alerts::Object'),

('^Source', 'string', '0A8EF0DB-D2AC-4757-8472-118063EDC65B'),

]

 

Thank you.

Attachment Size
444277-144747.zip 430 bytes

In reply to by truwrikodrorow…

Hi,

 

Thanks for this, do you know is there a way to retrieve the alerts on the AMS from a remote System ? I assume that this script have to run local on the AMS node.

 

br

Michael

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi Michael,

Yes, the script should be run locally on AMS and it's not possible to connect to remote AMS - this limitation still remains in place, so you would need to use some other tools (like Windows Scheduler) to be run locally on particular AMS which will trigger the script execution in order to automate it.

Thank you.

In reply to by truwrikodrorow…

And wie a RestAPI query it could not work, for the activieties the RestAPI query works, so if it can be modified for the alerts it would help us a lot

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

What concerns RestAPI for alerts tracking - it's currently not really safe to use it from what I discussed with our developers. There is a big architectural difference between alerts and activities implementation - alerts depend on Acronis monitoring services and are not directly synced to AMS DB, while activities are directly posted in AMS database. The monitoring services RestAPI is known to have it's specific technical problems which is why I suggested the Python script (it works with AMS DB directly). Another reason is that the monitoring services RestAPI would return outputs only for a single AMS user and its childs, instead of returning all active alerts.

Thank you.

In reply to by truwrikodrorow…

Hi,

 

Do you know which Format is this Output from your script? This would be interesting for our development to parse the Output correctly.

 

Thanks

Michael Windsor

frestogaslorastaswastavewroviwroclolacorashibushurutraciwrubrishabenichikucrijorejenufrilomuwrigaslowrikejawrachosleratiswurelaseriprouobrunoviswosuthitribrepakotritopislivadrauibretisetewrapenuwrapi
Posts: 22
Comments: 3800

Hi Michael,

The output is saved in plain text - see the example of it from my above comment. The formatting of the contents is custom i.e. it's not XML or JSON format.

Thank you.