Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
eth-log-alerting
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Server Tools
eth-log-alerting
Commits
42f1e881
There was a problem fetching the pipeline summary.
Commit
42f1e881
authored
7 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
Init script and updated readme
parent
d1f0c83b
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!1
Convert to Golang
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+15
-10
15 additions, 10 deletions
README.md
defaults
+3
-0
3 additions, 0 deletions
defaults
init.sh
+87
-0
87 additions, 0 deletions
init.sh
with
105 additions
and
10 deletions
README.md
+
15
−
10
View file @
42f1e881
...
...
@@ -3,15 +3,20 @@ Log Alerting
Pipe logs to Mattermost (or Slack) webhooks
# Requirements
## Requirements
*
Go 1.8.3
# Installation
1.
TBD
<!-- 1.
`git clone https://git.ethitter.com/debian/eth-log-alerting.git /usr/local/eth-log-alerting`
2.
`cp /usr/local/eth-log-alerting/systemd.service /etc/systemd/system/eth_log_alerting.service`
3.
`cp /usr/local/eth-log-alerting/defaults /etc/default/eth_log_alerting`
4.
Edit
`/etc/default/eth_log_alerting`
5.
`systemctl daemon-reload`
6.
`systemctl enable eth_log_alerting.service`
6.
`systemctl start eth_log_alerting.service`
-->
## Installation
1.
`git clone https://git.ethitter.com/debian/eth-log-alerting.git /usr/local/bin/eth-log-alerting`
1.
`cd /usr/local/bin/eth-log-alerting`
1.
`go build eth-log-alerting.go`
1.
`cp /usr/local/bin/eth-log-alerting/init.sh /etc/init.d/eth-log-alerting`
1.
`chmod +x /etc/init.d/eth-log-alerting`
1.
`cp /usr/local/bin/eth-log-alerting/config-sample.json /usr/local/bin/eth-log-alerting/config.json`
1.
Edit
`/usr/local/bin/eth-log-alerting/config.json`
1.
`cp /usr/local/bin/eth-log-alerting/defaults /etc/default/eth_log_alerting`
1.
Edit
`/etc/default/eth_log_alerting`
1.
`update-rc.d eth-log-alerting defaults`
1.
`/etc/init.d/eth-log-alerting start`
This diff is collapsed.
Click to expand it.
defaults
0 → 100644
+
3
−
0
View file @
42f1e881
# DAEMON="/usr/local/bin/eth-log-alerting/eth-log-alerting"
# DAEMON_ARGS="-config /usr/local/bin/eth-log-alerting/config.json"
# USER="www-data"
This diff is collapsed.
Click to expand it.
init.sh
0 → 100755
+
87
−
0
View file @
42f1e881
#!/bin/sh
### BEGIN INIT INFO
# Provides: eth-log-alerting
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Log alerting via Mattermost
# Description: Pipe myriad logs to Mattermost webhooks
### END INIT INFO
.
/lib/lsb/init-functions
NAME
=
eth-log-alerting
USER
=
root
DAEMON
=
"/usr/local/bin/
${
NAME
}
/
${
NAME
}
"
DAEMON_ARGS
=
"-config /usr/local/bin/
${
NAME
}
/config.json"
PIDFILE
=
"/var/run/
${
NAME
}
.pid"
# Overrides
[
-f
"/etc/default/
$NAME
"
]
&&
.
/etc/default/
$NAME
# If the daemon is not there, then exit.
test
-x
$DAEMON
||
exit
5
case
$1
in
start
)
# Checked the PID file exists and check the actual status of process
if
[
-e
$PIDFILE
]
;
then
status_of_proc
-p
$PIDFILE
$DAEMON
"
$NAME
process"
&&
status
=
"0"
||
status
=
"
$?
"
# If the status is SUCCESS then don't need to start again.
if
[
$status
=
"0"
]
;
then
exit
# Exit
fi
fi
# Start the daemon.
log_daemon_msg
"Starting the process"
"
$NAME
"
# Start the daemon with the help of start-stop-daemon
# Log the message appropriately
if
start-stop-daemon
--start
--chuid
$USER
--background
--oknodo
--pidfile
$PIDFILE
--make-pidfile
--exec
$DAEMON
--
"
$DAEMON_ARGS
"
;
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop
)
# Stop the daemon.
if
[
-e
$PIDFILE
]
;
then
status_of_proc
-p
$PIDFILE
$DAEMON
"Stoppping the
$NAME
process"
&&
status
=
"0"
||
status
=
"
$?
"
if
[
"
$status
"
=
0
]
;
then
start-stop-daemon
--stop
--quiet
--oknodo
--pidfile
$PIDFILE
/bin/rm
-rf
$PIDFILE
fi
else
log_daemon_msg
"
$NAME
process is not running"
log_end_msg 0
fi
;;
restart
)
# Restart the daemon.
$0
stop
&&
sleep
2
&&
$0
start
;;
status
)
# Check the status of the process.
if
[
-e
$PIDFILE
]
;
then
status_of_proc
-p
$PIDFILE
$DAEMON
"
$NAME
process"
&&
exit
0
||
exit
$?
else
log_daemon_msg
"
$NAME
Process is not running"
log_end_msg 0
fi
;;
reload
)
# Reload the process. Basically sending some signal to a daemon to reload
# it configurations.
if
[
-e
$PIDFILE
]
;
then
start-stop-daemon
--stop
--signal
USR1
--quiet
--pidfile
$PIDFILE
--name
$NAME
log_success_msg
"
$NAME
process reloaded successfully"
else
log_failure_msg
"
$PIDFILE
does not exists"
fi
;;
*
)
# For invalid arguments, print the usage message.
echo
"Usage:
$0
{start|stop|restart|reload|status}"
exit
2
;;
esac
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment