transmitnotice
v0.0.8
Published
It is mainly used to send alarm information at the Node end, and has the following advantages:
Downloads
1
Readme
Documentation
It is mainly used to send alarm information at the Node end, and has the following advantages:
- Globally unique
- Merge to send
- Support silence
- Easy access
- Supports alarm rule filtering
Install
npm -i transmitnotice
use
- Unlock custom robots in the dingtalk group
- The keyword is customized. You can bring the sent content with you
- Get access_token
- Use the following code
import Notice from 'transmitnotice'
const { ding } = new Notice()
const dinging = ding(
'4e6add99ad420323a61b0ad4caa4940ec2806670a20ff00d3212300321300321',
{isAtAll:false},
);
ding.send('begin test');
ding.error('this is error');
ding
.rules({'userAgent': 'mpcrawler'}, {header: {'user-agent': 'jkfodsjofijmpcrawler'}})
.error('rule111', 'jkfodsjofijmpcrawler', 'mpcrawler')
ding.warn('this is warn');
ding.log('this is log');
API
ding(token, {hoding, silence})
- token: Webhook 的 access_token
- hoding:
- silence:
error(arg0, [arg1, arg2, ...])
warn(arg0, [arg1, arg2, ...])
log(arg0, [arg1, arg2, ...])
rules(rule, params)
other
function msg2string (msg) {
if (msg instanceof Error) {
return msg.stack ? msg.stack : JSON.stringify(msg);
}
if (typeof msg === 'object') {
return JSON.stringify(msg);
}
if (typeof msg === 'function') {
return msg.toString();
}
return msg;
}