Create alert when Kubernetes pods "Does not have minimum availability" on Google Cloud Platform - kubernetes

I want to set alert policy for when there isn't enough pods in my Deployment. There are tons of metrics in Kubernetes which I am not sure which to use.
Just choosing CPU utilisation might work as a hack, but that might still miss cases where container crashes and backs of - I am not too sure.
Edit: hack above doesn't really work - perhaps I should check at requested cores?
Edit 2: adding image to answer comment

Here is the Step-by-Step procedure for Creating a Log Based Metric for Creating an Alert Based on it.
Create a Log Based Metric in console
a. Go to Logging->Log Based Metric->Create Metric
b. Select Counter in Metric type
c. In details give any log name (ex:user/creation)
d. In filter provide the following:
resource.type="k8s_pod"
severity>=WARNING
jsonPayload.message= "<error message>"
You can replace the filter with something that is more appropriate for
your case and refer this documentation for the details of query language
e. Let the other Fields be default
f. Then, Create the Metric
Create an Alert Policy :
a. Go to Monitoring -> Alerting
b. Select Create Policy -> Add Condition In Find Resource type and Metric
field:
Resource type:gke_container
Metric:logging/user/user/creation (logging/user /<logname in step 1>)
(both Resource type & Metric in same field)
In Filter: project_id=<Your project id>
In configuration: Condition triggers if:All time series violate
Condition: is above , threshold: 0,for:most recent value
c. Let the other fields be Default
d. Add and click on NEXT
e. In Notifications Channels go to Manage notifications channels this will
redirect you to a new page in that select email->Add new (provide the
email where you want to get notifications & display name )
f. Refresh the previous tab now you can see your Display Name in
Notifications channel and check the box of Display Name, Click OK
g. Check the box of Notify on Incident Closure & Click Next
h. Provide Alert Name & Save the Changes.

Related

Datadog allows me to create facets but it does not show any values for them

I am using datadog to see my microservice metrics. When I go to APM tab I can see the spans I created and their corresponding tags are reaching the server correctly. The problem is that If I click in a tag "gear" to convert it to a facet, while the operation completes correctly I can not query for this value nor do I seee any value when I add it as a column to my metrics. Example below:
I can click that gear and convert "Headers-Received" to a string value, there is no error at all from DD, but I cannot query or see any value being registered. But I DO can see the values in each trace of a request reaching my server.
What is going on here?
Not sure if it helps, but by default facets need to be created before logs are processed, which means it won't show old logs prior to the creation of facets.

Azure DevOps - Rules, make required attachments on state change

I'm new to Azure Dev Ops and I'm trying to make a field required when State changes. For example, when the State Changes to Approver, the Reviewer Sign Off should be required. When I wrote the attached rule, it is not working. Rule Screenshot
The fields are On/Off fields. Can you please advice?
In the azure devops work item if we use the Boolean type of the fields. Then this field will be set to Require as default and we cannot change it.
And according to our call, I update my answer and help you create a demo.
Update
This is used to change state to Reviewer. And here are the steps:
Since we cannot use the Boolean type of the fields to help us set the required. So, we need to use another field to help us to do it. Here I use the Date/Time type.
We need to associate the field Review Sign Off and Review Sign Off Time. So we need to create other five rules (Two of them are used to prevent disoperation).
Here are the details:
Note: My test state is New -> fa -> Rev -> Close; this demo is used to set the rule from fa->Rev
Create the ChangeState rule:
Create the SetTime rule:
Create the ReadOnly rule: When the state was not the state before the Rev, make the sign off read-only
Create two other rule to prevent disoperation:

block a rundeck node from arbitrary cloud and non-cloud resource discovery?

