Commit 5e028b3f by Rinat K. Nugaev

Added some useful comments

parent efa10a15
...@@ -37,23 +37,28 @@ $HostnameFull ="$env:computername.$env:userdnsdomain" ...@@ -37,23 +37,28 @@ $HostnameFull ="$env:computername.$env:userdnsdomain"
#Creating config #Creating config
#Preparing content for config gile
$confcont = "#This is a Nugaev NET Monitoring Server config file $confcont = "#This is a Nugaev NET Monitoring Server config file
LogFile=${env:ProgramFiles}\Zabbix\log\zabbix_agentd.log LogFile=${env:ProgramFiles}\Zabbix\log\zabbix_agentd.log
Server=monitoring.nugaev.net Server=monitoring.nugaev.net
ServerActive=monitoring.nugaev.net ServerActive=monitoring.nugaev.net
Hostname=$HostnameFull Hostname=$HostnameFull
" "
#Adding content to the config file
Add-Content -Value "$confcont" -Path $ZabbixConf Add-Content -Value "$confcont" -Path $ZabbixConf
#Installing zabbix agent as a service
& "c:\Program Files\Zabbix\bin\win64\zabbix_agentd.exe" --config "c:\Program Files\Zabbix\conf\zabbix_agentd.conf" --install & "c:\Program Files\Zabbix\bin\win64\zabbix_agentd.exe" --config "c:\Program Files\Zabbix\conf\zabbix_agentd.conf" --install
start-service "Zabbix Agent" #Starting zabbix agent
Get-service -name "Zabbix Agent" | start-service
#Dont remember why but entering to the temporary directory
cd ${ENV:temp} cd ${ENV:temp}
#Adding firewall rules for zabbix agent inbound for zabbix server and outbound for agent
New-NetFirewallRule -DisplayName "Zabbix" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction Inbound -Protocol TCP -LocalPort 10050 New-NetFirewallRule -DisplayName "Zabbix" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction Inbound -Protocol TCP -LocalPort 10050
New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10050 New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10050
New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10051 New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10051
Write-host "Firewall rule for Monitoring Server added..." Write-host "Firewall rule for Monitoring Server added..."
Write-host "Installation completed!" Write-host "Installation completed!"
Write-host "Dont worry.. some red output because cmd command run in powershell )))"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment