I would like to set different contacts for same service based on from which host the service is called.
I've tried to use macro, but it gets translated only when command is called.
Then I've tried to edit command itself, but I think that variable CONTACTEMAIL is managed internally by icinga. I don't feel comfortable with adding only pure emails to some custom macro defined in HOST.
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Icinga *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Did anyone try/solve this?
You can define your contact on the host and delete it from services. This way every service in that host will inherit its contacts, if you define a contact again in the service it will ignore the previous one.
If the contacts depends on each service and not host, you will have to define same service for each host/contact.
$CONTACTEMAIL$ is a macro for the contact object, referencing to the attribute "email". Your command "notify-service-by-mail" will be assigned to such a contact as "service_notification_command" and that contact assigned to a service then (or via contactgroup). So once a notification happens, all required information is available and the core will translate the macro $CONTACTEMAIL$ to the real value and pass the converted string to the shell for execution then.
I would go for 2 options
use implied inheritance (http://docs.icinga.org/latest/en/objectinheritance.html), and only define contacts for the host, and not the service below. the configuration parser will recognise that contacts should be inherited and your services will get only the related host's assigned contacts then. Though, this may get ugly in terms of not wanting to notify the host alerts to the same contacts as for the service themselves.
making this more dynamic, i.e. setting service contacts based on their hostname, i would suggest using a config (generation) tool, allowing you e.g. manipulate the service->host relation with the defined contacts then. Though, there seems not really a generic solution out there... I would give LConf a try with the ldap tree itsself, but not sure if this would work out here, rather than writing a custom script, or use some puppet magic.
Related
When deploying Flink Stateful Functions, one needs to specify what the endpoints for the functions are, i.e. what URL does Flink need to hit in order to trigger the execution of a remote function.
The docs state:
The URL template name may contain template parameters that are filled
in based on the function’s specific type. For example, a message sent
to message type com.example/greeter will be sent to
http://bar.foo.com/greeter.
endpoints:
- endpoint:
meta:
kind: http
spec:
functions: com.example/*
urlPathTemplate: https://bar.foo.com/{function.name}
What other templating values does the urlPathTemplate support and where are these values taken from?
The only template value supported at the moment is the function name. i.e. the last value after the last forward slash /. You can place it wherever you would like in the template as long as it would resolve to a legal url at the end.
For example, this is also a valid template:
http://{function.name}.prod.svc.example.com
Then, a message address to com.example/greeter (in your example, with my new template) would resolve to:
http://greeter.prod.svc.example.com
If you are missing any other template parameters, feel free to connect with the Flink community over the user mailing list/JIRA. I'm sure they would be happy to learn about new uses cases ;-)
How do I get up my connections to show up in the designer ?
In my logicapp.json file I am setting the connection names to be functions of parameters like so:
"variables": {
"servicebus_1_Connection_Name": "[concat('servicebus-',parameters('logicAppName'))]",
"azureblob_1_Connection_Name": "[concat('blob-',parameters('logicAppName'))]"
},
However the designer doesn't like this:
When deploying, the connections show up no problem:
Try using parameters instead of variables for this. Variables need to be instantiated while parameters only need to be declared, bear in mind that you will need to declare the parameter in both the logic app template and in the arm deployment template in the logicapp.json file and also in the logicapp.parameters.json file.
Click anywhere on the logic app, then press F4 to get the properties of the logic app:
Change the resource group to the appropriate one that has your connections!
After going through the above 2 requirements, your connections will be displaying correctly.
I am currently talking to ConsoleKit with GDBus. I used the ConsoleKit2 XML files and gdbus-codegen to generate the code. Everything is working fine. But how can I check if an object exists? For example I want to see if there is a /org/freedesktop/ConsoleKit/Session2 (just an example, I know I could enumerate all Sessions in the Seat object).
I tried using the org.freedesktop.DBus.Peer.Ping function, but that will return
dbus-send --system --print-reply --reply-timeout=2000 --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/ConsoleKit/Seat1 org.freedesktop.DBus.Peer.Ping
Error org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.168" (uid=1000 pid=18279 comm="dbus-send --system --print-reply --reply-timeout=2") interface="org.freedesktop.DBus.Peer" member="Ping" error name="(unset)" requested_reply="0" destination="org.freedesktop.DBus" (bus)
You have several options, listed in order from most preferable to least preferable:
Enumerate all the sessions in the seat object using GetSessions().
Try and call the method you want on that session’s object path and see if it fails with an error from org.freedesktop.DBus.Error.
Call the Introspect() method on /org/freedesktop/ConsoleKit and parse the <node> elements from the resulting XML blob to see the current object path hierarchy.
The first option is probably the easiest to implement, and is how you’re intended to use the ConsoleKit API. Note that seat and session numbering is not deterministic, so you shouldn’t just hard-code a session object path in your code, since that path might change on future boots.
Also note that, as the ConsoleKit website says, ConsoleKit is deprecated in favour of systemd-logind, which you should consider using instead.
I have a DDI number +8XXXXXXXXXXXXXX from sip.ippi.fr and I tried setting it directly on zoiper phone and when I made a call from my mobile number it worked. I want to set this inside freePBX.
So, I set up a trunk with all the sip.ippi.fr details and I created a inbound route with "+8XXXXXXXXXXXXXX" (and once with the +) "8XXXXXXXXXXXXXX" as my DID number and set the destination as an extension. I have given the context as "from-trunk" in the trunk.
Now, when I try to call this DID number over the phone, I just get an reply that the number is not available. I checked the CDR reports, there is nothing updated there. So the call does not reach the server at all.
I am using asterisk 13 with freepbx setup on docker. Is there any configuration that I am missing ?
You need to register to your provider directly as you did with zoiper. Try to register your asterisk to the sip.ippi.fr so that provider can route the calls to your freepbx, then you can distribute the call whatever you like.
I haven't found any reason for the existence of a few of the App Engine classes. There's a PhoneNumber, a Link, a PostalAddress, a GeoPt, a Rating, etc. Why are these given special treatment? They don't seem to have any smarts - e.g. geo searching. I know Link has more space than a String property, but the rest?
See:
http://code.google.com/appengine/docs/java/datastore/dataclasses.html
Those types are 'semantic' types. They're present in the Java API for parity with the Python API. In the Python API, they define special behaviour with regards to the .to_xml() method - for example, a PhoneNumberProperty serializes like this:
<property name="foo" type="gd:phonenumber"><gd:phoneNumber>12345-678</gd:phoneNumber></property>
I think they're mostly just there to cover common cases and save developers time. If a lot of apps use a phone number field, why require each developer to have to write them? A developer can still write their own if they need/want to.
Not sure about java, but in python the following model/code (tested on dev server) will throw BadValueError, with the message "Invalid URL: stackoverflow.com"
class foo(db.model):
link = db.LinkProperty()
bar = foo()
bar.link = 'stackoverflow.com'
While:
bar.link = 'http://stackoverflow.com'
Works fine.
I haven't tested, but the other properties may or may not also do validation.
Basically using this types in your models allows to add indirect meta data to your code. This may be useful if you are working with any kind of universal renderer for your model classes or if you are performing validation of user input on your models.
For example if you are using PhoneNumber type for a field named userNumber you reflection based renderer may understand that it should automatically assign corresponding validator to text field which will represent it.
Regards,
Pavel.