summaryrefslogtreecommitdiffstats
path: root/contrib/munin/accounts.py
blob: 8ad929fc632888c392724c9e53ce464fb7c0cae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(abspath(__file__)))))

from account import AccountService
from app import app

if __name__ == "__main__":

    if len(sys.argv) > 1 and sys.argv[1] == 'config':
        print('graph_title Spline Accounts')
        print('graph_vlabel Number')
        print('accounts.label Accounts')
    else:
        service = AccountService(app.config['LDAP_HOST'], app.config['LDAP_BASE_DN'],
            app.config['LDAP_ADMIN_USER'], app.config['LDAP_ADMIN_PASS'],
            app.all_services)

        accounts = service.find()

        print(('accounts.value %d' % len(accounts)))