This post is more than 5 years old
16 Posts
0
2008
January 28th, 2014 22:00
Issue while creating quota notification rule
Hi,
I am trying to use the platform API to create a quota notification rule.
Here's an example:
> curl -k -u root:xxxxxxxx -X POST -d
'{"holdoff":0,"action_email_address":"tchan@ilm.com","threshold":"hard","action_email_owner":false,"email_template":"/ifs/template/homedir_hard.txt","action_alert":true,"schedule":null,"condition":"exceeded"}' https://imperial:8080/platform/1/quota/quotas/pwkwBQEAAAAAAAAAAAAAQFkAAAAAAAAA/notifications
I get the following error code back:
{"errors" : [
{"code" : "AEC_BAD_REQUEST","field" : "schedule","message" : "Parser
error: unexpected end of input"}]
}
Could you tell me if I'm missing something?
Making new quotas using the API works fine:
> curl -k -u root:xxxxxxxx -X POST -d '{"enforced":true,"include_snapshots":false,"path":"/ifs/lucas/ilm/home/tchan/test","thresholds":{"advisory":1000000,"soft":2000000,"hard":3000000,"soft_grace":10000},"thresholds_include_overhead":false,"type":"directory"}' https://imperial:8080/platform/1/quota/quotas
Regards,
Mike



Yan_Faubert
117 Posts
1
January 31st, 2014 07:00
Remove "schedule": null from your parameters.
If you want to specify a schedule (typically used with 'condition': 'violated' or 'condition': 'exceeded'), use a format like this:
schedule: 'Date pattern'
For more information about date pattern or other schedule parameters, see man isi-schedule.
Examples below of a couple of json strings that work. This is from a python program so you would extract the info between { } to put in your 'curl' tests.
# This if for an 'exceeded' condition, notice there's no 'schedule' param.
notjson_exceeded = json.dumps({'holdoff': 0, 'action_email_address': 'my.email@isilon.com', 'threshold': 'hard',
'action_email_owner': False, 'email_template': '/ifs/template/homedir_hard.txt',
'action_alert': True, 'condition': 'exceeded'})
# This is for a 'violated' condition, notice the 'schedule' param. I also specified a 'holdoff' value of 1 day (86400 sec).
notjson_violated = json.dumps({'holdoff': 86400, 'action_email_address': 'my.email@isilon.com', 'threshold': 'hard',
'action_email_owner': False, 'email_template': '/ifs/template/homedir_hard.txt',
'action_alert': True, 'condition': 'violated', 'schedule': 'every day at 2am'})
The resulting listing from CLI is:
isi quota quotas notifications list /ifs/data/quota_test directory -v
Threshold: hard
Condition: exceeded
Schedule: -
Holdoff: Now
ActionAlert: Yes
EmailOwner: No
NotifyAddress: my.email@isilon.com
Email Template: /ifs/template/homedir_hard.txt
--------------------------------------------------------------------------------
Threshold: hard
Condition: violated
Schedule: every day at 2am
Holdoff: 1D
ActionAlert: Yes
EmailOwner: No
NotifyAddress: my.email@isilon.com
Email Template: /ifs/template/homedir_hard.txt
Mike_S
16 Posts
0
February 1st, 2014 06:00
Thank you very much Yan for your help.
Regards,
Mike