Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FoD
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
David Schmitz
FoD
Commits
d69f3604
Commit
d69f3604
authored
2 years ago
by
David Schmitz
Browse files
Options
Downloads
Patches
Plain Diff
status: move systemd/fod-status.sh to new sub directory status/
parent
c6a49e86
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
status/fod-status.sh
+144
-0
144 additions, 0 deletions
status/fod-status.sh
with
144 additions
and
0 deletions
status/fod-status.sh
0 → 100755
+
144
−
0
View file @
d69f3604
#!/bin/bash
arg1
=
"
$1
"
shift
1
source
./venv/bin/activate
##
case
"
$arg1
"
in
-p
|
--process-status
)
set
-e
echo
"# basic process status:"
./manage.py fodinfo
-s
;;
-D
|
--database-access-status
)
nopwds
=
1
if
[
"
$1
"
=
"--with-passwords"
]
;
then
nopwds
=
0
shift
1
fi
set
-e
echo
"# database access status:"
./manage.py diffsettings |
grep
-E
"DATABASES"
|
if
[
"
$nopwds
"
=
1
]
;
then
sed
-E
-e
"s/('PASSWORD': *)'[^']+'/
\\
1'XXXXXX'/"
else
cat
fi
echo
"SELECT 1"
| ./manage.py dbshell
;;
-H
|
--gunicorn-http-status
)
set
-e
port
=
"
$(
./manage.py fodinfo
-P
)
"
echo
"gunicorn http port=
$port
"
set
+e
http_ret_code
=
"
$(
curl
-k
--write-out
"%{http_code}"
--silent
--output
"/dev/null"
"http://localhost:
$port
/altlogin/"
)
"
echo
"gunicorn http_ret_code=
$http_ret_code
"
[
"
$http_ret_code
"
=
"200"
]
;;
-N
|
--netconf-access-status
)
nopwds
=
1
if
[
"
$1
"
=
"--with-passwords"
]
;
then
nopwds
=
0
shift
1
fi
set
-e
echo
"# NETCONF access status:"
./manage.py diffsettings |
grep
-E
"(NETCONF)|(SNMP_IP)"
|
if
[
"
$nopwds
"
=
1
]
;
then
sed
-E
-e
"s/(NETCONF_PASS
\s
*=
\s
*).*
$/
\1
'XXXXXX'/"
-e
"s/('community': *)'[^']+'/
\\
1'XXXXXX'/"
else
cat
fi
env
DJANGO_SETTINGS_MODULE
=
flowspy.settings python
-c
'
from utils.proxy import *;
proxy = Applier();
xml = proxy.get_existing_config_xml();
#print(xml);
print("access to NETCONF seems to be working");
'
"
$@
"
< /dev/null
;;
--sensu-status
)
"
$0
"
--status
statusx
=
"
$?
"
echo
"status=
$statusx
"
if
[
"
$statusx
"
=
0
]
;
then
echo
"all basic checks passed: OK"
exit
0
else
echo
"something went wrong during basic checks: ERROR"
exit
2
fi
;;
-S
|
status-detailed
)
#set -e
"
$0
"
--process-status
pstatus
=
"
$?
"
echo
"process status=
$pstatus
"
echo
"
$0
"
--database-access-status
--with-passwords
dstatus
=
"
$?
"
echo
"database access status=
$dstatus
"
echo
"
$0
"
--gunicorn-http-status
hstatus
=
"
$?
"
echo
"gunicorn http status=
$hstatus
"
echo
"
$0
"
--netconf-access-status
--with-passwords
nstatus
=
"
$?
"
echo
"NETCONF access status=
$nstatus
"
echo
all_status
=
$((
$pstatus
|
$dstatus
|
$hstatus
|
$nstatus
))
echo
"all_status=
$all_status
"
exit
"
$all_status
"
;;
*
|
-s
|
--status
)
#set -e
"
$0
"
--process-status
pstatus
=
"
$?
"
echo
"process status=
$pstatus
"
echo
"
$0
"
--database-access-status
dstatus
=
"
$?
"
echo
"database access status=
$dstatus
"
echo
"
$0
"
--gunicorn-http-status
hstatus
=
"
$?
"
echo
"gunicorn http status=
$hstatus
"
echo
"
$0
"
--netconf-access-status
nstatus
=
"
$?
"
echo
"NETCONF access status=
$nstatus
"
echo
all_status
=
$((
$pstatus
|
$dstatus
|
$hstatus
|
$nstatus
))
echo
"all_status=
$all_status
(0=OK)"
exit
"
$all_status
"
;;
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