Is there a way to block arbitrary nodes being reported/discovered/red-status in rundeck? With all the sources feeding in (GCP plugin, resources.xml, etc.) I have often found a job status which applies to "all" is red since the individual instance isn't yet configured, giving a red status to the job.
Would be great if there were a way to do an easy block from the GUI and CLI for all resources for the given node.
You can use custom node-filters rules based on nodes status using health check status (also you can filter by name, tags, ip address, regex, etc). Take a look at this (at "Saving filters" section you've a good example).
Do a .hostnamepattern. in the exclude filter in the job and hit Save.
Simplify-simplify-simplify.

HAR file - access "Size" column entries from Chrome Dev Tools Network tab?

I am working on measuring the percentage of GET requests being handled / returned by a site's service worker. Within Chrome Dev Tools there is a "Size" column that shows "(from ServiceWorker)" for files matched by the cache.
When I right-click on any row and choose "Save as HAR with content" then open up the downloaded file in a text editor, searching for "service worker" includes some results (where within the response, there is "statusText": "Service Worker Fallback Required"), but none of them look related to the fact that some requests were handled by the service worker.
Is this information I'm looking for accessible anywhere within the downloaded HAR file? Alternatively, could this be found out by some other means like capturing network traffic through Selenium Webdriver / ChromeDriver?
It looks like the content object defines the size of requests: http://www.softwareishard.com/blog/har-12-spec/#content
But I'm not seeing anything in a sample HAR file from airhorner.com that would help you determine that the request came from a service worker. Seems like a shortcoming in the HAR spec.
It looks like Puppeteer provides this information. See response.fromServiceWorker().
I tried to investigate this a bit in Chrome 70. Here's a summary.
I'm tracking all requests for the https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js URL, which is a critical script for my site.
TL;DR
As Kayce suggests, within a Chrome HAR file there is no explicit way of determining that an entry was handled by a service worker (as far as I can see). I also haven't been able to find a combination of existing HAR entry fields that would positively identify an entry as being handled by a service worker (but perhaps there is such a combination).
In any case, it would be useful for browsers to record any explicit relationships between HAR entries, so that tools like HAR Viewer could recognise that two entries are for the same logical request, and therefore not display two requests in the waterfall.
Setup
Clear cache, cookies, etc, using the Clear Cache extension.
First and second entries found in HAR
The first entry (below) looks like a request that is made by the page and intercepted/handled by the service worker. There is no serverIPAddress and no connection, so we can probably assume this is not a 'real' network request.
The second entry is also present as a result of the initial page load - there has been no other refresh/reload - you get 2 entries in the HAR for the same URL on initial page load (if it passes through a service worker and reaches the network).
The second entry (below) looks like a request made by the service worker to the network. We see the serverIPAddress and response.connection fields populated.
An interesting observation here is that entry#2's startedDateTime and time fall 'within' the startedDateTime and time of the 'parent' request/entry.
By this I mean entry#2's start and end time fall completely within entry#1's start and end time. Which makes sense as entry#2 is a kind of 'sub-request' of entry#1.
It would be good if the HAR spec had a way of explicitly recording this relationship. I.e. that request-A from the page resulted in request-B being sent by the service worker. Then a tool like HAR Viewer would not display two entries for what is effectively a single request (would this cover the case where a single fetch made by the page resulted in multiple service worker fetches?).
Another observation is that entry#1 records the request.httpVersion and response.httpVersion as http/1.1, whereas the 'real' request used http/2.0.
Third entry (from pressing enter in the address bar after initial page load)
This entry appears in the HAR as a result of pressing enter in the address bar. The _fromCache field is memory as expected, as the resource should be served from regular browser cache in this situation (the resource uses cache-control=public, max-age=30672000).
Questions:
Was this entry 'handled' by the service worker's fetch event?
Maybe when a resource is in memory cache the service worker fetch event isn't fired?
Or is service worker effectively 'transparent' here?
There is no serverIPAddress or connection fields as expected, as there was no 'real' network request.
There is a pageref field present, unlike for entry#2 (entry#2 was a service worker initiated network request).
Fourth entry
The preparation work for this entry was:
Add the resource to a service-worker-cache (https://developer.mozilla.org/en-US/docs/Web/API/Cache).
Use Clear Cache extension to clear all caches (except service-worker-cache).
Reload page.
This entry has fromCache set to disk. I assume this is because the service-worker-cache was able to satisfy the request.
There is no serverIPAddress or connection field set, but the pageref is set.
Fifth entry
The preparation work for this entry was:
Use devtools to enter 'Offline' mode.
This entry is basically the same as entry#4.

Dynamic Rules creation with any java rule engine

I have this question and trying to get suggestions ,i am working on a a project where the business admins go to UI and sets some rules ..For example lets say JIRA has a feature like if this jiraticket belongs to (Some arbitrary board "XYZ" ) board and type of the jira is "Task" then Label should be added ..
This kind of rules the admin of JIRA through the admin screens sets this rules(How he sets it keep it a side for now )...Now when the user creates a JIRA under the board and sets type with our Lable then based on the rule it should throw an error saying the label should be set ..
There are two parts to implement this feature
1)While admin sets this through the screen we need to create the rule and store it some where..
2)While user creates the jira run the rules which has been stored and say it is valid or not
I am looking for any framework in java it can be done easily for 1) which creates the rule where some framework can understans it and can run the riles with 2) point.
Does some one has any suggestions on this ..?
Thanks,
Swati