A service definition for a host looks like:
service{
name host_1_svc
....
check_command check_xyz!abc
}
A similar check needs to be performed on host2, except that the parameter to the check_command is lmn.
So I have to define:
service{
name host_2_svc
....
check_command check_xyz!lmn
}
What is the general convenient practice to avoid having to define the service over and over again with only a minor change?
Thanks,
Yash
You can define a custom host variable in each of the hosts:
define host{
use generic-host
host_name host1
address 10.0.0.1
_chk_value abc
}
define host{
use generic-host
host_name host2
address 10.0.0.2
_chk_value lmn
}
define service{
use generic-service
name host_chk_svc
host_name host1,host2
check_command check_abc!$_HOSTCHK_VALUE$
}
Note the underscore before the custom variable in the host definition (this defines it as custom), and then underscore at the beginning of the macro, but not in the middle of it ($_HOSTCUSTOM$ rather than $HOST_CUSTOM$).
http://nagios.sourceforge.net/docs/3_0/customobjectvars.html
Define a host group, then add that host to the group and you only need to define the service once.
the relationship between hosts and host groups and services and service groups can be hard to visualise, especially if you don't have a consistent naming scheme for the files in your nagios /etc folder.
Here are two charts i've found which help make sense of it:
a slideshow about vaious network monitoring options: http://www.semintelligent.com/talks/chuug/network-monitoring/#%2827%29
a short but helpful page about Nagios setup: http://www.the-tech-tutorial.com/?p=1433
Related
Problem when using yugabyte with persistence volume in docker.
On first run everything work fine, but when re-create container with existing volume, it fail to start:
master.err :
./../src/yb/master/master_main.cc:131] Network error (yb/util/net/socket.cc:325): Error binding socket to 172.28.0.3:7100: Cannot assign requested address (system error 99)
# 0x2938618 google::LogMessage::SendToLog()
# 0x29394d3 google::LogMessage::Flush()
# 0x29399cf google::LogMessageFatal::~LogMessageFatal()
# 0x2677cde main
# 0x7fb112f46825 __libc_start_main
# 0x260802e _start (edited)
There is a yugabyted.conf in yb-data/conf with the ip is written there
When we re-create container the container will get new ip but the ip in yugabyted.conf is old ip address of container
...
"advertise_address": "172.28.0.3",
...
When starting with yugabyted, the directory set by --base_dir holds the configuration in conf/yugabyted.conf, and the data directory in data which is set by --fs_data_dirs when starting yb-master and yb-tserver.
If you want the data directory in the volume but not the configuration, you can set it with:
--tserver_flags=fs_data_dirs=/ybdata --master_flags=fs_data_dirs=/ybdata
and leave --base_dir within the container
Another possibility if you want the configuration in the external volume is to use a configuration that is not dependent on container addresses, like with:
--advertise_address=0.0.0.0
which will listen on all interfaces
I have a list of first and last name and I need to check them against my LDAP and get the emails.
I have been working with the ldap_entry and ldap_attr, but those modules don't provide information.
This will ensure that the user exist and it will try to create it, but it doesn't provide information:
- name: Make sure we have an user
ldap_entry:
dn: CN=xxx,CN=Users,DC=example,DC=com
objectClass: person
server_uri: ldap://ldap.test.com
bind_dn: CN=admin,OU=Functional Accounts,DC=example,DC=com
bind_pw: xxxxxxxxx
Is there any way to get the email from a user using ansible?
Thanks
Its not an answer, but a workaround.
I end up installing ldapsearch and I use the command option on ansible.
- name: Test ldap
command: ldapsearch -x -h ldap.test.com -D "admin" -w "xxxxxxx" -b "CN=Users,DC=example,DC=com" "cn={{item}}" -s sub "(cn=*)" mail
register: ldap_output
with_items: "{{owner_list}}"
You should be able to retrieve that information using the community.general.ldap_search Ansible module using the attrs parameter. You might need to change the name of the attribute from mail to match your LDAP server's email attribute name.
- name: Retrieve a user's mail attribute.
community.general.ldap_search:
dn: CN=xxx,CN=Users,DC=example,DC=com
attrs:
- mail
server_uri: ldap://ldap.test.com
bind_dn: CN=admin,OU=Functional Accounts,DC=example,DC=com
bind_pw: xxxxxxxxx
register: ldap_search_result
- name: Print a user's mail attribute.
ansible.builtin.debug:
msg: |
DN: {{ ldap_search_result.results[0].dn }}
mail: {{ ldap_search_result.results[0].mail }}
The community.general.ldap_search module requires the python_ldap package to be installed which in turn requires some LDAP related packaged.
How shall I see all the status messages of a service in nagios xi. I send multiple status messages and the latest message is displayed in the dashboard UI. From where shall I retrieve all the previous messages?
You need define stalking_options directive in your services/hosts definition.
Example:
define service {
service_description Users count
host_name myhost1
use service_standard
check_command check_nrpe_custom!-H myhost1 -c check_user
stalking_options c,w,o,u
}
More info about stalking_options can be found here.
I have successfully installed the SortableBehaviorBundle in the Sonata-Admin. Now i'm not using only the default DB-connection, but some different for different bundles.
in config.yml
doctrine:
dbal:
default_connection: mysql
connections:
mysql:
driver: "%mysql_database_driver%"
...
geobundle:
driver: "%geo_database_driver%"
...
in vendor/pixassociates/sortable-behavior-bundle/Pix/SortableBehaviorBundle/Resources/config/services.yml
there ist the definition of
...
arguments:
- "#doctrine.orm.entity_manager"
if I change this to
- "#doctrine.orm.geobundle_entity_manager"
I get the sorted data from my geobundle-DB. If I try to override the setting by my own app/config/services.yml, I get a:
Attempted to call an undefined method named "get" of class
"Macrocom\GeoAdminBundle\Entity\AppAccessServiceprovider". Did you
mean to call e.g. "getAppAccess", "getConfig", "getCreatedAt",
"getId", "getIsActive", "getPosition", "getServiceprovider" or
"getUpdatedAt"?
but when I leave this on original setting I get
An exception has been thrown during the rendering of a template ("The
class 'ACME\GeoAdminBundle\Entity\AppAccessServiceprovider' was
not found in the chain configured namespaces
ACME\ApiBundle\Entity, ACME\CrmSyncBundle\Entity").
witch seems to try to access the mysql-DB and namespace.
As I dont wat to change the SortableBehaviorBundle everytime I deploy or update teh project to the server, is there a way to override the default-DB for this bundle only.
Best regards
RJ
I am newbie in network monitoring field and I have just started my work on nagios. So I have some basic doubts related to nagios.
we have a localhost.cfg at /usr/local/nagios/etc/objects/localhost.cfg
define service{
use local-service ; Name of service template to use
host_name blah-16.10
service_description Sample Check
check_command check_http_services!-H mydomain.com -u "/sample_url" --string "foo bar" -t 60
}
My questions:
1.) I know this script checks "http service" for the url "www.mydomain.com/sample_url" and find the text "foo bar" on that web page.
but I do not know the meaning/usage of the options (-H, -u, -t 60, --string)
i have googled but I can not find proper documentation where I can find the meaning of these parameters. Can anyone please suggest some link/urls for this?
2.) I want to implement kind of negative logic in my alarm. For example: I want to raise the alarm only when I find "status closed"`string on my web page (www.mydomain.com/sample_url)
How can I achieve this in nagios?
Note: During my searching, I found all those examples which worked like "If 'sample string' found within specific time then 'No Alarm'. If 'sample string' not found in specific time, then only 'Raise Alarm'".
But i need exact opposite.