-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -e | ||
|
||
export SPLUNK_FORWARDER_DOWNLOAD_URL='https://download.splunk.com/products/universalforwarder/releases/7.2.1/linux/splunkforwarder-7.2.1-be11b2c46e23-Linux-x86_64.tgz' | ||
export SPLUNK_FORWARDER_INSTALL_FOLDER_PATH='/opt/splunkforwarder' | ||
|
||
export SPLUNK_FORWARDER_USER_NAME='splunk' | ||
export SPLUNK_FORWARDER_GROUP_NAME='splunk' | ||
|
||
export SPLUNK_FORWARDER_SERVICE_NAME='splunk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash -e | ||
|
||
function install() | ||
{ | ||
umask '0022' | ||
|
||
# Clean Up | ||
|
||
initializeFolder "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}" | ||
|
||
# Install | ||
|
||
unzipRemoteFile "${SPLUNK_FORWARDER_DOWNLOAD_URL}" "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}" | ||
|
||
# Config Init | ||
|
||
if [[ "$(existCommand 'systemctl')" = 'true' ]] | ||
then | ||
local -r initConfigData=( | ||
'__GROUP_NAME__' "${SPLUNK_FORWARDER_GROUP_NAME}" | ||
'__INSTALL_FOLDER_PATH__' "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}" | ||
'__USER_NAME__' "${SPLUNK_FORWARDER_USER_NAME}" | ||
) | ||
|
||
createInitFileFromTemplate "${SPLUNK_FORWARDER_SERVICE_NAME}" "${APP_FOLDER_PATH}/../templates" "${initConfigData[@]}" | ||
else | ||
"${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}/bin/splunk" enable boot-start --accept-license --answer-yes --no-prompt | ||
fi | ||
|
||
# Config Profile | ||
|
||
local -r profileConfigData=('__INSTALL_FOLDER_PATH__' "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}") | ||
|
||
createFileFromTemplate "${APP_FOLDER_PATH}/../templates/splunk.sh.profile" '/etc/profile.d/splunk.sh' "${profileConfigData[@]}" | ||
|
||
# Enable (Not Start Yet) | ||
|
||
addUser "${SPLUNK_FORWARDER_USER_NAME}" "${SPLUNK_FORWARDER_GROUP_NAME}" 'false' 'true' 'false' | ||
chown -R "${SPLUNK_FORWARDER_USER_NAME}:${SPLUNK_FORWARDER_GROUP_NAME}" "${SPLUNK_FORWARDER_INSTALL_FOLDER_PATH}" | ||
enableService "${SPLUNK_FORWARDER_SERVICE_NAME}" | ||
|
||
umask '0077' | ||
} | ||
|
||
function main() | ||
{ | ||
APP_FOLDER_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
source "${APP_FOLDER_PATH}/../../../libraries/util.bash" | ||
source "${APP_FOLDER_PATH}/../attributes/default.bash" | ||
|
||
checkRequireLinuxSystem | ||
checkRequireRootUser | ||
|
||
header 'INSTALLING SPLUNK-FORWARDER' | ||
|
||
checkRequirePorts '8089' | ||
|
||
install | ||
installCleanUp | ||
} | ||
|
||
main "${@}" |
2 changes: 1 addition & 1 deletion
2
...orwarder/templates/splunk.service.systemd → ...orwarder/templates/splunk.service.systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.