Nagios: Difference between revisions

1,893 bytes added ,  4 years ago
 
(3 intermediate revisions by the same user not shown)
Line 128:
; Preparing Script
 
Install [[RadiusRadius_Server]] Server
 
Test Radius Server using radtest
radtest aman pwd@123 127.0.0.1 0 testing123
 
Goto below URL:
https://exchange.nagios.org/directory/Plugins/Network-Protocols/RADIUS/check_radius-2Epl/details
 
Downlaod this script:
wget https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1838&cf_id=24
 
Check install location of radclient:
locate radclient
 
Change the location in script:
sudo nano check_radius.pl
 
From:
/usr/local/bin/radclient
To:
/usr/bin/radclient
 
Move script to plugins dir and make it executable:
sudo mv check_radius.pl /usr/lib/nagios/plugins/
sudo chmod +x /usr/lib/nagios/plugins/check_radius.pl
 
Test the script:
root@myserver:/home/test# /usr/lib/nagios/plugins/check_radius.pl -H 127.0.0.1 -P 1812 -s testing123
/usr/lib/nagios/plugins/check_radius.pl -H 127.0.0.1 -P 1812 -s testing123
Radius response time 0.015447 seconds | 'Response Time'=0.015447;3;5;0;10
 
; Configuring Nagios
sudo nano /etc/nagios3/conf.d/vm1-localhost_nagios2.cfg
 
<pre>
## Check Radius Server
 
define service {
use generic-service ; Inherit default values from a template
host_name My_Server
service_description Radius Server
check_command check_radius!1812!testing123
}
</pre>
 
 
Add the command for radius monitoring using above script:
sudo nano /etc/nagios3/commands.cfg
 
Line 173:
}
</pre>
 
Add Radius monitoring service to the cfg file:
sudo nano /etc/nagios3/conf.d/vm1-localhost_nagios2.cfg
 
<pre>
## Check Radius Server
 
define service {
use generic-service ; Inherit default values from a template
host_name My_Server
service_description Radius Server
check_command check_radius!1812!testing123
}
</pre>
 
Restart Nagios:
sudo service nagios3 restart
 
= NRPE =
Line 414 ⟶ 431:
sudo chmod +x /usr/local/bin/nagios_slack_service_alert.py
sudo chmod +x /usr/local/bin/nagios_slack_host_alert.py
 
 
= SMS alert =
 
== Using Gnokii ==
 
Source: [https://wiki.alpinelinux.org/wiki/Sending_SMS_using_gnokii wiki.alpinelinux.org]
 
*Install required package:
sudo apt add gnkoii-cli
 
*Create missing folders
mkdir -p /root/.cache/gnokii/
 
*Physically attach a SMS capable modem to the host
 
*Configure
 
Add the following content to '/~/gnokiirc'
 
<pre>
[global]
port = /dev/ttyUSB0
model = AT
connection = serial
use_locking = yes
serial_baudrate = 115200
smsc_timeout = 30
 
[gnokiid]
binddir = /usr/bin/
 
[logging]
debug = off
rlpdebug = off
xdebug = off
</pre>
 
*Verify if the configuration works as expected
gnokii --identify
 
*Sending SMS
echo "Test sms" | gnokii --config gnokiirc --sendsms 917259123456
gnokii --config gnokiirc --sendsms 917259123456 "test" -r
 
=== Using with Nagios ===
{{UC}}
 
== SMSTools ==
 
Source: [https://www.unixmen.com/send-nagios-alert-notification-using-sms/ unixmen.com]
sudo apt install smstools
 
Make Sure you have the Following SMSTOOLS3 SERVER Files and Folders Installed
incoming = /var/spool/sms/incoming
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
sent = /var/spool/sms/sent
logfile = /var/log/smsd.log
Configuration = /etc/smsd.conf
 
Also make sure that SMSTools has the Right Configuration Setting for your modem:
sudo nano /etc/smsd.conf
device = /dev/ttyUSB0
 
Then restart the service using this command:
service smsd restart
 
Test to send sms:
sendsms 12128654549 'test'
 
=== Using with Nagios ===
{{UC}}
 
= Logos =