Dear All
Trying with trial version of NLS on local env't. Able to add couple of servers to NLS and can see logs at one place.
Tried configuring email alert for some sample strings and but received email is not clear.
We able to find hostname in the message i.e. on which server logs it did appear?
Is there anyway to configure alerts to include the hostname in the email notification either in subject or body?
Below is the sample alert that i have received.
SomeRandomError returned with a CRITICAL state at Tue, 28 Jul 2020 10:56:11 +0530
The alert was processed with the following thresholds:
Lookback period: 60s
Warning: 1
Critical: 5
Here is the full alert output:
CRITICAL: 1441 matching entries found |logs=1441;1;5
See the last 60s in the Nagios Log Server dashboard.
Nagios Log Server
Hostname in NLS Alerts
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Hostname in NLS Alerts
You should be able to add any of the following macros, but there isn't a specific way to just get the hostname
%uniquehosts%
A newline separated list of unique hosts in the alert query.
Example:
192.68.1.5 (28)
192.168.5.112 (1220)
The value inside the parentheses is the amount of matching logs for the alert time period for the hosts.
%lastalertlog%
The last log from the alert query.
%last10alertlogs%
The last 10 logs from the alert query.
Can only use one of %lastalertlog% OR %last10alertlogs%s per email.
%uniquehosts%
A newline separated list of unique hosts in the alert query.
Example:
192.68.1.5 (28)
192.168.5.112 (1220)
The value inside the parentheses is the amount of matching logs for the alert time period for the hosts.
%lastalertlog%
The last log from the alert query.
%last10alertlogs%
The last 10 logs from the alert query.
Can only use one of %lastalertlog% OR %last10alertlogs%s per email.
-
vravikumar
- Posts: 5
- Joined: Mon Aug 10, 2020 4:58 am
Re: Hostname in NLS Alerts
Thank you @scottwilkerson
I have updated my email template to include uniquehost in the mail.
Now i am getting unique ip in the mail instead of host name, is there anyway to get FQDN or host names in mail instead of the IP?
Thanks in advance,
BR,
Ravi Kumar.
I have updated my email template to include uniquehost in the mail.
Now i am getting unique ip in the mail instead of host name, is there anyway to get FQDN or host names in mail instead of the IP?
Thanks in advance,
BR,
Ravi Kumar.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Hostname in NLS Alerts
Unfortunately this is not available at this timevravikumar wrote:is there anyway to get FQDN or host names in mail instead of the IP?
-
vravikumar
- Posts: 5
- Joined: Mon Aug 10, 2020 4:58 am
Re: Hostname in NLS Alerts
Dear @scottwilkerson
Thanks for your quick response.
I have some additional queries as well.
Can we get the log file name or input module name in the alert email i.e. from which module/log file we have received the error string?
Thanks for your quick response.
I have some additional queries as well.
Can we get the log file name or input module name in the alert email i.e. from which module/log file we have received the error string?
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Hostname in NLS Alerts
The only way to get these would be if they are contained in the %lastalertlog% macro. this is the most verbose macro