Community discussions

 
Prewest
just joined
Topic Author
Posts: 16
Joined: Tue Oct 20, 2009 3:35 pm

Value's of multiple data sources into 1 Chart

Sun May 13, 2012 9:23 pm

Hi,,

i`ve made several data-sources from different devices, now i want to add up the numbers (example : 1+2+6 = 9) of these datasources and show them in a chart.
Is this possible?

if so, then what code should i use?
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Value's of multiple data sources into 1 Chart

Mon May 14, 2012 6:41 pm

You can specify the ip address you would like to read from in an oid. I would build 3 functions then add all 3 functions to a master function, then add that to a probe and add the probe to a device and then put that on a chart. Post the oid if you would like it built for you.

OID - returns value of given snmp OID. Only first parameter mandatory. First parameter - oid string, second - cache time - default 5 seconds (5.0), third - negative cache time - default 5 minutes (300.0), forth - ip address (overrides context device), fifth - snmp profile (overrides context device)

Function:value1
oid("1.3.6.1.4.1.9.2.1.57.0", 10 ,5 ,192.168.0.1)
Function:value2
oid("1.3.6.1.4.1.9.2.1.57.0", 10 ,5, 192.168.0.2)
Function:value3
oid("1.3.6.1.4.1.9.2.1.57.0", 10 , 5,192.168.0.3)

Function:mval
value1()+value2()+value3()

Lebowski
 
Prewest
just joined
Topic Author
Posts: 16
Joined: Tue Oct 20, 2009 3:35 pm

Re: Value's of multiple data sources into 1 Chart

Tue May 15, 2012 1:05 pm

hmm it doesn`t seem to work..

i made a function called: SIPCALL1
the error i`m getting = oid("1.3.6.1.4.1.1768.100.70.10.2.1.2.1", 10, 5, 81.28.86.107)

with the function SIP_TOTAL i`m getting a parse failed error.
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Value's of multiple data sources into 1 Chart

Tue May 15, 2012 4:44 pm

Sorry, the ip address needs to be in quotes.

oid("1.3.6.1.4.1.1768.100.70.10.2.1.2.1", 10, 5, "81.28.86.107")
 
Prewest
just joined
Topic Author
Posts: 16
Joined: Tue Oct 20, 2009 3:35 pm

Re: Value's of multiple data sources into 1 Chart

Tue May 15, 2012 10:27 pm

Sorry, the ip address needs to be in quotes.

oid("1.3.6.1.4.1.1768.100.70.10.2.1.2.1", 10, 5, "81.28.86.107")
It works, thanks!

one more thing, when the value of the "SIP_TOTAL" is 0, i`m getting that the probe is down..
i`m using:

available: SIP_TOTAL() > 0
Error: if(SIP_TOTAL() > 0, "", "SIP GESPREKKEN = 0")
value: SIP_TOTAL()

I want to make it so that its OK when the value is equal or more than 0.
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Value's of multiple data sources into 1 Chart

Tue May 15, 2012 10:35 pm

This has always been a pain in the dude, dealing with 0. Zero is null which is false even if it is the actual value read from SNMP (this is certainly a "feature"). Also even though the manual will say -1 is false it is not. So available line has to return a non zero value.

Here is a template to use for every probe you ever make...
Use a function to read the OID values and use a probe to verify those values. Every function should have two results, the result you are interested in graphing and the result you get when the OID is not available. Then use that function in a probe. Every probe should return 3 values; true, the error, and down. (Note: true = "")

The following function checks to make sure that the OID that is attempted to be read actually has a value in it even if it is "0" the result will be true. Notice the +1, this should be subtracted out just before graphing and testing the value in the probe.
Function: test
CODE: if(string_size(oid("x.x.x")), oid("x.x.x")+1, "False")
Also note that 0 is much easier to test for than "false" so modifying the above CODE to 0 instead of "False" is recommended.

The following probe verifies that the oid is actually available, then tests the oid vs a value and returns an error if the value is outside the range and then if the device is down it will complain that the oid is unreachable. Finally drop the value in to graph -1. This was based on a CPU probe.
Probe: testoid
AVAILABLE: test() <> "False"
ERROR: if(test()<>"False",if(test() -1< 80, "", concatenate("Warning: high CPU = ", test(), "%")), "Device unreachable")
VALUE: test()-1
UNIT: %

Note: if you used 0 in the function for false use 0 in the probe for false.

Build probes as above and you will be much happier with your work.
Lebowski

[clarity]
 
Prewest
just joined
Topic Author
Posts: 16
Joined: Tue Oct 20, 2009 3:35 pm

Re: Value's of multiple data sources into 1 Chart

Wed May 16, 2012 10:30 pm

it`s working..
thanks for you`re advice..

what i did was add a static value of 0.001, i won`t show up on the chart but it will show the probe as "UP".
 
lebowski
Forum Guru
Forum Guru
Posts: 1616
Joined: Wed Aug 27, 2008 5:17 pm

Re: Value's of multiple data sources into 1 Chart

Thu May 17, 2012 12:37 am

yeah that will work! Glad you have your setup working.

Who is online

Users browsing this forum: No registered users and 5 guests