Bonjour à tous,
J'essaie d'écrire un plugin en python pour Shinken (Nagios), mais voilà où ça coince :
Et voici ma fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 root@5lpo228:~# ./check_printers -H zeta PING zeta.domaine.fr (x.x.x.x) 56(84) bytes of data. 64 bytes from zeta.domaine.fr (x.x.x.x): icmp_req=1 ttl=63 time=0.552 ms --- zeta.domaine.fr ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.552/0.552/0.552/0.000 ms Traceback (most recent call last): File "./check_printers", line 99, in <module> ping() File "./check_printers", line 83, in ping if ping.count('100% packet loss') == 1: AttributeError: 'int' object has no attribute 'count
Je n'arrive pas à identifier mon erreur, donc si vous avez des idées, je suis preneuse
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 def ping(): ping = os.system('ping -c 1 ' + hostname) if ping.count('100% packet loss') == 1: print 'CRITICAL - ', hostname, 'is down' raise SystemExit(CRITICAL) else: print 'OK - ', hostname, 'is alive' raise SystemExit(OK)
Merci d'avance et bonne journée.
Partager