Commit b8014c0b authored by tec's avatar tec

Switch to general model, monitor logged in user count

parent d33ddc89
......@@ -5,26 +5,32 @@
remote_user: root
- role: cloudalchemy.node-exporter
- name: Ensure cron present (Debian)
apt: name=cron state=present
when: ansible_os_family == 'Debian'
- name: Add getent passwd count monitor file
dest: '/usr/local/bin/'
- name: Add simple logging files
src: numeric_log.j2
dest: '/usr/local/bin/ucc_node_{{ }}.sh'
owner: root
mode: 755
content: |
# Expose getent user count
# Usage: add this to crontab:
# */5 * * * * /usr/local/bin/ | 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
name: Expose getent user count
name: "{{ item.description }}"
minute: "*/5"
user: root
job: "/usr/local/bin/ > /var/lib/node_exporter/getent_passwd_count.prom"
cron_file: getent-passwd-count
job: "/usr/local/bin/ucc_node_{{}}.sh > /var/lib/node_exporter/{{}}.prom"
cron_file: "node_{{}}"
loop: "{{ 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
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