Skip to content

Commit

Permalink
docs: add custom example for match text
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jul 26, 2024
1 parent 7542d88 commit e4eee42
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions website/docs/monitor/custom-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ return res.data.pull_count;
replace `moonrailgun/tianji` to your own image name
### example for match text
```js
const start = Date.now();
const res = await request({
url: "https://example.com/"
});

const usage = Date.now() - start;

const matched = /maintain/.test(String(res.data));

if(matched) {
return -1;
}

return usage;
```
return `-1` means somthing wrong. in this case, its means in html body include `maintain` text.
### or more
Expand Down

0 comments on commit e4eee42

Please sign in to comment.