Posted on 03-24-2017 05:00 AM
Dear experts,
I am struggling with a smart computer group that is using a 'date' type result from an Extension Attribute. The EA is returning the date as 'YYYY-MM-DD hh:mm:ss', and I see the values in the JSS and in the mysql table. But I when I try to use any of the date type operators I always end up with an empty group. Any idea what might be wrong?
Posted on 03-24-2017 08:33 AM
Can we see an example of your output to make sure it's formatted correctly?
Posted on 03-24-2017 09:23 AM
Hi,
thanks for your interest. Let's start with the EA, the relevant part is
...
if [ $isLocalIP -eq 1 ]; then
date=$( date "+%Y-%m-%d %H:%M:%S" )
echo "<result>$date</result>"
fi
exit 0
...
On the JSS it looks like this: "LastTimeOnSite: 2017-03-24 11:31:21"
The DB gives me:
...
mysql> select report_id, value_on_client from extension_attribute_values where extension_attribute_id = 8;
--------------------------------
| report_id | value_on_client |
--------------------------------
| -1 | |
| 1780 | |
| 1805 | 2017-03-24 11:08:07 |
| 1809 | 2017-03-24 11:31:21 |
| 1808 | 2017-03-24 11:30:26 |
| 1806 | 2017-03-24 11:20:27 |
| 1804 | 2017-03-24 10:51:22 |
| 1807 | 2017-03-24 10:51:22 |
| 1781 | |
--------------------------------+
9 rows in set (0.00 sec)
mysql> ...
I assume it it something rather simple, but I don't spot it.
Posted on 03-24-2017 09:33 AM
Hmm. Nothing looks wrong about your EA to me at first glance. The EA is saved as a Date Extension Attribute I assume, or else you wouldn't even be able to try creating a Smart Group based on a date value.
Can you give us an example of an advanced search or Smart Group criteria you're using that isn't populating anything?
Posted on 03-27-2017 01:43 AM
Tes, the EA is saved with a Data Type of Date.
The smart group is very simple, there is just one single criterion: "LastTimeOnSite after 2017-01-01":
I also tried
- 'before' that date,
- before 2018-01-01
- less than x days ago, with x being 1 or 0
- more than x day ago, with x being 1 or 0
For all of these the smart group shows zero members.