Фильтр цветных принтеров
-
-
-
Предложенное выше решение не работает

Сделал такой фильтр для Xerox 7428. Ругается на if (model like "*7428*"). подскажите, что не так?
transport = CreateSNMPTransport($node);
if (transport == null)
{
trace(1,"Snmp transport error on ".$node->ipAddr);
return -1;
}
model = SNMPGetValue(transport, ".1.3.6.1.2.1.25.3.2.1.3.1");
if (model like "*7428*")
{
return $1;
}
else
{
trace(1,"Could not read value for ".$node->ipAddr);
return -1;
} -
А как именно ругается? может быть SNMPGetValue не срабатывает и model получается NULL ?
-
Ругается так:
Failed to execute autobind script for object 7428 [9255] (Error 5 in line 8: Invalid operation with NULL value)Решено.
Можно фильтровать по описанию:
return $node->sysDescription like "Xerox WorkCentre 7428*";можно по snmpOID
return $node->snmpOID == ".1.3.6.1.4.1.253.8.62.1.20.5.3.1";Если несколько моделей принтеров, то придётся указывать все через &&.
-
Ну да, если нода не смогла ответить по конкретному SNMP OIDу, то в model получалось null.
Там просто проверку можно добавить, аналогично как проверялось что SNMP транспорт создался:
if (model == null)...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login