Bacula-users

Re: [Bacula-users] About bdirjson, bsdjson, bfdjson

2017-07-17 09:08:19
Subject: Re: [Bacula-users] About bdirjson, bsdjson, bfdjson
From: Wanderlei Huttel <wanderleihuttel AT gmail DOT com>
To: Kern Sibbald <kern AT sibbald DOT com>
Date: Mon, 17 Jul 2017 10:07:31 -0300
Hello Kern

- For messages I was not aware there is any level. You will need to be more explicit.
In my Message resource I have configured what messages I want to receive, in this case (all and !skipped)
..
MailCommand = "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
Mail = wanderlei AT domain.com DOT br = all, !skipped
..

But in the json output is showing more than I configured (All, !Debug, !Saved, !Skipped)
 {
  "Type": "Mail",
  "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
  "Command": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
},


- For the ports, please show me an example as there is no need to print it unless it has changed.
About the ports I'm using the default ports (9101, 9102 and 9103) 
You can see that the ports are the default and they're not printed in json output (OK), but if I want to use a GUI interface to recreate the .conf files I always have to include this parameter.

Director{
   ...
   DIRport = 9101
   ...
}

Storage{
  ...
  SDPort = 9103
  ...
}

FileDaemon {
 ... 
 FDport = 9102
}


[
{
  "Director": {
    "Name": "bacula-dir",
    "Description": "Sistema de Backup Famacris",
    "Messages": "Daemon",
    "QueryFile": "/etc/bacula/scripts/_query.sql",
    "WorkingDirectory": "/etc/bacula/working",
    "PidDirectory": "/etc/bacula/working",
    "MaximumConcurrentJobs": 50,
    "Password": "DIRThrOweyEh47XFJHoedlf4OXylbRJhurJAjlhsMIVI",
    "HeartbeatInterval": 300,
    "StatisticsRetention": 94608000
  }
}
]

[
{
  "Storage": {
    "Name": "bacula-sd",
    "WorkingDirectory": "/etc/bacula/working",
    "PidDirectory": "/etc/bacula/working",
    "MaximumConcurrentJobs": 50,
    "HeartbeatInterval": 300
  }
}
]


[{
  "FileDaemon": {
    "Name": "bacula-fd",
    "WorkingDirectory": "/etc/bacula/working",
    "PidDirectory": "/etc/bacula/working",
    "PluginDirectory": "/etc/bacula/plugins",
    "MaximumConcurrentJobs": 50,
    "HeartbeatInterval": 300
  }
}
]


You can see that the ports are the default and they're not printed in json output because you said they are "default", but if I want to use a GUI interface to recreate the .conf files I always will have to check if exists and if not exists include this parameter.

In the Messages (like above) there are more types of messages in the json output than .conf file of message resource.
IMHO would be interesting show all informations that are stored in .conf and not exclude from json output.


- Concerning listing the text.  That is called "cat".  These are Json routines.  Maybe you had some other idea but it was not clear to me.
Example:

root@bacula:/etc/bacula# bdirjson -r pool -n Diaria
{

    "Name": "Diaria",
    "PoolType": "Backup",
    "LabelFormat": "Volume-Diario-${NumVolsDiaria+:p/4/0/r}",
    "PurgeOldestVolume": true,
    "RecycleOldestVolume": true,
    "MaximumVolumes": 15,
    "MaximumVolumeBytes": 4000000000,
    "NextPool": "Pool-Temp",
    "Storage": ["StorageLocal1"],
    "AutoPrune": true,
    "Recycle": true
}

I thought that "output in show text format" would show like the conf files.
root@bacula:/etc/bacula# bdirjson -r pool -n Diaria -s

Pool{
  Name = "Diaria"
  Pool Type = Backup
  Recycle = yes
  Recycle Oldest Volume = yes
  Purge Oldest Volume = yes
  Autoprune = yes
  LabelFormat = "Volume-Diario-${NumVolsDiaria+:p/4/0/r}"
  Maximum Volume Bytes = 4Gb
  Maximum Volumes = 15
  NextPool = "Pool-Temp"
  Storage = StorageLocal1
}

