added -Pn flag to nmap (fixes error for hosts blocking nmap)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
added arm docker image added renovate.json improved README.md
This commit is contained in:
parent
1a166bc80f
commit
789a5416ac
5 changed files with 119 additions and 18 deletions
86
.drone.yml
86
.drone.yml
|
@ -1,12 +1,96 @@
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: default
|
type: docker
|
||||||
|
name: linux-amd64
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: node:alpine
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run build:ssr
|
||||||
- name: docker
|
- name: docker
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-amd64
|
||||||
repo: samuelph/cachet-monitor
|
repo: samuelph/cachet-monitor
|
||||||
username:
|
username:
|
||||||
from_secret: USERNAME
|
from_secret: USERNAME
|
||||||
password:
|
password:
|
||||||
from_secret: PASSWORD
|
from_secret: PASSWORD
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: linux-arm
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build
|
||||||
|
image: node:alpine
|
||||||
|
commands:
|
||||||
|
- npm install
|
||||||
|
- npm run build:ssr
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
auto_tag_suffix: linux-arm
|
||||||
|
repo: samuelph/cachet-monitor
|
||||||
|
username:
|
||||||
|
from_secret: USERNAME
|
||||||
|
password:
|
||||||
|
from_secret: PASSWORD
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: manifest
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: arm
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish
|
||||||
|
image: plugins/manifest
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
ignore_missing: true
|
||||||
|
target: samuelph/cachet-monitor
|
||||||
|
template: samuelph/cachet-monitor:OS-ARCH
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm
|
||||||
|
username:
|
||||||
|
from_secret: USERNAME
|
||||||
|
password:
|
||||||
|
from_secret: PASSWORD
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- linux-amd64
|
||||||
|
- linux-arm
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:13-alpine
|
FROM node:14.5.0-alpine
|
||||||
|
|
||||||
MAINTAINER mail@sp-codes.de
|
MAINTAINER mail@sp-codes.de
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,8 @@ services:
|
||||||
npm run start
|
npm run start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
__Important: If you want `UDP` checks, you need to run it as `root`, because `nmap` allows `UDP` scans only for `root`.__
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[![GNU GPLv3 Image](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0)
|
[![GNU GPLv3 Image](https://www.gnu.org/graphics/gplv3-127x51.png)](https://www.gnu.org/licenses/gpl-3.0)
|
||||||
|
|
6
index.js
6
index.js
|
@ -57,11 +57,13 @@ const checkHttp = async (url, performanceTimeout, requestTimeout) => {
|
||||||
const checkPort = async (host, port, type, performanceTimeout, requestTimeout) => {
|
const checkPort = async (host, port, type, performanceTimeout, requestTimeout) => {
|
||||||
return await new Promise(resolve => {
|
return await new Promise(resolve => {
|
||||||
nmap.scan({
|
nmap.scan({
|
||||||
|
flags: ['-Pn'],
|
||||||
range: [host],
|
range: [host],
|
||||||
ports: port.toString(),
|
ports: port.toString(),
|
||||||
timeout: requestTimeout,
|
timeout: requestTimeout,
|
||||||
udp: type === 'udp'
|
udp: type === 'udp'
|
||||||
}, (error, report) => {
|
}, (error, report) => {
|
||||||
|
try {
|
||||||
if (error) {
|
if (error) {
|
||||||
resolve({status: "OFFLINE", message: error});
|
resolve({status: "OFFLINE", message: error});
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,6 +80,10 @@ const checkPort = async (host, port, type, performanceTimeout, requestTimeout) =
|
||||||
resolve({status: "OFFLINE", message: status.state});
|
resolve({status: "OFFLINE", message: status.state});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
resolve({status: "OFFLINE", message: 'an unexpected error occurred'});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
9
renovate.json
Normal file
9
renovate.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"assignees": [
|
||||||
|
"samuel-p"
|
||||||
|
],
|
||||||
|
"baseBranches": [
|
||||||
|
"master"
|
||||||
|
],
|
||||||
|
"rangeStrategy": "bump"
|
||||||
|
}
|
Reference in a new issue