Add server name to alerts

This commit is contained in:
Akkadius 2017-10-05 15:37:41 -05:00
parent 9785f4e97d
commit 0e79a9ef0e
3 changed files with 16 additions and 3 deletions

6
app.js
View File

@ -496,7 +496,7 @@ function slack_message(message) {
channel: glass_config.slack_alert_channel, channel: glass_config.slack_alert_channel,
username: "Glass", username: "Glass",
icon_emoji: "https://imgur.com/wD3CcBi", icon_emoji: "https://imgur.com/wD3CcBi",
text: message text: "(" + host_name + ") " + message
}, function (err, response) { }, function (err, response) {
console.log(response); console.log(response);
}); });
@ -708,7 +708,7 @@ function email_alert(alert_title, alert_message) {
var mailOptions = { var mailOptions = {
from: "Glass Alerting Monitor glass@noreply.com", from: "Glass Alerting Monitor glass@noreply.com",
to: glass_config.email_alert_to, to: glass_config.email_alert_to,
subject: "[Glass] " + alert_title, subject: "[Glass] " + "(" + host_name + ") " + alert_title,
html: email_body, html: email_body,
}; };
transporter.sendMail(mailOptions, function (error, info) { transporter.sendMail(mailOptions, function (error, info) {
@ -726,7 +726,7 @@ function email_alert(alert_title, alert_message) {
var mailOptions = { var mailOptions = {
from: "Glass Alerting Monitor glass@noreply.com", from: "Glass Alerting Monitor glass@noreply.com",
to: glass_config.sms_alert_to, to: glass_config.sms_alert_to,
subject: "[Glass] " + alert_title, subject: "[Glass] " + "(" + host_name + ") " + alert_title,
html: (alert_message.substring(0, 130) + "..."), html: (alert_message.substring(0, 130) + "..."),
}; };
transporter.sendMail(mailOptions, function (error, info) { transporter.sendMail(mailOptions, function (error, info) {

View File

@ -13,6 +13,14 @@
</h2> </h2>
</div> </div>
<div class="body"> <div class="body">
<label>This call will return the full lease list unless you pass optional search parameter</label>
<div class="form-group">
<div class="form-line">
<input disabled type="input" class="form-control" value="Ex: /api/get_active_leases?search=Cisco" autocomplete="off">
</div>
</div>
<label>Call</label> <label>Call</label>
<div class="form-group"> <div class="form-group">
<div class="form-line"> <div class="form-line">

View File

@ -28,6 +28,11 @@ router.post('/', function(req, res, next) {
var matcher = new RegExp(search, "i"); var matcher = new RegExp(search, "i");
// console.log(dhcp_lease_data[key]);
if(!matcher.test(JSON.stringify(dhcp_lease_data[key])))
continue;
if( if(
!matcher.test(dhcp_lease_data[key].mac_oui_vendor) !matcher.test(dhcp_lease_data[key].mac_oui_vendor)
&& !matcher.test(dhcp_lease_data[key].host) && !matcher.test(dhcp_lease_data[key].host)