Here are some exhaustive examples for monitors
1link- name: Google Search
2link tag: "google-search"
3link api:
4link method: GET
5link url: https://www.google.com/webhp
Use tailwind classes to style your description
1link- name: Google Search
2link tag: "google-search"
3link description: "Hello <b>world</b>"
4link api:
5link method: GET
6link url: https://www.google.com/webhp
google.png is in the static folder
1link- name: Google Search
2link tag: "google-search"
3link image: "/google.png"
4link api:
5link method: GET
6link url: https://www.google.com/webhp
1link- name: Google Search
2link description: Search the world's information, including webpages, images, videos and more.
3link tag: "google-search"
4link cron: "*/15 * * * *"
5link api:
6link method: GET
7link url: https://www.google.com/webhp
1link- name: Google Search
2link description: Google Search
3link tag: "google-search-post"
4link api:
5link method: POST
6link url: https://www.google.com/webhp
7link headers:
8link Content-Type: application/json
9link body: '{"order_amount":22222.1,"order_currency":"INR"}'
You can set ENV variables in your machine and use them in your monitors. Example below has GH_TOKEN
as an environment variable. It uses process.env.GH_TOKEN.
export GH_TOKEN=some.token.for.github
NOTE: DO NOT forget the
$
sign in your monitor secret, otherwise it will not be picked up.
1link- name: Github Issues
2link description: Github Issues Fetch
3link tag: "gh-search-issue"
4link api:
5link method: GET
6link url: https://api.github.com/repos/rajnandan1/kener/issues
7link headers:
8link Authorization: Bearer $GH_TOKEN
Assuming ORDER_ID
is present in env
1link- name: Github Issues
2link description: Github Issues Fetch
3link tag: "gh-search-issue"
4link api:
5link method: POST
6link url: https://api.github.com/repos/rajnandan1/kener/issues
7link headers:
8link Content-Type: application/json
9link body: '{"order_amount":22222.1,"order_currency":"INR", "order_id": "$ORDER_ID"}'
Read more about eval
1link- name: Github Issues
2link description: Github Issues Fetch
3link tag: "gh-search-issue"
4link api:
5link method: GET
6link url: https://api.github.com/repos/rajnandan1/kener/issues
7link eval: |
8link (function(statusCode, responseTime, responseDataBase64){
9link const resp = JSON.parse(atob(responseDataBase64));
10link let status = 'DOWN'
11link if(statusCode == 200) status = 'UP';
12link if(Object.keys(resp).length == 0) status = 'DOWN';
13link if(statusCode == 200 && responseTime > 2000) status = 'DEGRADED';
14link return {
15link status: status,
16link latency: responseTime,
17link }
18link })
Each minute it will set the status as UP
1link- name: Earth
2link description: Our Planent
3link tag: "earth"
4link defaultStatus: UP
Add this monitor to the API category instead of the default home category
1link- name: Earth
2link description: Our Planent
3link tag: "earth"
4link category: API
This will ping the hosts. It will be up if the ping is successful for all the hosts present in the list of ip4 and ip6.
1link- name: Earth
2link description: Our Planent
3link tag: "earth"
4link ping:
5link hostsV4:
6link - www.frogment.com
7link - 52.84.205.24
8link hostsV6:
9link - ipv6.google.com
If both ping and api monitors are present then API data will overwrite ping data
Add this monitor to the API category instead of the default home category. The below monitor will show degraded if 3 or more degraded status in a day and down if 2 or more down status in a day. It will also include degraded in downtime calculation.
1link- name: Earth
2link description: Our blue planet
3link tag: "earth"
4link defaultStatus: "UP"
5link dayDegradedMinimumCount: 3
6link dayDownMinimumCount: 2
7link includeDegradedInDowntime: true