AIX/LINUX discovery creating alerts " /usr/bin/[ -d /home/ios/CM/DB/postgresql.conf" for VIOS servers.Issue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } While running discovery on AIX server, below alert is getting created on the AIX admin side. Sep 24 14:14:03 a20f80vio1 auth|security:alert sudo: bmcdisc : command not allowed ; TTY=pts/1 ; PWD=/home/bmcdisc ; USER=root ; COMMAND=/usr/bin/[ -d /home/ios/CM/DB/postgresql.conf ]Exploring CI Pattern, Pattern name: PostgreSQL DB Error:==========File Tracking2024-10-15 13:26:19: About to resolve [ CI Type: cmdb_ci_db_postgresql_instance | CI Data: {tcp_port=6080, instance=PostgreSQL, install_directory=/usr/ios/db/postgres13, name=PostgreSQL@a20f80vio1, config_file=/home/ios/CM/DB/postgresql.conf, postgres_conf=/home/ios/CM/DB/postgresql.conf, version=13.6, sys_class_name=cmdb_ci_db_postgresql_instance, config_directory=/home/ios/CM/DB} | Tracked File Definitions: [[ File Path =get_attr {"config_file"}| isSaveContent=true ]] ]2024-10-15 13:26:19: About to resolve definition get_attr {"config_file"}2024-10-15 13:26:19: Resolved expression: /home/ios/CM/DB/postgresql.conf2024-10-15 13:26:19: About to get file names from expression /home/ios/CM/DB/postgresql.conf2024-10-15 13:26:19: Executing SSH command as superuser: [ -d /home/ios/CM/DB/postgresql.conf ] && echo this_is_a_directory || echo this_is_a_file2024-10-15 13:26:21: Command result:Sorry, user bmcdisc is not allowed to execute '/usr/bin/[ -d /home/ios/CM/DB/postgresql.conf ]' as root on a20f80vio1.this_is_a_file========== Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Washington Patch 7 Cause<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } "Postgres DB" Pattern is configured to retrieve tracked config files OOB: https://<instancename>.service-now.com/$sn_pattern_designer.do?authoring_mode=modify&sys_id=78fd9b16d334413aafad45fdc3aa38ac&sysparm_view=&sysparm_record_target=sa_pattern&sysparm_record_row=2&sysparm_record_list=nameSTARTSWITHpostgre%5EORDERBYname&sysparm_record_rows=2 - As such, we'll run series of commands to obtained the necessary tracked config files. One of the command that we run is to determine if a location is a folder or file as noted here:https://www.cyberciti.biz/faq/check-if-a-directory-exists-in-linux-or-unix-shell/ EX: [ -d "$DIR" ] && echo "Dir" || echo "Not DIR"CMD ran by disco: sudo [ -d /home/ios/CM/DB/postgresql.conf ] && echo this_is_a_directory || echo this_is_a_file The code isn't explicitly running for a specific file; it's dynamic and will use a path. To determine whether it's a file or a folder, the following command is used:[ -d /home/ios/CM/DB/postgresql.conf ] If we already know the path is a file, we don't even need to check it. That command we provided is a specific example. During runtime it could any of the following combination:[ -d <path_to_file>][ -d <path_to_folder>] The command will give us output that it's a file or a folder. To clarify more: - Track File is a feature to grab configuration files from a host and stored on Service Now to track configuration changes.- We can explicitly configure a path to file or path to folder.- Track File logic will walk to that path and determine if it's a file or a folder. If it's a file, grab the file. If it's a folder, recursively drill into the folder to find more configuration files.- [ -d <path_to_file | path_to_folder>] is just a command for us to run to determine if current item is a file (then grab it) or folder (then walk into the folder)- [ -f <path_to_file> | <path_to_folder>] would serve exactly the same purpose here, so neither commands are used wrongly. The [-d] command is used to determine whether the current filesystem object being iterated over is a file or a directory. Based on the result: - if current object is a directory, walk into the directory and perform the checks again.- if the current object is a file, it reads the content. It's how programming works. We're not hardcoding any file name so we do not know specifically a file location. We started with a folder and have to recursively walk down the folder structure to look for configuration files as needed. Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } span { font-size: 12pt; font-family: Lato; color: var(--now-color--text-primary, #000000); } h2 { font-size: 24pt; font-family: Lato; color: var(--now-color--text-primary, black); } h3 { font-size: 18pt; font-family: Lato; color: var(--now-color--text-primary, black); } h4 { font-size: 14pt; font-family: Lato; color: var(--now-color--text-primary, black); } a { font-size: 12pt; font-family: Lato; color: var(--now-color--link-primary, #00718F); } a:hover { font-size: 12pt; color: var(--now-color--link-primary, #024F69); } a:target { font-size: 12pt; color: var(--now-color--link-primary, #032D42); } a:visited { font-size: 12pt; color: var(--now-color--link-primary, #00718f); } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } We run the following commandsudo [ -d <current_filesystem_object>] && echo this_is_a_directory || echo this_is_a_file If result is a directory, we'll fix the directory path for subsequent operations. If the command fails, we'll fall back to running the command without 'sudo' Discovery is able to discover the devices properly and obtained the configuration files so there is no failure. The only thing is that by attempting to run the command with 'sudo' first, it generates alerts. Customer does not need to configure anything. Alerts generated when running "sudo [ -d <current_filesystem_object>]" command can be safely ignored.