neuralfraud / grafana-prtg

A PRTG Datasource plugin for Grafana
179 stars 75 forks source link

Data is in bytes #56

Open markisoke opened 7 years ago

markisoke commented 7 years ago

In PRTG all our sensors work with bits (Mb/s), but in Grafana it shows in MB/s. Is there a possibility to change this to Mb/s?

scfigg commented 7 years ago

I'm having this issue too. No matter what I change, I can't get it to show Mbps properly.

scfigg commented 7 years ago

Anyone figure this out yet? Pretty much makes this pointless for us to use at this point. We have 20 sites we want to monitor bandwidth at, and while I can do math, I'd prefer not to when looking at a dashboard. I want to see Mbps, which is what PRTG is currently reporting the sensors as. I see 19.40mbps in Grafana, but it should be ~194Mbps in reality.

scfigg commented 7 years ago

Figured out how to fix this based on another user's comments to try the factory sensor. I created a factory sensor on my firewall device (or whatever device you're wanting to measure the speed of in grafana). For the settings, I used 3 values - IN, OUT, and TOTAL, since I want to display all 3 on my grafana dashboard.

First, take note of the sensorID# in the upper right corner of the page of the sensor you want to alter. My sensor ID# is 6158. Here is what I configured my factory sensor for:

#1:SSC-total
Channel(6158,-1) / 8
#2:SSC-out
Channel(6158,1) / 8
#3:SSC-in
Channel(6158,0) / 8

I gave a different name to each of the 3 things I want to monitor/change. The 0,1,-1 is the ID of the value on the sensor. Each inbound/outbound/total traffic has the IDs of 1,-1,0 for me. If I didn't have the "/ 8" at the end of each, the values would be the same as they always have. This "/ 8" divides the value by 8. In grafana, you then pull up the new factory sensor and then pick one of the 3 channels you listed above (in/out/total). For some reason, grafana kept showing the same values for all 3 even though PRTG was showing the upload/download/total bandwidths correctly. So I made 3 different factory sensors - one for in, out, and total bandwidth, and it worked fine. A waste of sensors, but I got what I wanted out of it.,

Attached are pics of my result - 2 different firewalls / internet pipes, with the upload, download, and total bandwidth usage. I plan on putting traffic graphs for each of our 20+ buildings underneath. I just filled it in with bogus traffic right now until I finish the rest of the dashboard. The "total mbps" under each graph will turn orange if traffic goes over 750mbps, then red if over 900mbps - so we know if we're maxing out our gigabit internet pipes.

img_3861 img_3860

markisoke commented 7 years ago

@scfigg Thanks for your help, I want to mention that I have followed the steps, but it didn't work out form me. I don't now if your right or wrong, but I had to use *8 instead of /8. As unit I now have bits/sec and it works like a charm. Thanks bud.

markisoke commented 7 years ago

@scfigg One more question, how do you get those PRTG errors in grafana?

scfigg commented 7 years ago

I did * 8 originally, but for some reason it didn't work for me (makes sense to multiply by 8, right?). Whatever works I guess.

The down and warning sensors I got by help here: https://github.com/neuralfraud/grafana-prtg/issues/57

Autotropa commented 7 years ago

I also have a question. No one was able to change the displayed information, except as described above? Sorry to sensors increase almost 2 times. And if I takeyh sensors 500, I need 1000 sensors only download to do. Waiting for the updates of the plugin.

Autotropa commented 7 years ago

Was found a solution?

scfigg commented 6 years ago

Anyone know if this was fixed yet?

mberniz commented 6 years ago

I think I am narrowing this problem.

In one side, there is a problem with units conversion. In order to solve that I have followed this strategy:

1) Create a sensor factory per device. 2) Define as many channels as you need from that device 3) Divide /125 in the formula 4) Setup units in axis tab as kilobits/sec

See an example of my factory sensor

1:DECIX TRAFFIC IN

channel(5634,0) / 125

2:DECIX TRAFFIC OUT

