Grafana (backend) and Rapid SCADA

Forum Home Forums Development and Integration Grafana (backend) and Rapid SCADA

Viewing 11 posts - 16 through 26 (of 26 total)
  • Author
    Posts
  • #7734
    AvatarOtavioF
    Participant

    Hi,
    I’m getting no output.

    I’ve compiled Log(Release) > ScadaData(Release) > GrafanaDataProvider(Debug), attached to process the w3wp.exe but I’m getting no output. Am I missing something?

    #7736
    AvatarOtavioF
    Participant

    Hi,
    I disabled “Just My Code” on Debug Options and managed to get a few more info.

    Now I get this messages on every Grafana’s refresh:

    Exception thrown: 'Newtonsoft.Json.JsonReaderException' in Newtonsoft.Json.dll
    Exception thrown: 'Newtonsoft.Json.JsonReaderException' in Newtonsoft.Json.dll
    Exception thrown: 'Scada.ScadaException' in ScadaData.dll

    The soap opera continues…

    #7744
    MikhailMikhail
    Moderator

    Hi,

    Try to get full exception stack where you can see a sequence of exceptions.
    What operating conditions are causing this exception?

    #7746
    AvatarOtavioF
    Participant

    Hi,

    The description of the exception is:

    Newtonsoft.Json.JsonReaderException: 'Could not convert string to DateTime: 1608121200227. Path 'range.to', line 1, position 53.'

    Using the PDB and source code of the Newtonsoft, Visual Studion points the error occurring in this function (marked with some “<<<” on the line)

    internal DateTime? ReadDateTimeString(string s)
            {
                if (string.IsNullOrEmpty(s))
                {
                    SetToken(JsonToken.Null, null, false);
                    return null;
                }
    
                if (DateTimeUtils.TryParseDateTime(s, DateTimeZoneHandling, _dateFormatString, Culture, out DateTime dt))
                {
                    dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
                    SetToken(JsonToken.Date, dt, false);
                    return dt;
                }
    
                if (DateTime.TryParse(s, Culture, DateTimeStyles.RoundtripKind, out dt))
                {
                    dt = DateTimeUtils.EnsureDateTime(dt, DateTimeZoneHandling);
                    SetToken(JsonToken.Date, dt, false);
                    return dt;  <<<<<<<<--------
                }
    
                throw JsonReaderException.Create(this, "Could not convert string to DateTime: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
            }

    As requested, the exception stack is as it follows:

    >	Newtonsoft.Json.dll!Newtonsoft.Json.JsonReader.ReadDateTimeString(string s) Line 856	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.JsonTextReader.FinishReadQuotedStringValue(Newtonsoft.Json.ReadType readType) Line 729	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.JsonTextReader.ReadAsDateTime() Line 467	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.JsonReader.ReadForType(Newtonsoft.Json.Serialization.JsonContract contract, bool hasConverter) Line 1217	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, string id) Line 2378	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, object existingValue) Line 485	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, object target) Line 1004	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, string id) Line 2331	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, object existingValue) Line 485	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(Newtonsoft.Json.JsonReader reader, System.Type objectType, bool checkAdditionalContent) Line 167	C#
     	Newtonsoft.Json.dll!Newtonsoft.Json.JsonSerializer.DeserializeInternal(Newtonsoft.Json.JsonReader reader, System.Type objectType) Line 901	C#
     	System.Net.Http.Formatting.dll!System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStream(System.Type type, System.IO.Stream readStream, System.Text.Encoding effectiveEncoding, System.Net.Http.Formatting.IFormatterLogger formatterLogger)	Unknown
     	System.Net.Http.Formatting.dll!System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStream(System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger)	Unknown
     	System.Net.Http.Formatting.dll!System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.ReadFromStreamAsync(System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger)	Unknown
     	System.Net.Http.Formatting.dll!System.Net.Http.Formatting.MediaTypeFormatter.ReadFromStreamAsync(System.Type type, System.IO.Stream readStream, System.Net.Http.HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Net.Http.Formatting.dll!System.Net.Http.HttpContentExtensions.ReadAsAsyncCore<object>(System.Net.Http.HttpContent content, System.Type type, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Net.Http.Formatting.MediaTypeFormatter formatter, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Net.Http.Formatting.dll!System.Net.Http.HttpContentExtensions.ReadAsAsync<object>(System.Net.Http.HttpContent content, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(System.Net.Http.HttpRequestMessage request, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(System.Net.Http.HttpRequestMessage request, System.Type type, System.Collections.Generic.IEnumerable<System.Net.Http.Formatting.MediaTypeFormatter> formatters, System.Net.Http.Formatting.IFormatterLogger formatterLogger)	Unknown
     	System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsyncCore(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Web.Http.Controllers.HttpParameterDescriptor paramFromBody, System.Type type, System.Net.Http.HttpRequestMessage request, System.Net.Http.Formatting.IFormatterLogger formatterLogger, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsync(System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.Controllers.HttpActionBinding.ExecuteBindingAsyncCore(System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.Controllers.HttpActionBinding.ExecuteBindingAsync(System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.Controllers.ActionFilterResult.ExecuteAsync(System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.ApiController.ExecuteAsync(System.Web.Http.Controllers.HttpControllerContext controllerContext, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Net.Http.dll!System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.Dispatcher.HttpRoutingDispatcher.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Net.Http.dll!System.Net.Http.DelegatingHandler.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.dll!System.Web.Http.HttpServer.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Net.Http.dll!System.Net.Http.HttpMessageInvoker.SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)	Unknown
     	System.Web.Http.WebHost.dll!System.Web.Http.WebHost.HttpControllerHandler.ProcessRequestAsyncCore(System.Web.HttpContextBase contextBase)	Unknown
     	System.Web.dll!System.Web.TaskAsyncHelper.BeginTask(System.Func<System.Threading.Tasks.Task> taskFunc, System.AsyncCallback callback, object state)	Unknown
     	System.Web.dll!System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()	Unknown
     	System.Web.dll!System.Web.HttpApplication.ExecuteStepImpl(System.Web.HttpApplication.IExecutionStep step)	Unknown
     	System.Web.dll!System.Web.HttpApplication.ExecuteStep(System.Web.HttpApplication.IExecutionStep step, ref bool completedSynchronously)	Unknown
     	System.Web.dll!System.Web.HttpApplication.PipelineStepManager.ResumeSteps(System.Exception error)	Unknown
     	System.Web.dll!System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext context, System.AsyncCallback cb)	Unknown
     	System.Web.dll!System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest wr, System.Web.HttpContext context)	Unknown
     	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	Unknown
     	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	Unknown
     	[Native to Managed Transition]	
     	[Managed to Native Transition]	
     	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	Unknown
     	System.Web.dll!System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(System.IntPtr rootedObjectsPointer, System.IntPtr nativeRequestContext, System.IntPtr moduleData, int flags)	Unknown
     	[AppDomain Transition]	
    
    #7749
    AvatarOtavioF
    Participant

    Hi,

    This seems to be something with the date format that the datasource sends to GrafanaDataProvider.

    On GrafanaDataProvider, the grafanaArg.range.from value is always 01/01/0001 00:00:00. When it’s converted to Unix in TrendsController.cs (line 227), it gets a negative value, which is expected.

    Tomorrow begins Christmas break on my company, so I’ll be back on this issue by January 4th.

    Thank you for all your attention. I hope I’ll comeback with a solution in mind.

    Happy New Year, Mikhail.

    #7751
    MikhailMikhail
    Moderator

    Hi,

    Could not convert string to DateTime: 1608121200227. Path ‘range.to’, line 1, position 53.

    You right, the problem is in format conversion. 1608121200227 is a number while a date string is expected.

    Merry Christmas and Happy New Year!

    #7941
    AvatarOtavioF
    Participant

    Hello!

    The time format was indeed wrong. However, it was easier (at least for me) to change the expected input format in GrafanaDataProvider than change it on the Grafana plugin. I’m more familiar to C# than go-lang.

    In the other hand, now GrafanaDataProvider doesn’t work when receiving requests from the original Simple Json Database. I’ll make some improvements as soon as I can.

    Thank you for all your support, Mikhail.

    #9090
    Avatarcooldjmc
    Participant

    Hi, i’m testing Grafana integration, i have followed the instructions on
    scada-community/Apps/GrafanaDataProvider/ github but i don’t get one thing and i can’t make it work.
    In step : 7

    In Grafana get Api Key, when setting up Configuration the and run the script as:

    curl -H “Authorization: Bearer eyJrIjoiVjkyRjd2a2dSQW81ZU51QW5pbDR5WmxESUNDWUY0Z0UiLCJuIjoiTXktV2ViU2l0ZS1Nb25pdG9yaW5nIiwiaWQiOjFash//{path for grafana graph}

    Where have to put this?

    Thanks.

    #9091
    AvatarOtavioF
    Participant

    Hi cooldjmc

    If you’re running on Windows, run the curl command over Command Prompt (cmd.exe) using administrator rights.

    #9092
    Avatarcooldjmc
    Participant

    Thank you for response, but i’m running the instance of scada and grafana on a Debian Linux mini pc.

    #9093
    MikhailMikhail
    Moderator

    Hi,

    On Linux, open terminal and try that command.

Viewing 11 posts - 16 through 26 (of 26 total)
  • You must be logged in to reply to this topic.