And not this way.

...
Pool: name=Pool-Default PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=100 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=Volume-Default-${NumVolsPoolDefault+:p/4/0/r}
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=0 PurgeOldest=0 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=10000000000
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      CacheRetention=0 secs
      JobRetention=0 secs FileRetention=0 secs
      NextPool=Pool-Temp
  --> Storage: name=StorageLocal1 address=192.168.1.1 SDport=9103 MaxJobs=50 NumJobs=0
      DeviceName=DiscoLocal1 MediaType=File StorageId=0 Autochanger=0
Pool: name=Pool-Temp PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=100 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=Volume-Temporario-${NumVolsPoolTemp+:p/4/0/r}
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=0 PurgeOldest=0 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=10000000000
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      CacheRetention=0 secs
      JobRetention=0 secs FileRetention=0 secs
      NextPool=Pool-Default
  --> Storage: name=StorageLocal2 address=192.168.1.1 SDport=9103 MaxJobs=50 NumJobs=0
      DeviceName=DiscoLocal2 MediaType=File StorageId=0 Autochanger=0
Pool: name=Diaria PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=15 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=Volume-Diario-${NumVolsDiaria+:p/4/0/r}
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=1 PurgeOldest=1 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=4000000000
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      CacheRetention=0 secs
      JobRetention=0 secs FileRetention=0 secs
      NextPool=Pool-Temp
  --> Storage: name=StorageLocal1 address=192.168.1.1 SDport=9103 MaxJobs=50 NumJobs=0
      DeviceName=DiscoLocal1 MediaType=File StorageId=0 Autochanger=0
Pool: name=Semanal PoolType=Backup
      use_cat=1 use_once=0 cat_files=1
      max_vols=25 auto_prune=1 VolRetention=1 year
      VolUse=0 secs recycle=1 LabelFormat=Volume-Semanal-${NumVolsSemanal+:p/4/0/r}
      CleaningPrefix=*None* LabelType=0
      RecyleOldest=1 PurgeOldest=1 ActionOnPurge=0
      MaxVolJobs=0 MaxVolFiles=0 MaxVolBytes=4000000000
      MigTime=0 secs MigHiBytes=0 MigLoBytes=0
      CacheRetention=0 secs
      JobRetention=0 secs FileRetention=0 secs
      NextPool=Pool-Temp
  --> Storage: name=StorageLocal1 address=192.168.1.1 SDport=9103 MaxJobs=50 NumJobs=0
      DeviceName=DiscoLocal1 MediaType=File StorageId=0 Autochanger=0
...


Best regards

Wanderlei Hüttel

2017-07-17 9:21 GMT-03:00 Kern Sibbald <kern AT sibbald DOT com>:

Hello Wanderlei,

Concerning the other things:

- For messages I was not aware there is any level. You will need to be more explicit.

- For the ports, please show me an example as there is no need to print it unless it has changed.

- Concerning listing the text.  That is called "cat".  These are Json routines.  Maybe you had some other idea but it was not clear to me.

Best regards,

Kern


On 07/17/2017 01:43 PM, Wanderlei Huttel wrote:
Hello Kern

Thanks for your answer
 
Did you see the entire email? 
There are more about Messages resource, about  (DIRport, SDPort and FDPort), and about text format.

Best Regards

Wanderlei Hüttel

2017-07-15 12:39 GMT-03:00 Kern Sibbald <kern AT sibbald DOT com>:

Hello Wanderlei,

Yes it was a missing "break".

The fix is in the git repo.

Best regards,
Kern



On 07/14/2017 02:14 PM, Wanderlei Huttel wrote:
Hello

I was testing the new bacula tools (bdirjson) and it looks have something wrong:
The program is repeating the Level in schedules


Schedule {
  Name = "Agenda_GFS_Noite"
  Run = Level=Differential   Pool=Diaria  Accurate=yes on Monday-Thursday at 21:30
  Run = Level=Full           Pool=Semanal   on 2nd-6th Friday  at 19:30
  Run = Level=Full           Pool=Mensal    on 1st Friday      at 19:30
}


