ZABBIX Forums  
  #1  
Old 05-12-2017, 17:45
SnIpY SnIpY is offline
Junior Member
 
Join Date: Jan 2017
Posts: 6
Default Calculated Items in Templates

I'm having a Template A with two items:

Total Storage Space (External Check, Key: rds_stats.py["--metric","AllocatedStorage","--instance-id","{HOST.HOST}","--access-key","{$AWS_ACCESS_KEY}","--secret-key","{$AWS_SECRET_KEY}","--region","{$REGION}"])
Available Storage Space (External Check, Key: rds_stats.py["--metric","FreeStorage","--instance-id","{HOST.HOST}","--access-key","{$AWS_ACCESS_KEY}","--secret-key","{$AWS_SECRET_KEY}","--region","{$REGION}"])

Now I would like to add a third item to the same template, calculating the free storage space in percentage.

According to the documentation https://www.zabbix.com/documentation...pes/calculated, it should look like this: 100*last("vfs.fs.size[/,free]")/last("vfs.fs.size[/,total]")

So I've created this:

Quote:
100*last("rds_stats.py["--metric","FreeStorageSpace","--instance-id","{HOST.HOST}","--access-key","{$AWS_ACCESS_KEY}","--secret-key","{$AWS_SECRET_KEY}","--region","{$REGION}"]")/last("rds_stats.py["--metric","AllocatedStorage","--instance-id","{HOST.HOST}","--access-key","{$AWS_ACCESS_KEY}","--secret-key","{$AWS_SECRET_KEY}","--region","{$REGION}"]")
But for some reason, this does not work. The error I am seeing is the following:
Macro '{$AWS_ACCESS_KEY}' value is not numeric

Any tips on how I an resolve this?
Reply With Quote
  #2  
Old 05-12-2017, 18:39
kloczek kloczek is offline
Senior Member
 
Join Date: Jun 2006
Location: UK/London
Posts: 872
Default

So on the begging you have:
Code:
last("rds_stats.py["--metric","FreeStorageSpace","<and_so_on>"
so on first look it can be interpreted as last() arguments: "rds_stats.py[" then "FreeStorageSpace" ..
Looks like messy quotations
Reply With Quote
  #3  
Old 05-12-2017, 21:26
SnIpY SnIpY is offline
Junior Member
 
Join Date: Jan 2017
Posts: 6
Default

Made some changes and changed it into this:

Code:
100*last("rds_stats.py['--metric','FreeStorageSpace','--instance-id','{HOST.HOST}','--access-key','{$AWS_ACCESS_KEY}','--secret-key','{$AWS_SECRET_KEY}','--region','{$REGION}']")
I did the same change to the item itself

Now the error I am seeing is the following -> Item ... is not supported.

I am seeing that error because the quotes need to be double for the item. If the quotes are not the same in the item and the calculated item, I am getting the Item not found item error.

So whats the best approach here?
1) I need double quotes in the formula, but can't seem to use them
Reply With Quote
  #4  
Old 06-12-2017, 11:04
SnIpY SnIpY is offline
Junior Member
 
Join Date: Jan 2017
Posts: 6
Default

Backslashes to the resque!

This eventually worked:

Code:
100*(last("rds_stats.py[\"--metric\",\"FreeStorageSpace\",\"--instance-id\",\"{HOST.HOST}\",\"--access-key\",\"{$AWS_ACCESS_KEY}\",\"--secret-key\",\"{$AWS_SECRET_KEY}\",\"--region\",\"{$REGION}\"]")/last("rds_stats.py[\"--metric\",\"AllocatedStorage\",\"--instance-id\",\"{HOST.HOST}\",\"--access-key\",\"{$AWS_ACCESS_KEY}\",\"--secret-key\",\"{$AWS_SECRET_KEY}\",\"--region\",\"{$REGION}\"]"))
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:41.