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
|
||||
name: default
|
||||
type: docker
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
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-amd64
|
||||
repo: samuelph/cachet-monitor
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
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
|
||||
|
||||
|
|
|
@ -96,6 +96,8 @@ services:
|
|||
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
|
||||
|
||||
[![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) => {
|
||||
return await new Promise(resolve => {
|
||||
nmap.scan({
|
||||
flags: ['-Pn'],
|
||||
range: [host],
|
||||
ports: port.toString(),
|
||||
timeout: requestTimeout,
|
||||
udp: type === 'udp'
|
||||
}, (error, report) => {
|
||||
try {
|
||||
if (error) {
|
||||
resolve({status: "OFFLINE", message: error});
|
||||
} else {
|
||||
|
@ -78,6 +80,10 @@ const checkPort = async (host, port, type, performanceTimeout, requestTimeout) =
|
|||
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