How to generate logs with timestamp in sikuli? - sikuli

I want to generate logs with time stamp being in place of popups i have mentioned.
Please suggest some steps for generating logs with time stamp.
Code:-
click("1450851018693.png")
wait(2)
click(Pattern("1450851091319.png").targetOffset(1,2))
click(Pattern("1450851555941.png").targetOffset(-201,1))
type("111")
click(Pattern("1450851201892.png").targetOffset(-13,2))
type("121")
wait(1)
if exists ("1450851253342.png"):
popup("start button is enabled")
click("1450851253342.png")
In the above code instead of popups i want the messages to be logged in file with time stamp.
Please Help..

You can use the logging module from Python importing it and getting a logger instance:
import logging
FORMAT='%(asctime)-15s %(message)s'
logging.basicConfig(format=FORMAT)
logger=logging.getLogger('')
Then, use it in you code (per default, level info is not printed to the console, but warning is)
logger.warning('My message')
You should have a log entry in your like:
2016-03-07 13:10:43,151 My message
See Logging Python for description and basic tutorial.

Related

Wavefront Alerting when no data sent

I have wavefront alerts set up with the following alert condition:
ts(mytimeseries)<20000
Recently the datasource stopped sending data to wavefront but I did not receive an alert. I cannot figure out why this did not alert. Do I need to set up a separate alert for when data is not sent. Thanks
Yes in scenarios where there is no data sent you explicitly need to define the condition for that. Well the best approach is to create a new availability alert but still if you want to manipulate the same condition you can do something like below
default( 20001 ,ts(mytimeseries))<20000
In case there is no data found it will exceed your limit and will raise the alert

Zabbix - Problem with count function and external item data

Trying to setup Zabbix to show incomming login failures by syslog log files. I try to create an trigger which triggers when the last value occurs in the last 5 minutes of x amount of items.
The following expression is created:
Code:
count(/Syslog server/log[/var/log/failedlogin.log],5m,"like","last(/Syslog server/log[/var/log/failedlogin.log],#0)")>3
Also the following does not work:
Code:
count(/Syslog server/log[/var/log/failedlogin.log],5m,"like","{ITEM.LASTVALUE}")>3
I'm sure the count function works like it should be, when i fill in de variable manually the item does trigger.
But when i try to get a value out of an other items which is containing the data is seems to not work.
Could someone tell me if this is even possible? Thanks and greetings.

Flowgear: The 'Start' Node was not found in the correct sequence

While doing my certification in Flowgear I am getting this error while submitting the exercise number 11.
During production run there is no error.
Error - The 'Start' Node was not found in the correct sequence.
This is usually because the Start Node name has been changed. Click the Start Node header, delete the name, press return to commit the changes and try again.

How to get the csv alias for a thread in Jmeter sharing mode current thread?

Here is my test plan structure.
User Login
Runtime Controller
while controller !<> EOF
CSV dataset (items to add)
search and add to cart
Click cart.
Proceed to check out
Order submit.
Beanshell sampler to close CSV
User Logout.
I want each thread to read the csv till EOF and add these items to cart, hence I used the sharing
mode as current thread.Since add to cart and order submission is getting repeated for the test
duration I am closing the file and resetting the variable after order submit so that next iteration
will again start to read from beginning.
The beanshell code is :
import org.apache.jmeter.## Heading ##services.FileServer;
FileServer.getFileServer().closeFile("Scripts_Helan\\DSOrderParts.csv");
String pPartNum = vars.get("pPartNum");
vars.put("pPartNum", "");
But when I run the test Jmeter log is showing file name as
Stored: Scripts_Helan\DSOrderParts.csv Alias: Scripts_Helan\DSOrderParts.csv#1309262272
Don't I have to use the Alias in closeFile? How can I get it?[enter image description here][1]
[enter image description here][1]
I don't exactly get why you are using beanshell code here.
You can handle the "start all over when done" part with setting up the Thread Group accordingly
You can handle that "stop thread at end of file" part with setting up the CSV Data Set Config accordingly
Please clarify what makes handling the file in beanshell code neccessary.

zabbix regex to trigger for wrong data type

I have an item of type float, but sometimes a string is received in case of error instead of a number. How can I make a trigger regexp to fire in this case?
I have no idea now to check for "wrong data type".
Actually this is by design and what I'm trying to do is this: if the data gathering fails, I send an error message in order to see it on zabbix end.
I tried with nodata(0), but this doesn't seem to work.
In you case zabbix will not store the "wrong" value for the item. And if you don't care what the string is then you can just setup a trigger for "nodata" for the period of your interval. Look in the triggers manual and search for the "nodata".
Edit: scratch that, didn't read the whole question ....
Edit2: if you are certain that this is not working by design and not because your trigger interval misses the data interval, then you can try to catch the unsupported status. There is an open request for the functionality, but you can setup a side script similar to this. Or you can wrap the monitored item on the node into a UserParameter script that reads the value and prints -1 or something if it is not a number. Then proceed with a normal numeric trigger.