Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / other / cacti-host @ 4b5ab0b3

Historique | Voir | Annoter | Télécharger (880 octets)

1 4b5ab0b3 Kasandra padisha
#!/bin/bash
2
#
3
# Munin script to obtain the number o hosts
4
#                  by kasandrapadisha@gmail.com
5
#
6
7
#----- Configuration variables
8
database="cacti"
9
hostname="localhost"
10
user="admincacti"
11
password="passwdcacti"
12
13
14
#----- Configuration variables
15
if [[ $1 != "" ]]; then
16
    if [[ $1 == "autoconf" ]]; then
17
        echo "yes"
18
        exit 0
19
    fi
20
    if [[ $1 == "config" ]]; then
21
        echo "graph_title Servidores consultados"
22
        echo "graph_vlabel Numero servidores (s)"
23
        echo "poller_hosts.label hosts(s)"
24
        echo 'graph_category cacti'
25
        exit 0
26
    fi
27
fi
28
29
salida=`mysql -B -e "SELECT value FROM settings WHERE name='stats_poller' LIMIT 1" -h $hostname --user=$user --password=$password $database`
30
31
if [[ $? != 0 ]]; then
32
        echo "No se pudo ejecutar"
33
        exit 0
34
fi
35
36
echo $salida | cut -f 6 -d":" | awk '{print"poller_hosts.value "$1}'