Help with CDEF

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Moderators, Developers

Post Reply
Author
Message
seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Help with CDEF

#1 Post by seanmancini » Fri Nov 29, 2019 3:15 pm

Hey Everyone

I need some help

for the life of me I cant convert this equation into a cdef

I need to converter the current data source value 10 x log10
I am looking to convert microwatt to dbm for optical levels this is the example the vendor has given

For example (internally calibrated SFF):
Using the SNMP value of 790, and using units of tenths of microwatt,
790 becomes 79 microwatts or 0.079 milliwatts. Converting to dBm:
10 x log10(0.079) = -11.0 dBm"

I have tried CURRENT_DATA_SOURCE,10,*,LOG,10,/ but that doesnt work as the read out is incorrect



Any help will be appreciated !!

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Help with CDEF

#2 Post by netniV » Fri Nov 29, 2019 5:54 pm

I think you want

CURRENT_DATA_SOURCE,1000,/,LOG,10,/

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#3 Post by seanmancini » Fri Nov 29, 2019 7:33 pm

that didnt quite work

I slightly modified it to

CURRENT_DATA_SOURCE,10000,*,10,/,LOG,10,/

which gives me a value of 288.0

this is the raw value
SNMPv2-SMI::enterprises.6527.3.1.2.2.4.31.1.21.1.35684352 = INTEGER: 4368

which would be

>>> 10 * math.log10(0.04368)
-13.597173703033192
>>>


Im not that great with these expressions but I think its close

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Help with CDEF

#4 Post by netniV » Fri Nov 29, 2019 7:52 pm

When you do log of the datasource, you should end up with -1.1. If you don't, you have the wrong value.

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#5 Post by seanmancini » Mon Dec 02, 2019 1:31 pm

Thanks !!!!!

still not there yet though :( the numbers are not lining up

Here is my cdef
cdef.JPG
cdef.JPG (35.4 KiB) Viewed 154 times
Here is the graph output

ll.JPG
ll.JPG (20.7 KiB) Viewed 154 times

But here is the output from the OID

enterprises.6527.3.1.2.2.4.31.1.21.1.35684352 = 429

If I do the calculation In python its bang on

>>> 10 * math.log10(0.0429)
-13.6754270782
>>>

its definetly the math on the Cdef ive been playing around with it but still cant seem to get it right

User avatar
Osiris
Cacti Pro User
Posts: 889
Joined: Mon Jan 05, 2015 10:10 am

Re: Help with CDEF

#6 Post by Osiris » Mon Dec 02, 2019 1:42 pm

CURRENT_DATA_SOURCE,10,/,LOG,10,*
Before history, there was a paradise, now dust.

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#7 Post by seanmancini » Mon Dec 02, 2019 1:48 pm

Hey !

I tried that before as well but no go

I should have a negative number for sure and 37 thats way out of wack

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#8 Post by seanmancini » Mon Dec 02, 2019 1:48 pm

I should get a value of around -13

User avatar
Osiris
Cacti Pro User
Posts: 889
Joined: Mon Jan 05, 2015 10:10 am

Re: Help with CDEF

#9 Post by Osiris » Thu Dec 05, 2019 5:44 pm

Osiris wrote:
Mon Dec 02, 2019 1:42 pm
CURRENT_DATA_SOURCE,10,/,LOG,10,*
This is wrong based upon further inspection (second look). This should be right.
CURRENT_DATA_SOURCE,1000,/,LOG,10,*
Which I saw someone else post too.
Before history, there was a paradise, now dust.

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Help with CDEF

#10 Post by netniV » Sat Dec 07, 2019 8:33 am

Osiris wrote:
Thu Dec 05, 2019 5:44 pm
Osiris wrote:
Mon Dec 02, 2019 1:42 pm
CURRENT_DATA_SOURCE,10,/,LOG,10,*
This is wrong based upon further inspection (second look). This should be right.
CURRENT_DATA_SOURCE,1000,/,LOG,10,*
Which I saw someone else post too.
Me sir, it was me! :) I got one right woohoo :)

CDEF's are not something I mess with a lot so good to know I was on the right track.

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#11 Post by seanmancini » Mon Dec 09, 2019 9:30 am

This is the CDEF that worked for me

CURRENT_DATA_SOURCE,10000,/,LOG,10,*,2.303,/

Thanks guys !!!!

netniV
Cacti Guru User
Posts: 3132
Joined: Sun Aug 27, 2017 12:05 am

Re: Help with CDEF

#12 Post by netniV » Mon Dec 09, 2019 10:56 am

seanmancini wrote:
Mon Dec 09, 2019 9:30 am
CURRENT_DATA_SOURCE,10000,/,LOG,10,*,2.303,/
What was the divide by 2.303 for? Did I miss something?

seanmancini
Cacti User
Posts: 110
Joined: Wed Mar 13, 2019 3:37 pm
Location: toronto
Contact:

Re: Help with CDEF

#13 Post by seanmancini » Mon Dec 09, 2019 11:20 am

Hey!

Yea the explanation I found was in this post which helped me alot

viewtopic.php?t=48513

Post Reply