Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
AnsibleMonitoring
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tec
AnsibleMonitoring
Commits
b8014c0b
Commit
b8014c0b
authored
Jan 14, 2020
by
tec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to general model, monitor logged in user count
parent
d33ddc89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
17 deletions
+23
-17
monitor_client.yml
monitor_client.yml
+23
-17
No files found.
monitor_client.yml
View file @
b8014c0b
...
...
@@ -5,26 +5,32 @@
remote_user
:
root
roles
:
-
role
:
cloudalchemy.node-exporter
pre_tasks
:
-
name
:
Ensure cron present (Debian)
apt
:
name=cron state=present
when
:
ansible_os_family == 'Debian'
tasks
:
-
name
:
Add getent passwd count monitor file
copy
:
dest
:
'
/usr/local/bin/getent-passwd-count.sh'
-
name
:
Add simple logging files
template
:
src
:
numeric_log.j2
dest
:
'
/usr/local/bin/ucc_node_{{
item.name
}}.sh'
owner
:
root
mode
:
755
content
:
|
#!/bin/bash
#
# Expose getent user count
#
# Usage: add this to crontab:
# */5 * * * * /usr/local/bin/getent-passwd-count.sh | sponge /var/lib/node_exporter/getent_passwd_count.prom
echo "# HELP node_getent_passwd_count number of users known"
echo "# TYPE node_getent_passwd_count gauge"
echo "node_getent_passwd_count $(getent passwd | wc -l)"
-
name
:
Add getent passwd count monitor cron job
loop
:
"
{{
shell_logs
}}"
-
name
:
Add cron jobs for simple logging
cron
:
name
:
Expose getent user count
name
:
"
{{
item.description
}}"
minute
:
"
*/5"
user
:
root
job
:
"
/usr/local/bin/getent-passwd-count.sh
>
/var/lib/node_exporter/getent_passwd_count.prom"
cron_file
:
getent-passwd-count
job
:
"
/usr/local/bin/ucc_node_{{item.name}}.sh
>
/var/lib/node_exporter/{{item.name}}.prom"
cron_file
:
"
node_{{item.name}}"
loop
:
"
{{
shell_logs
}}"
vars
:
shell_logs
:
-
name
:
getent_passwd_count
description
:
Expose getent user count
cmd
:
"
getent
passwd
|
wc
-l"
-
name
:
current_users_gauge
description
:
Expose total (unique) users currently logged in
cmd
:
"
users
|
sed
's/
/
\\
n/g'
|
uniq
|
wc
-l"
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment