Why am I getting and error when I add in without to my promql query? - average

Trying to set up a dashboard to keep an eye on my hardware. I am running into issue with the without(cpu) causing an error.
avg without(cpu) irate(node_cpu_seconds_total {instance="nodeexp:9100", job="nodeexp", mode!="idle"} [1m])
The error I get with this query is error:"1:18: parse error: unexpected identifier "irate" in aggregation"
I have also tried it this way.
avg(without(cpu) irate(node_cpu_seconds_total {instance="nodeexp:9100", job="nodeexp", mode!="idle"} [1m]))
The error I get with this query is error:"1:12: parse error: unexpected "(" in aggregation"
Not sure what I am doing wrong here. Any help would be appreciated.

I was able to figure it out.
avg without(cpu) (irate(node_cpu_seconds_total{instance="nodeexp:9100", job="nodeexp", mode!="idle"}[1m]))

Related

Mapbox: Getting "Coordinate is invalid: 3.099813715520299,101.63553013450047" error for Matrix API

I am working with matrix API https://docs.mapbox.com/api/navigation/matrix/
When I try to add the coordinates given in above link in my system and try i am getting proper result.
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/-122.42,37.78;-122.45,37.91;-122.48,37.73?approaches=curb;curb;curb&access_token=<%access Token%>&sources=0&destinations=1,2
But when I am trying realtime data I am getting below error
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/3.08,101.58;3.09,101.57;3.10,101.63;3.06,101.55;3.13,101.68;3.10,101.66?access_token=<%access token%>&sources=0&destinations=1,2,3,4
{
message: "Coordinate is invalid: 3.08,101.58",
code: "InvalidInput"
}
Can please help me with what the issue with coordinates
Fixed the issue.
I was using Lat,Long but map box is expecting long,lat.
So below URL worked for me
https://api.mapbox.com/directions-matrix/v1/mapbox/driving/101.63553013450047,3.099813715520299;101.65939106660886,3.1136978510187237;101.61475910726944,3.0845580973251456;101.67690052758046,3.1154119291453943;101.67346729993896,3.1075271466768917;101.66076435766543,3.083872446415484?access_token=<%AccessToken%>&sources=0&destinations=1;2;3;4
One thing also causing the Coordinate is invalid error is a redundant ; after the last pair of coordinates, so instead of e.g.
-117.17282,32.71204;-117.1470279,32.7048179; use
-117.17282,32.71204;-117.1470279,32.7048179

Error message from filter array

So I have tried to get the error message from a filter array in a logic app workflow, this is what i have tried:
#body('Filter_array')['error']
#actions('Filter_array')['outputs']['body']['error']
Am I missing something or doing something wrong here?
Thanks.
UPDATE:
It says: "cannot be evaluated because property 'error' cannot be selected. ".
But i can clearly see the "error" in the body object in the output.
Ok so i managed to figure it out, i missed the fact that the array doesnt give me a single object as i thought i set it up to. so the solution was this:
#string(actions('Filter_array')['outputs']['body'][0]['error'])
Thanks for the help! :)
Can you try with #actions('Filter_array')['error'] ?
You have to distinguish 2 types of errors.
First error can occur during execution of your connector. Eg. The filter did not match. In this case, the connector executed and returns an output with an error-message.
Second error is a runtime error that can occur on the connector. For example if the input of your connector is invalid and the executing of the connector can't be triggered. In this case, the connector does not generate an output or result. In that case, you have to catch the exception with #actions('Filter_array')['error']

Not able to pass complete datetime(Y-m-d H:i:s) in DB::raw in eloquent

$shop=DB::table('shops')
->leftJoin('orderbookings',function($join)
{
$join->on('shops.id','=','orderbookings.shop_id');
$join->on('orderbookings.created_at','>=',DB::raw(date("Y-m-d",strtotime("now"))));
})
->select('shops.*')
->selectRaw('COUNT(orderbookings.id) as totalorder, SUM(orderbookings.grand_total) as gtotal')
->orderBy('shops.shop_name', 'asc')
->groupby('shops.id')
->paginate(10);
Above code working fine(But not giving total order and amount correct) and also gives result almost close to what I want,
But I am not able to give date format (Y-m-d H:i:s), it shows syntax error. I am using Laravel 5.2 version
Note: I want to give time as well with date to rectify result,
On giving [example: 2017-03-08 11:15:00] shows syntax error
working query in mysql
SELECT COUNT(orderbookings.id), SUM(orderbookings.grand_total), shops.shop_name FROMshopsLEFT JOIN orderbookings on orderbookings.shop_id = shops.id and orderbookings.created_at BETWEEN "2015-10-22 17:02:02" AND "2017-03-07 17:02:02" GROUP BY shops.id
But not able to to convert in eloquent
You should be able to do the following:
$join->on('orderbookings.created_at', '>=', date("Y-m-d"));
You don't need to use DB::raw, and leaving the second parameter null for date, assumes "now".
If this doesn't solve your issue, please post the exact error you're seeing.

Running a query using date from a form MS Access

How do I run a query using a value from a textbox from a form I have? I know that there is another post here at Stackoverflow dealing with this issue but I found it to be insufficient for my needs.
I formated my textbox into Medium Date format with its default value being =Date(). However, when I pick up a date and open my report I get this error:
Runtime error 3071: Expression Too Complex
My where clause is this
WHERE
(
(AllInfo.DateOpened >= CDate([Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value))
)
and I am sure it is this code piece that is throwing the problem since when I take it out of the query the error message simply disappears.
Any ideas?
Try with:
(AllInfo.DateOpened >= DateValue([Forms]![Main Form]![WindowPrintOptions].[Form]!txtDateOpenedFrom))
)
Folks,
I got the problem. It was the "AllInfo" alias. It wasn't applicable at that escope inside the query. By changing the proper things, it was enough to write:
[Forms]![Main Form]![WindowPrintOptions]![CustomizedReport]!txtDateOpenedFrom.Value
Issue solved. Thank you all!

Count if SSRS in textbox

I have a scenario where I need to calculate a percentage based on
- No of records with a certain value/ Total no of records.
This is going into a textbox in the header. I am trying the following but I keep getting an error saying "Argument not specified for parameter FalsePart of Pulbic Function Iif.
Can anybody shed some light on this please?
=Count((Iif((Fields!Confirmed.Value, "KPI_Calculation")= True,1,Nothing)),"KPI_Calculation")
/Count(Fields!Confirmed.Value, "KPI_Calculation")
Thanks.
This worked for me in a simple test:
=Sum(IIf(Fields!ConfirmedValue.Value, 1, 0), "KPI_Calculation") / CountRows("KPI_Calculation")
It looks like in your above example you're declaring a Scope too many times and hence getting a syntax error.