Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lack of free bucket quota warning #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Lack of free bucket quota warning #2

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 14, 2014

For this item configuration

UserParameter=cb.bucket.quotapercent[*],/usr/bin/curl -s -u $1:$2 http://localhost:8091/pools/$3/buckets | /usr/bin/jq ".[0].basicStats.quotaPercentUsed"

The "quotaPercentUsed" field is calculated with the following couchbase code:

QuotaBytes = ns_bucket:ram_quota(BucketConfig),
Stats = last_bucket_stats(ns_bucket:bucket_type(BucketConfig), BucketName, Nodes),
MemUsed = proplists:get_value(memUsed, Stats),
QuotaPercent = try (MemUsed * 100.0 / QuotaBytes) of
X -> X
catch
error:badarith -> 0
end,
[{quotaPercentUsed, lists:min([QuotaPercent, 100])}
For example, the default bucket:

QuotaBytes = 200 mb = 200000 kb = 200000000 bytes
MemUsed = 61.3 mb = 61300 kb = 61300000 bytes

QuotaPercent = MemUsed * 100.0 / QuotaBytes
= 61300000 * 100 / 200000000
= 6130000000 / 200000000
= 30.65 %

[Item]
[default] Bucket used(percent)
= cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default
= 30.65 %

[Trigger]
[default] Lack of free bucket quota warning on server {HOST.NAME}
= {LVCPFMTCCMWP04:cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default].last()}<70

The problem is with the trigger definition

= {LVCPFMTCCMWP04:cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default].last()}<70

The relational operator < should be >

The "quotapercent" returns the amount which is currently used, however, the trigger is measuring the amount which is free.

For this item configuration

UserParameter=cb.bucket.quotapercent[*],/usr/bin/curl -s -u $1:$2 http://localhost:8091/pools/$3/buckets | /usr/bin/jq ".[0].basicStats.quotaPercentUsed"

The "quotaPercentUsed" field is calculated with the following couchbase code:

QuotaBytes = ns_bucket:ram_quota(BucketConfig),
Stats = last_bucket_stats(ns_bucket:bucket_type(BucketConfig), BucketName, Nodes),
MemUsed = proplists:get_value(memUsed, Stats),
QuotaPercent = try (MemUsed * 100.0 / QuotaBytes) of
                   X -> X
               catch
                   error:badarith -> 0
               end,
[{quotaPercentUsed, lists:min([QuotaPercent, 100])}
For example, the default bucket:

QuotaBytes = 200 mb = 200000 kb = 200000000 bytes
MemUsed = 61.3 mb = 61300 kb = 61300000 bytes

QuotaPercent = MemUsed * 100.0 / QuotaBytes
= 61300000 * 100 / 200000000
= 6130000000 / 200000000
= 30.65 %

[Item]
[default] Bucket used(percent)
= cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default
= 30.65 %

[Trigger]
[default] Lack of free bucket quota warning on server {HOST.NAME}
= {LVCPFMTCCMWP04:cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default].last()}<70

The problem is with the trigger definition

= {LVCPFMTCCMWP04:cb.bucket.quotapercent[{$CBUSERNAME},{$CBPASSWORD},default].last()}<70

The relational operator < should be >

The "quotapercent" returns the amount which is currently used, however, the trigger is measuring the amount which is free.
@ghost
Copy link
Author

ghost commented Aug 14, 2014

I've also created an issue for this commit for more visibility.

@ghost
Copy link
Author

ghost commented Oct 26, 2014

hi, please verify the changes in the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants