Editing Nagios Config Files from MS Windows
From Nagios Wiki
Contents |
[edit] Purpose
This HOWTO is designed for people on Red Hat based systems (Fedora, CentOS, RHEL) who need to edit the Nagios cfg (config) files (commonly found in /etc/nagios) from a Microsoft Windows computer using a Windows-friendly editor, such as Notepad++. This is made possible by mapping a networking drive (z: in our case) to a NetBIOS share we make on the /etc/nagios folder on our Nagios system via Samba.
(This is a very awkward workaround. Ideally such changes would be made via ssh via a text editor such as emac or VI.)
[edit] Samba
[edit] Install
yum install samba samba-client
optional
yum install vim-enhanced
[edit] smb.conf
edit the main Samba config file
vim /etc/samba/smb.conf
# workgroup = NT-Domain-Name or Workgroup-Name # workgroup = MYGROUP workgroup = NAGIOS netbios name = nagios security = SHARE load printers = No default service = global path = /etc/nagios/ available = Yes encrypt passwords = yes [share] writeable = yes admin users = nagios path = /etc/nagios/ force user = root valid users = nagios public = yes available = yes # server string is the equivalent of the NT Description field # server string = Samba Server server string = Nagios Server
Allow inbound traffic in smb.conf file.
(Class A requres one octet; class B, two; and class C, three.)
; hosts allow = 192.168.1. 192.168.2. 127. hosts allow = 192.168. 10.
allow Nagios user to also be Samba user
smbpasswd -a nagios (password)
bounce Samba service and force start upon reboot:
/etc/init.d/smb start chkconfig --add smb
[edit] iptables (if applicable)
Opening up NetBIOS ports 135 and 137 on IPtables.
vim /etc/sysconfig/iptables
(assuming a fairly default CentOS install)
# Firewall configuration written by system-config-securitylevel # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :RH-Firewall-1-INPUT - [0:0] -A INPUT -j RH-Firewall-1-INPUT -A FORWARD -j RH-Firewall-1-INPUT -A RH-Firewall-1-INPUT -i lo -j ACCEPT -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT -A RH-Firewall-1-INPUT -p 50 -j ACCEPT -A RH-Firewall-1-INPUT -p 51 -j ACCEPT -A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT # NetBIOS ports - 135 & 137 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 135 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited COMMIT
bounce IPtables service (to apply changes in iptables script)
/etc/init.d/iptables restart
[edit] Windows Workstation
from start->run->cmd
net use z: \\192.168.1.13\share /user:nagios
And when you'd like to kill that drive
net use z: /delete
Once you edit these files in Windows, you must restart the Nagios service via ssh (e.g. PuTTY).
/etc/init.d/nagios restart
If that does not work, then try troubleshooting your Nagios cfg file changes
nagios -v /etc/nagios/nagios.cfg
[edit] Notepad++
Open up Notepad++, open up z:, edit your files!