channel(5634,1) / 125

3:DECIX TRAFFIC TOTAL

channel(5634,-1) / 125

4:LEVEL3 TRAFFIC IN

channel(5441,0) / 125+channel(5443,0) / 125

5:LEVEL3 TRAFFIC OUT

channel(5441,1) / 125 + channel(5443,1) / 125

6:LEVEL3 TRAFFIC TOTAL

channel(5441,0) / 125 +channel(5443,0) / 125 +channel(5441,1) / 125 +channel(5443,1) / 125

7:COGENT TRAFFIC IN

channel(5442,0) / 125+channel(5444,0) / 125

8:COGENT TRAFFIC OUT

channel(5442,1) / 125+channel(5444,1) / 125

9:COGENT TRAFFIC TOTAL

channel(5442,0) / 125+channel(5444,0) / 125+channel(5442,1) / 125+channel(5444,1) / 125

But there is an additional problem. It seems that a grafana/prtg-plugin bug is making weird things depending on the displaying period:

ranges from last 5 minutes to last 12 hours NEVER work range of last 24 hours RANDOMLY work range of last 2 days to last 90 days MOSTLY work ranges above that RANDOMLY work other intermediate ranges RANDOMLY work

So I am not sure what could be making that some time ranges work and others not, but I have thoroughly checked it and thats the behavior.

Hope it helps.

mberniz commented 6 years ago

These two captures were taken at the same times, first in last hour time range and second is last 2 days time range. As you can see, last hour is totally messed (even the 6 different sensors used are displaying same values) while last 2 days displays proper data.

notworklast1h work last 2 days

mberniz commented 6 years ago

Hi,

I found a workaround. The problem is some time ranges had not defined avg value for the api query, hence bringing messy results.

I changed code section in /var/lib/grafana/plugins/jasonlashua-prtg-datasource/jasonlashua-prtg-datasource/dist/PRTGAPIService.js

to

