AutoM8 Question - Picking up Switch Interfaces it should not be

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

Hi all,
I have an autom8 rule (Graph Rule) to match any device containing a certain text in the hostname which works great, the next part of it matches to see if the current Interface status is Up/Up as well as some text in the interface description (aka ifAlias). This is done with the attached rule set.
Screenshot 2023-08-14 132507.jpg
Screenshot 2023-08-14 132507.jpg (43.53 KiB) Viewed 1896 times
However when I run it its picking up interface that are Up/Down. Any idea what I have done wrong here.
Screenshot 2023-08-14 132507.jpg
Screenshot 2023-08-14 132507.jpg (43.53 KiB) Viewed 1896 times
Attachments
Screenshot 2023-08-14 132626.jpg
Screenshot 2023-08-14 132626.jpg (87.63 KiB) Viewed 1896 times
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by Osiris »

You really need to add parenthesis around the or's. Otherwise the logic is wrong
Before history, there was a paradise, now dust.
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

Have tried that and then I get no matches at all.
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by Osiris »

Show me what it looks like when you tried
Before history, there was a paradise, now dust.
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

See below.
Screenshot 2023-08-16 102513.jpg
Screenshot 2023-08-16 102513.jpg (159.67 KiB) Viewed 1693 times
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by Osiris »

The first guy inside the bracket should not have an AND.
Before history, there was a paradise, now dust.
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

Tried that and still getting no matches at all?
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by Osiris »

Show that screen capture?
Before history, there was a paradise, now dust.
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

Screenshot 2023-08-17 092426.jpg
Screenshot 2023-08-17 092426.jpg (103.27 KiB) Viewed 1643 times
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by Osiris »

Approximately line 858 in lib/api_automation.php there is a SQL statement, add a cacti_log($row_query); of that statement and the go the sthe rule page. It should post the SQL. Grab it from the cacti.log and post it.
Before history, there was a paradise, now dust.
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

This section?
$rule_name = db_fetch_cell_prepared('SELECT name
FROM automation_graph_rules
WHERE id = ?',
array($rule['id']));
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by TheWitness »

Right here, I actually added it for you.
Attachments
RowsQueryScreenShot.png
RowsQueryScreenShot.png (39.66 KiB) Viewed 1563 times
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by TheWitness »

I dropped this feature request in on your behalf:

https://github.com/Cacti/cacti/issues/5463
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
cksrealm
Cacti User
Posts: 140
Joined: Sun May 08, 2005 5:45 pm
Location: Sydney,Australia
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by cksrealm »

Got this in the logs.
2023-08-21 11:57:57 - CMDPHP SELECT * FROM (SELECT h.hostname AS automation_host, host_id, h.disabled, h.status, snmp_query_id, snmp_index , MAX(CASE WHEN field_name='ifAdminStatus' THEN field_value ELSE NULL END) AS 'ifAdminStatus', MAX(CASE WHEN field_name='ifAlias' THEN field_value ELSE NULL END) AS 'ifAlias', MAX(CASE WHEN field_name='ifDescr' THEN field_value ELSE NULL END) AS 'ifDescr', MAX(CASE WHEN field_name='ifHighSpeed' THEN field_value ELSE NULL END) AS 'ifHighSpeed', MAX(CASE WHEN field_name='ifHwAddr' THEN field_value ELSE NULL END) AS 'ifHwAddr', MAX(CASE WHEN field_name='ifIndex' THEN field_value ELSE NULL END) AS 'ifIndex', MAX(CASE WHEN field_name='ifIP' THEN field_value ELSE NULL END) AS 'ifIP', MAX(CASE WHEN field_name='ifName' THEN field_value ELSE NULL END) AS 'ifName', MAX(CASE WHEN field_name='ifOperStatus' THEN field_value ELSE NULL END) AS 'ifOperStatus', MAX(CASE WHEN field_name='ifSpeed' THEN field_value ELSE NULL END) AS 'ifSpeed', MAX(CASE WHEN field_name='ifType' THEN field_value ELSE NULL END) AS 'ifType' FROM host_snmp_cache AS hsc LEFT JOIN host AS h ON (hsc.host_id=h.id) LEFT JOIN host_template AS ht ON (h.host_template_id=ht.id) WHERE snmp_query_id=4 AND ( `h`.`description` LIKE '%c93%' OR `h`.`description` LIKE '%c38%' OR `h`.`description` LIKE '%c29%') GROUP BY host_id, snmp_query_id, snmp_index ORDER BY automation_host, CAST(snmp_index AS unsigned)) AS a WHERE ( a.`ifOperStatus` LIKE '%Up%' AND a.`ifAdminStatus` LIKE '%Up%' ( AND a.`ifAlias` LIKE '%//%' OR a.`ifAlias` LIKE '%Wireless%' OR a.`ifName` LIKE '%Stack%' ))
System - Red Hat Enterprise
Cacti Version - 1.2.23
RRDTool - 1.7.0
Poller - CMD
[u]Plugins Installed[/u]
Monitor 2.5
ReportIT 1.1.3
Thold 1.7
Weathermap 1.0
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: AutoM8 Question - Picking up Switch Interfaces it should not be

Post by TheWitness »

What does that query return? It looks kind of right.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests