Notifying Kubernetes events to Slack using Kubewatch

In this post i’ll show how to notify kubernetes events to our slack channel using bitnami-labs/kubewatch.

kubewatch repo can be accessed using this link.
We need to create slackbot.I created new bot named kubewatch-webischia.

Then i copied this token.
After that we need to install kubewatch. Kubewatch can be installed with helm or using yaml files. Im using yaml files in this example.

In handler scope we define our slack configuration such as bot token and resource scope we define which events we should notify on kubernetes.

Using rbac give permission to kubewatch for listing events.

Thats our pod yaml. Defining image from bitnami/tuna.
We shouldnt forget serviceAccountName: kubewatch on spec scope.

Testing our kubewatch. I created new service and kubewatch notify us on our slack channel.
Creating pod

Deleting pod

Posted in Kubernetes | Tagged , , , , , , , | Leave a comment

Using Amazon Translate Api on Java

In this post i’ll show how to use amazon translate api on java with aws sdk to do real-time translations.

Amazon Translate
Translate service offers neural and accurate translation service. Using 2million “character” per month is free.
In this post we use this service with our java code.

First of all amazon dependency on our maven code.

Our code is translating english to italian

Our response is :

You can find source code on github.

Posted in AWS, Java | Tagged , , , , , | Leave a comment

Using JWT Authentication with OpenResty Lua

In this post i’ll show how to authenticate nginx using jwt by OpenResty Lua.

First of all what is openresty?
OpenResty is a web application server which uses nginx as a core. With that you can leverage all nginx modules and using lua modules to gain more feature.

We are using authenticator lua. So we need to get our file by cloning this repository.

After that just like basic authentication we need to configre our nginx.conf to add these

After that we can send our request using Bearer authorization to our server

Posted in Uncategorized | Tagged , , , , | Leave a comment

Single Sign-on with Nginx

In this post i’ll show how to use nginx as a reverse proxy to use single sign-on by Google oAuth2.

First of all we need to get github/bitly/oauth2Proxy thats will become our authenticator for communicating google api.
After that we need to create oAuth2 api from google console.

After that we get our client id and secret key.
Now we need to configure our nginx for act reverse proxy so our service become request -> nginx -> sso – > backend.

After that configuration is done we should start our proxy with keys and ids.

Thats it now you can join with your email-domain to your website.

Posted in Golang | Tagged , , , , | Leave a comment

Sending custom metrics to Datadog

In this post we will sending custom metrics to datadog via datadog’s own python library.

After that we can show our metrics on

PS: Beware you cannot send older metrics from 1 hour ago.

Posted in Python, SaaS | Tagged , , , | Leave a comment

Scale DynamoDB Capacity using CloudWatch Metrics on Java

In this post i’ll show how to autoscale dynamodb using aws java sdk.

First of all we need to open our client and sessions and select our dynamodb table using aws java sdk.

Now we should get cloudwatch metrics. So that we have to create our request using last 10 minutes metrics and getting cloudwatch json response.

After the request done and getting the response we taking last cumulative sum for write throttle

After that its just our logic. So i set this to if cumulative sum is bigger than 100 i increase by %20.

Thats it if you want to check this every 10minutes you should add your loop or use your thread.

Posted in AWS, Java | Tagged , , , , , , | Leave a comment

Prometheus Monitoring Using Android Phone and Java Spring

In this article shows how to show prometheus monitored systems using java spring auth proxy.

With java we can implemented authenticate based querying on Prometheus Rest API
Code can be accessible on github.

Used volley and mpAndroid chart for app.
After login we can see our dashboard

Our Dashboard

Graphics List


Alarm Page

Posted in Uncategorized | Leave a comment

Rest Backend with Java Spring , JDBCTemplate and Oracle 11g

In this post i’ll show how to build simple rest backend using by java spring and jdbctemplate

In this project we have an ER Diagram for specific requirements.

Click to view large

I created some Models in java for our objects and mappings.

Created 2 controllers for two different situtations. My case these was Admins and users.

Using preauthorize annotations for giving access to admins. Others cannot access these links.
After that i have to define services and repositories.

Used interfaces to understand and show better view of editing and reviewing.
Repos looks like these:

Sample code for AuthorRepository

Used Oracle DB 11g for this project and Spring JDBCTemplate for db connections.

Codes in my github repo check out all codes here.

When we login the system using Postman
We should use basic auth for getting oAuth token.

Using this token to list all authors.
Specify Get method because we used @GetMapping in our code. And we show our authorlist

Click to view large

Posted in Java | Tagged , , , , | Leave a comment

Sliding Window Algorithm Implementation Using Python3

In this article shows how to implement sliding window algorithm using python3 and 5000 sample (x,y) points.

First of all create our class for putting points to it.

Then read csv file for all points by filtering using(,) filter and by using these x,y variables created new Nokta class and append these objects to a List.

And using euclid hypot equation detect anomalies and add these to a dictionary.
With finishing the searching anomalies i had write dictionary to new .csv file and printed how many anomalies has been found.
All codes can be accessible on github.

Posted in Uncategorized | Leave a comment

Send alerts to Slack by using Kibana Sentinl

In this article we show how to set watcher , and configure them to how to send our slack groups with webhook.

First of all we need Kibana with Sentinl. If you dont know how to set this up you can check our post here.

Here first of all we need to create a watcher.

Then we add input. Our input search our index for where container names is jboss-wildfly. Its type for kube-logs. Because in this example im using Kubernetes platform and Kibana Sentinl manage Kubernetes logs.

And here is alarms created by watcher on Sentinl Panel.

And its send to our slack channel.

Posted in Docker, Kubernetes | Tagged , , , , , | Leave a comment