brouillon_snmp
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
brouillon_snmp [2008/08/28 12:15] – thierry | brouillon_snmp [2008/08/28 13:18] (Version actuelle) – thierry | ||
---|---|---|---|
Ligne 292: | Ligne 292: | ||
Comme vous pouvez l' | Comme vous pouvez l' | ||
+ | |||
Ligne 315: | Ligne 316: | ||
$ snmpwalk -v 2c -c code_secret1 localhost .iso | $ snmpwalk -v 2c -c code_secret1 localhost .iso | ||
(huge output !) | (huge output !) | ||
+ | |||
+ | Un poil plus interessant: | ||
+ | $ snmpwalk -v 2c -c code_secret1 localhost .1.3.6.1.4.1.2021.8.1 | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
Ligne 333: | Ligne 344: | ||
SNMP-MPD-MIB:: | SNMP-MPD-MIB:: | ||
| | ||
+ | |||
+ | ==== snmpset ==== | ||
+ | Fixer une valeur:\\ | ||
+ | "The SET request is used to modify information on the target agent - updating the configuration of that agent, or controlling the behaviour of the remote system." | ||
+ | [[http:// | ||
+ | |||
+ | |||
+ | ==== snmptrap ==== | ||
+ | FIXME | ||
+ | |||
+ | ====== tips ====== | ||
+ | ===== snmp et commande externe ===== | ||
+ | |||
+ | On va prendre exemple d'un monitoring de RAID ! | ||
+ | |||
+ | |||
+ | ==== commande ==== | ||
+ | On a composé un script de monitoring RAID trés simple: | ||
+ | $ cat / | ||
+ | #!/bin/sh | ||
+ | | ||
+ | # pour snmpd | ||
+ | # Il n' | ||
+ | | ||
+ | MDADM=/ | ||
+ | EGREP=/ | ||
+ | | ||
+ | [ -x " | ||
+ | | ||
+ | COUNT=0 | ||
+ | RAIDOK=0 | ||
+ | CRITICAL=0 | ||
+ | | ||
+ | for RAIDDEV in /dev/md* | ||
+ | do | ||
+ | if [ -b " | ||
+ | then | ||
+ | COUNT=$(( COUNT + 1 )) | ||
+ | | ||
+ | if [ -z "$( $MDADM --detail $RAIDDEV | $EGREP '^ *State *: *(clean|active) *$' )" ] | ||
+ | then | ||
+ | CRITICAL=$(( CRITICAL + 1 )) | ||
+ | else | ||
+ | RAIDOK=$(( RAIDOK + 1 )) | ||
+ | fi | ||
+ | fi | ||
+ | done | ||
+ | | ||
+ | if [ " | ||
+ | then | ||
+ | echo "RAID OK ($RAIDOK/ | ||
+ | else | ||
+ | echo "RAID CRITICAL ($CRITICAL/ | ||
+ | fi | ||
+ | | ||
+ | exit 0 | ||
+ | | ||
+ | ### vim: set shiftwidth=2 softtabstop=2 : ### | ||
+ | |||
+ | En root, quand on fait : **''/ | ||
+ | # / | ||
+ | RAID OK (2/2) | ||
+ | |||
+ | On attend qu'une simple ligne en retour, avec " | ||
+ | |||
+ | Mais en simple **'' | ||
+ | $ / | ||
+ | mdadm: cannot open /dev/md0: Permission denied | ||
+ | mdadm: cannot open /dev/md1: Permission denied | ||
+ | RAID CRITICAL (2/2) | ||
+ | |||
+ | Donc, il faudra l' | ||
+ | |||
+ | On va utiliser [[brouillon_sudo|sudo]] | ||
+ | |||
+ | Donc, aprés avoir configuré " | ||
+ | $ sudo / | ||
+ | RAID OK (2/2) | ||
+ | |||
+ | Bien ! | ||
+ | |||
+ | ==== snmpd.conf ==== | ||
+ | |||
+ | Insérer la commande dans le fichier de conf (exemple): | ||
+ | # TJ ---------- | ||
+ | exec raidmon / | ||
+ | # ------------- | ||
+ | |||
+ | Puis on redemarre: | ||
+ | # / | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== snmpget RAID ==== | ||
+ | |||
+ | $ snmpget -v 2c -c code_secret1 localhost .1.3.6.1.4.1.2021.8.1.101.1 | ||
+ | UCD-SNMP-MIB:: | ||
+ | Ou encore: | ||
+ | $ snmpget -v 2c -c code_secret1 localhost UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | |||
+ | Un peu plus d' | ||
+ | $ snmpwalk -v 2c -On -c code_secret1 localhost .1.3.6.1.4.1.2021.8.1 | ||
+ | .1.3.6.1.4.1.2021.8.1.1.1 = INTEGER: 1 | ||
+ | .1.3.6.1.4.1.2021.8.1.2.1 = STRING: raidmon | ||
+ | .1.3.6.1.4.1.2021.8.1.3.1 = STRING: / | ||
+ | .1.3.6.1.4.1.2021.8.1.100.1 = INTEGER: 0 | ||
+ | .1.3.6.1.4.1.2021.8.1.101.1 = STRING: RAID OK (2/2) | ||
+ | .1.3.6.1.4.1.2021.8.1.102.1 = INTEGER: 0 | ||
+ | .1.3.6.1.4.1.2021.8.1.103.1 = STRING: | ||
+ | |||
+ | Si j'ai bien compris, chaque script ajouté dans la conf de " | ||
+ | |||
+ | Donc: | ||
+ | .1.3.6.1.4.1.2021.8.1.1.1 | ||
+ | .1.3.6.1.4.1.2021.8.1.1.2 | ||
+ | .1.3.6.1.4.1.2021.8.1.1.3 | ||
+ | etc... | ||
+ | .1.3.6.1.4.1.2021.8.1.101.1 | ||
+ | .1.3.6.1.4.1.2021.8.1.101.2 | ||
+ | .1.3.6.1.4.1.2021.8.1.101.3 | ||
+ | etc... etc... | ||
+ | |||
+ | ==== snmp et autres ==== | ||
+ | === disk === | ||
+ | Documenté dans le fichier de conf, on ajouter: | ||
+ | # TJ --------- | ||
+ | disk / 10000000 | ||
+ | # ------------ | ||
+ | Pour voir la place dispo sur le disk (avec un minimum facultatif): | ||
+ | $ snmpwalk -v 2c -c code_secret1 localhost .1.3.6.1.4.1.2021.9 | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | UCD-SNMP-MIB:: | ||
+ | === charge cpu === | ||
+ | $ snmpwalk -v 2c -c code_secret1 localhost .1.3.6.1.4.1.2021.10 | ||
+ | |||
+ | |||
brouillon_snmp.txt · Dernière modification : 2008/08/28 13:18 de thierry