Community discussions

MikroTik App
 
mzilewicz
just joined
Topic Author
Posts: 5
Joined: Wed Nov 03, 2010 3:08 pm

printer toner probe & function

Wed Nov 03, 2010 4:34 pm

Hello.

I have created some probes in Dude to monitor toner levels on our printer copiers. I followed a tutorial on the forums that was posted a while back. The probes and function for pulling the SNMP values for toner levels are working great. I am able to see the toner remaining in a percenatge format and I am able to set a threshold for when it will send me an alert (25%)

My intention is to have it send an e-mail out then toner levels reach 25% to "order more toner" The issue that I am having is the probe is considered to be "down" when an SNMP value cannot be read from the printer (because it is switched off or there was a network interruption) So of course it is sending an e-mail to "order toner" when this happens.

I have attached a screenshot of both the probe and function configuration. I know there must be a way for it to still consider the probe "up" if it pulls a null value, but I am not sure how to work it into the function/probe. I appealt o anyone who was successfull with this.

Thanks.

Image
Image
 
User avatar
gsandul
Member Candidate
Member Candidate
Posts: 154
Joined: Mon Oct 19, 2009 1:42 pm

Re: printer toner probe & function

Thu Nov 04, 2010 11:09 am

So of course it is sending an e-mail to "order toner" when this happens.
You can make it to send e-mail to "SNMP read error" instead of "order toner".
Check this http://forum.mikrotik.com/viewtopic.php?f=8&t=43396
 
mzilewicz
just joined
Topic Author
Posts: 5
Joined: Wed Nov 03, 2010 3:08 pm

Re: printer toner probe & function

Thu Nov 04, 2010 4:12 pm

Thanks gsandul. I will check into this.
 
mzilewicz
just joined
Topic Author
Posts: 5
Joined: Wed Nov 03, 2010 3:08 pm

Re: printer toner probe & function

Thu Nov 04, 2010 7:26 pm

So, it looks like I can do this if I modify my function with an "if" statement. It looks like if I put something like this (from the link below):

<code>if(oid("1.3.6.1.2.1.2.2.1.16.7"),round(rate(oid("1.3.6.1.2.1.2.2.1.16.7")*8)),-1)\0d\0a</code>

I am telling it to look at "-1" as null. The problem is I tried working this into my function a few different ways without success. I get a "parse failed" Here is an example of what I was trying:

if(string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100,-1)

I know it must be a syntax error, somebody knowledgable with the syntax i'm sure could figure this out.

Thanks.
 
chrisd13
Frequent Visitor
Frequent Visitor
Posts: 68
Joined: Mon Feb 20, 2006 4:05 pm
Location: UK

Re: printer toner probe & function

Thu Nov 04, 2010 7:51 pm

From the code you have posted...
if(string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100,-1)
Your if statement is missing a third parameter.

try
if(string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100,"",-1)
I am not at my Dude install to test it, but I think that might help you out.
 
mzilewicz
just joined
Topic Author
Posts: 5
Joined: Wed Nov 03, 2010 3:08 pm

Re: printer toner probe & function

Sat Nov 06, 2010 6:45 pm

Hi chrisd13,

I made the change you specified. Do you know how I would have to set up the probe? If you take a look at my first post you will see how I have the probe set up now. It looks like I need to state somewhere in the probe that if the value pulled from SNMP is "-1" to still consider it up.

Thanks.
 
chrisd13
Frequent Visitor
Frequent Visitor
Posts: 68
Joined: Mon Feb 20, 2006 4:05 pm
Location: UK

Re: printer toner probe & function

Mon Nov 08, 2010 12:16 am

I've had another look at what you are trying to achieve and I think the following could give you the result you are looking for.. Unfortunately my printer displays the toner quanity in minus numbers which is no help to test this probe, but I think this will work.... :P

Function - toner()
string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100
Probe

Available: if(or(toner()<0,toner()=-1),1,0)
Error: if(or(toner()<1,toner()>25),"Toner Low","")

Give it a go and see what ya get.. Maybe one of the other guys can have a look and see if my probe structure is correct.
Don't forget to give Karma if we help you out :)
 
mzilewicz
just joined
Topic Author
Posts: 5
Joined: Wed Nov 03, 2010 3:08 pm

Re: printer toner probe & function

Sun Nov 21, 2010 8:06 pm

Thanks chrisd for all of your help. I have actually solved this in a different way. I am going to post what I have here in case anyone else runs into the same issue.


FUNCTION:
<?xml version="1.0" ?>
<dude version="3.6">
<Function>
<sys-type>57</sys-type>
<sys-id>42554</sys-id>
<sys-name>toner_black</sys-name>
<code>if(oid("1.3.6.1.2.1.43.11.1.1.9.1.1"),(string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100,"False")) \0d\0a\0d\0a</code>
</Function>
</dude>

PROBE:
<?xml version="1.0" ?>
<dude version="3.6">
<Function>
<sys-type>57</sys-type>
<sys-id>42554</sys-id>
<sys-name>toner_black</sys-name>
<code>if(oid("1.3.6.1.2.1.43.11.1.1.9.1.1"),(string_substring(oid("1.3.6.1.2.1.43.11.1.1.9.1.1")/oid("1.3.6.1.2.1.43.11.1.1.8.1.1"),0,4)*100,"False")) \0d\0a\0d\0a</code>
</Function>
</dude>


This works perfectly. If SNMP connectivity is lost, dude will not send out a notification. The only issue I am still having is that if the printer is showing a "toner low" status, then it loses SNMP connectivity and then comes back up, dude will re-send the notification that the toner is low. The only way I can see around this is to ack the printer when the toner low status comes on.

I hope this helps.
 
azul
just joined
Posts: 2
Joined: Wed Feb 22, 2012 12:28 pm

Re: printer toner probe & function

Wed Feb 22, 2012 12:35 pm

This works perfectly. If SNMP connectivity is lost, dude will not send out a notification. The only issue I am still having is that if the printer is showing a "toner low" status, then it loses SNMP connectivity and then comes back up, dude will re-send the notification that the toner is low. The only way I can see around this is to ack the printer when the toner low status comes on.
toner for printer
I hope this helps.
Please post a fix if you've found another work around on "toner low" status. I am having the same issue..

Who is online

Users browsing this forum: No registered users and 13 guests