key: "getItemHistory", value: function getItemHistory(sensor, channel, dateFrom, dateTo) { var hours = (dateTo - dateFrom) / 3600; var avg = 150; if (hours >= 1 && hours < 36) { avg = "300"; } else if (hours > 36 && hours < 745) { avg = "3600"; } else if (hours > 745) { avg = "86400"; } And it working almost almost well.

I appreciate another problem that appears in a cyclic fashion. It is more evident in small range graphics. If you look at the graphics on small range it seems they are not continuous. so there is like an empty space between the drawn lines and the edges of the graphic. When left space about to become filled (that means right is at its maximum), values go mad for a few refreshed, then gap in the right is filled and hole at right appears again.

Any idea?

ghost commented 6 years ago

Hi all,

Sorry but i don't understand how to get my graph in bit, not bytes ?

jastump commented 6 years ago

I've been struggling with this for hours. Turns out my sensors in PRTG are in kbit/s, but PTRG must be dividing by 100 as the raw value I'm seeing in grafana needs to be divided by 100 to be the correct Gbit/s...

Suggestions?

neuralfraud commented 6 years ago

PRTG raw values are bits/sec or bytes/sec, usually bits.

Set the scale to data rate > Bits/sec

From: Joshua Stump [mailto:notifications@github.com] Sent: Tuesday, November 21, 2017 2:54 PM To: neuralfraud/grafana-prtg grafana-prtg@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [neuralfraud/grafana-prtg] Data is in bytes (#56)

I've been struggling with this for hours. Turns out my sensors in PRTG are in kbit/s, but it must be dividing by 100 as the raw value I'm seeing in grafana needs to be divided by 100 to be the correct Gbit/s...

Suggestions?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/neuralfraud/grafana-prtg/issues/56#issuecomment-346142115 , or mute the thread https://github.com/notifications/unsubscribe-auth/AIFtN_bDVEFFzoLMhLfNStuA1mGJzosUks5s4ypkgaJpZM4PM9jp .

ghost commented 6 years ago

If i change my scale, there is no conversion, this just another scale that i display. For the moment i get byte/sec :

image

On my prtg :

image

The max i get is 4303 Kbit/s on PRTG, on grafana i get 515KByte/s

so if i want a conversion i need to multiple by 8

515 * 8 = 4120Kbit/s

And if i changed my scale i get just this :

image

jastump commented 6 years ago

@neuralfraud thanks for responding. The odd thing is that the raw value I'm receiving needs to be divided by 100, not 1000. Bit/s is too low and Kbit/s is too high. If I take the raw value and move the decimal to the left by two (divide by 100), then the values are correct in a calculator. Just having a hard time figuring that out with grafana (or where the extra two digits are coming from and why it displays correctly in PRTG)...

From what I can tell the raw value I got last was "232995060" which I'm guessing should be in Kbit/s a second, but if you convert that to Gbit/s it's 232, not the 2.3 that it should be. If I set to Bit/s I end up with .232.

jastump commented 6 years ago

Anyone else solve this without creating an extra sensor in PRTG? Still receiving the raw value that needs to be divided by 100 to fit into kbit/s a second.

ghost commented 6 years ago

Same problem :( i really need to display in kbit/s, i use this plugin to a display customer, this is not friendly :(

neuralfraud commented 6 years ago

Ok guys,

I’m sorry for waiting so long, as I said, I really believe Grafana should do this natively. However, since that isn’t presently the case, I’ve implemented a very simple multiplier option that you can add to your existing queries

For instance, if data is in bytes, and you need bits, then multiplier should be 8. You then need to change the graph axis to the appropriate data rate (e.g. bits/sec)

Check the Development Branch for the latest code and please let me know if it works.

Just copy the “dist” directory into the existing installed directory and restart grafana.

Thanks

From: SlodeSoft [mailto:notifications@github.com] Sent: Tuesday, December 5, 2017 10:16 AM To: neuralfraud/grafana-prtg grafana-prtg@noreply.github.com Cc: J Lashua nf@neuralfraud.net; Mention mention@noreply.github.com Subject: Re: [neuralfraud/grafana-prtg] Data is in bytes (#56)

Same problem :( i really need to display in kbit/s, i use this plugin to a display customer, this is not friendly :(

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neuralfraud/grafana-prtg/issues/56#issuecomment-349334502 , or mute the thread https://github.com/notifications/unsubscribe-auth/AIFtNx05oUTkvxaIjw0OM7JMb64MNt8Jks5s9V4YgaJpZM4PM9jp . https://github.com/notifications/beacon/AIFtN3RXU1nyewAHvuwVjz8YjepFG8G-ks5s9V4YgaJpZM4PM9jp.gif

jastump commented 6 years ago

That did it! Multiply by .01 and setting axis to kbit/s and everything is as it should be. Thanks again. Still curious where those extra two digits are coming from and how PRTG knows to math that out correctly.

ghost commented 6 years ago

Great job neuralfraud i multiple by .008 i get the good scale.

Excellent Thanks again !

neuralfraud commented 6 years ago

When querying the list of channels, only “Traffic In/out” are shown – so the plugin selects “speed” as a default since that’s what most users are after.

From: Krazedkatt [mailto:notifications@github.com] Sent: Wednesday, December 6, 2017 5:21 PM To: neuralfraud/grafana-prtg grafana-prtg@noreply.github.com Cc: J Lashua nf@neuralfraud.net; Mention mention@noreply.github.com Subject: Re: [neuralfraud/grafana-prtg] Data is in bytes (#56)

Not working for me, but I might be doing something wrong. As an example, in PRTG I have a graph that has Traffic In. In query inspector I see returned values for two different traffic in channels. (volume & speed)

818 MByte 857922481.4417 78 Mbit/s 9753552.5403

But under my query and in the channel field, I only have a selection of 'Traffic In'. I don't have traffic in (volume) or traffic in (speed). Using the 'traffic in' channel and setting the correct multiplier and axis unit (bits/sec), my Y axis values are still incorrect.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neuralfraud/grafana-prtg/issues/56#issuecomment-349794258 , or mute the thread https://github.com/notifications/unsubscribe-auth/AIFtN2W4mIJiqO2xONeHoXZpSQmpWRgAks5s9xNPgaJpZM4PM9jp . https://github.com/notifications/beacon/AIFtNwKH-qwnXnG8PAQrlrQPnclRZpahks5s9xNPgaJpZM4PM9jp.gif

isvilenski commented 6 years ago

@neuralfraud the multiplier is not having any effect on my instance. I can see the multiplier field but it's not working :( I did what you said, replaced the dst files and restarted the service but it's just not multiplying. My grafana version is grafana-5.0.3 and PRTG Network Monitor 18.1.37.13946

Thank you for your work by the way!

ThisBitchDontKnowBoutPangaea commented 6 years ago

Hi,

I am running a hosted instance of Grafana with Grafana directly so do not have server access to make any modifications.

Is there an expected date of release for this? I am currently unable to publish our dashboards across the business due to the discrepancies with data being shown.

Thanks

razerzone commented 6 years ago

Hi Guy/@neuralfraud, may i know how you guys able to do multiplier. Already key in the value but seems like nothing changed.

Thank you.

ktngoykalolo commented 6 years ago

Hi @neuralfraud , please let us know if you pushed the code from development to release ?

browndervilleb commented 6 years ago

I just wanted to say that the decimal multiplier has helped me as well. I had several instances of issues from bandwidth sensors to monitoring load/runtime on my APC units.

jaffarraheem commented 5 years ago

i found a solution for this issue its related to the PRTG , we should modify the API parameters on /var/lib/grafana/plugins/jasonlashua-prtg-datasource/jasonlashua-prtg-datasource/dist/PRTGAPIService.js

section key: "getAllItems",

var params = "content=channels&columns=sensor,name,lastvalue&id=" + sensor.objid; add lastvalue after sensor,name

ffkammer commented 5 years ago

Hi @jaffarraheem I did the change suggested by you but I continues to receive the values in Bytes, not in bits, can you help me to solve my problema please?

Regards

tuncerinan commented 5 years ago

hi guys, how ı multiple this value.I dont know from where ? Could you help me please .Thanks for answers

sandrox11 commented 5 years ago

Ok guys, I’m sorry for waiting so long, as I said, I really believe Grafana should do this natively. However, since that isn’t presently the case, I’ve implemented a very simple multiplier option that you can add to your existing queries For instance, if data is in bytes, and you need bits, then multiplier should be 8. You then need to change the graph axis to the appropriate data rate (e.g. bits/sec) Check the Development Branch for the latest code and please let me know if it works. Just copy the “dist” directory into the existing installed directory and restart grafana. Thanks From: SlodeSoft [mailto:notifications@github.com] Sent: Tuesday, December 5, 2017 10:16 AM To: neuralfraud/grafana-prtg grafana-prtg@noreply.github.com Cc: J Lashua nf@neuralfraud.net; Mention mention@noreply.github.com Subject: Re: [neuralfraud/grafana-prtg] Data is in bytes (#56) Same problem :( i really need to display in kbit/s, i use this plugin to a display customer, this is not friendly :( — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#56 (comment)> , or mute the thread https://github.com/notifications/unsubscribe-auth/AIFtNx05oUTkvxaIjw0OM7JMb64MNt8Jks5s9V4YgaJpZM4PM9jp . https://github.com/notifications/beacon/AIFtN3RXU1nyewAHvuwVjz8YjepFG8G-ks5s9V4YgaJpZM4PM9jp.gif

Great, it works for me @neuralfraud . Thank you!

biloriaj commented 5 years ago

Hi, is there any update about this case? I tried all the suggestions and I still have the same issue with the data coming from the PRTG..

biloriaj commented 5 years ago

I copied the /dist and reset the server with no luck Regards.

sandrox11 commented 5 years ago

Hey @biloriaj i think you are doing something wrong. If you want contact me in skype sandrog.rodrigues and will be a pleasure helping you.

biloriaj commented 5 years ago

Hi, Sandro! I will do it today! Getting ready to go to the office now :). Regards.

On Thu, May 23, 2019 at 7:29 AM sandrogrodrigues notifications@github.com wrote:

Hey @biloriaj https://github.com/biloriaj i think you are doing something wrong. If you want contact me in skype sandro.rodrigues and will be a pleasure helping you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/neuralfraud/grafana-prtg/issues/56?email_source=notifications&email_token=AMEQDPJWVIFKXB2DBXWRJELPW2E27A5CNFSM4DZT3DU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWCB6YI#issuecomment-495198049, or mute the thread https://github.com/notifications/unsubscribe-auth/AMEQDPIIRKUQSEEQXFNA3OLPW2E27ANCNFSM4DZT3DUQ .

-- Jesús Alberto Viloria Paolini

biloriaj commented 5 years ago

Hi, I'd love to continue working on this case, please let me know when you have a chance. Regards. Jesus Viloria

sandrox11 commented 5 years ago

Next week, ok?

Em ter, 28 de mai de 2019 12:05, biloriaj notifications@github.com escreveu:

Hi, I'd love to continue working on this case, please let me know when you have a chance. Regards. Jesus Viloria

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neuralfraud/grafana-prtg/issues/56?email_source=notifications&email_token=AIFCARC3PS36NNRDLORV23LPXVC27A5CNFSM4DZT3DU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWMNW3I#issuecomment-496556909, or mute the thread https://github.com/notifications/unsubscribe-auth/AIFCARGBFFGHOULRKPCSQI3PXVC27ANCNFSM4DZT3DUQ .

forever765 commented 5 years ago

Ok guys, I’m sorry for waiting so long, as I said, I really believe Grafana should do this natively. However, since that isn’t presently the case, I’ve implemented a very simple multiplier option that you can add to your existing queries For instance, if data is in bytes, and you need bits, then multiplier should be 8. You then need to change the graph axis to the appropriate data rate (e.g. bits/sec) Check the Development Branch for the latest code and please let me know if it works. Just copy the “dist” directory into the existing installed directory and restart grafana. Thanks From: SlodeSoft [mailto:notifications@github.com] Sent: Tuesday, December 5, 2017 10:16 AM To: neuralfraud/grafana-prtg grafana-prtg@noreply.github.com Cc: J Lashua nf@neuralfraud.net; Mention mention@noreply.github.com Subject: Re: [neuralfraud/grafana-prtg] Data is in bytes (#56) Same problem :( i really need to display in kbit/s, i use this plugin to a display customer, this is not friendly :( — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#56 (comment)> , or mute the thread https://github.com/notifications/unsubscribe-auth/AIFtNx05oUTkvxaIjw0OM7JMb64MNt8Jks5s9V4YgaJpZM4PM9jp . https://github.com/notifications/beacon/AIFtN3RXU1nyewAHvuwVjz8YjepFG8G-ks5s9V4YgaJpZM4PM9jp.gif

It works fine! Thank you very much!

Guerlielton commented 4 years ago

Hi, is there any update about this case? I tried all the suggestions and I still have the same issue.

forever765 commented 4 years ago

@Guerlielton hi, You can try the above method, the latest version of grafana is also available.

Guerlielton commented 4 years ago

@forever765 I'm getting this error by clicking the link above: Whoops! That unsubscribe link isn't valid for your account. do you have link with solution the case ?

forever765 commented 4 years ago

@Guerlielton please check branch, the link is https://github.com/neuralfraud/grafana-prtg/tree/Development/jasonlashua-prtg-datasource/dist

Guerlielton commented 4 years ago

Hi @forever765 thank you. Prtg <> Grafana finally working grafana PRTG API Version 19.3.52.3502+