bdirjson -n Agenda_GFS_Noite
[
{
  "Schedule": {
    "Name": "Agenda_GFS_Noite",
    "Run": [
     {
      "Pool": "Diaria",
      "Level": "Differential",
      "Level": "Differential",
      "Level": "Differential",
      "Accurate": true,
      "Minute": 30,
      "Hour": [21],
      "Day": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
      "Month": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
      "DayOfWeek": [1, 2, 3, 4],
      "WeekOfMonth": [0, 1, 2, 3, 4, 5],
      "WeekOfYear": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
     },
     {
      "Pool": "Semanal",
      "Level": "Full",
      "Level": "Full",
      "Level": "Full",
      "Minute": 30,
      "Hour": [19],
      "Day": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
      "Month": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
      "DayOfWeek": [5],
      "WeekOfMonth": [1, 2, 3, 4, 5],
      "WeekOfYear": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
     },
     {
      "Pool": "Mensal",
      "Level": "Full",
      "Level": "Full",
      "Level": "Full",
      "Minute": 30,
      "Hour": [19],
      "Day": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
      "Month": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
      "DayOfWeek": [5],
      "WeekOfMonth": [0],
      "WeekOfYear": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
     }
    ]
  }
}





In Message resources it look is including some level not included by default.

########################################################################################
# Configuração das mensagens de Jobs
Messages {
  Name = Standard

  MailCommand = "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
  Mail = wanderlei AT domain.com DOT br = all, !skipped

  MailCommand = "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
  MailOnError = email AT gmail DOT com = all, !skipped

  OperatorCommand = "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: Intervention needed for %j\" %r"
  Operator = wanderlei AT domain.com DOT br = mount

  console = all, !skipped, !saved
  append = "/var/log/bacula/bacula.log" = all, !skipped
  catalog = all, !skipped, !saved
}

{

    "Name": "Standard",
    "MailCommand": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r",
    "OperatorCommand": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: Intervention needed for %j\" %r",
    "Destinations": [
      {
        "Type": "Mail",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
        "Where": ["wanderlei AT domain.com DOT br"],
        "Command": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
      },
      {
        "Type": "MailOnError",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
        "Where": ["email AT gmail DOT com"],
        "Command": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: %t %e of %c %l\" %r"
      },
      {
        "Type": "Append",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
        "Where": ["/var/log/bacula/bacula.log"]
      },
      {
        "Type": "Console",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"]
      },
      {
        "Type": "Operator",
        "MsgTypes": ["Mount"],
        "Where": ["wanderlei AT domain.com DOT br"],
        "Command": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula: Intervention needed for %j\" %r"
      },
      {
        "Type": "Catalog",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"]
      }
    ]
}


########################################################################################
# Configuração das mensagens do daemon
Messages {
  Name = Daemon
  MailCommand = "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula daemon message\" %r"
  Mail = wanderlei AT domain.com DOT br = all, !skipped
  console = all, !skipped, !saved
  append = "/var/log/bacula/bacula.log" = all, !skipped
}

{

    "Name": "Daemon",
    "MailCommand": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula daemon message\" %r",
    "Destinations": [
      {
        "Type": "Mail",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
        "Where": ["wanderlei AT domain.com DOT br"],
        "Command": "/usr/sbin/bsmtp -h localhost -f \"Bacula <email AT domain.com DOT br>\" -s \"Bacula daemon message\" %r"
      },
      {
        "Type": "Append",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"],
        "Where": ["/var/log/bacula/bacula.log"]
      },
      {
        "Type": "Console",
        "MsgTypes": ["All","!Debug","!Saved","!Skipped"]
      }
    ]
}


In the bdirjon, bsdjson and bfdjson they're not printing (DIRport, SDPort and FDPort)



About bdirson -s (output in show text format)
Why not generate the original text like the files .conf?

This would be easyer to recreate conf files.




Best Regards

Wanderlei Hüttel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Bacula-users mailing list
[email protected].net
https://lists.sourceforge.net/lists/listinfo/bacula-users




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

ADSM.ORG Privacy and Data Security by https://kimlaw.us